Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Problem with tomcat 7.0.11 + Maven + "serve modules without publishing" : return of bug 31
Problem with tomcat 7.0.11 + Maven + "serve modules without publishing" : return of bug 31 [message #660608] Sat, 19 March 2011 17:38 Go to next message
slaurent is currently offline slaurent
Messages: 5
Registered: February 2010
Junior Member
Hello,

I'm using SpringSource ToolSuite 2.6.0 (based on eclipse 3.6.2) with tomcat 7.0.11 and a maven project (a Roo example).

When I deploy the webapp without "Serve modules without publishing" it works OK.
But when I activate this feature, the Spring context fails to load because it fails to find the persistence.xml file :

java.io.FileNotFoundException: /Users/slaurent/dev/workspaces/workspace-sts-2.6.0.RELEASE/c linic/src/main/webapp/WEB-INF/classes/META-INF/persistence.x ml (No such file or directory)

Indeed, with maven it should be looking for classpath resources in target/classes not in src/main/webapp/WEB-INF/classes

I spent some time trying to debug this and I think that the root cause is that in the <Context> that WTP generated for tomcat, the <Resources> element has the attribute
extraResourcePaths=" /WEB-INF/classes|/Users/slaurent/dev/workspaces/workspace-st s-2.6.0.RELEASE/clinic/target/classes "

It seems to be just like bug 318449 but I thought it had been fixed in Helios SR2 ??

[Updated on: Sat, 19 March 2011 17:38]

Report message to a moderator

Re: Problem with tomcat 7.0.11 + Maven + "serve modules without publishing" : return of bu [message #660771 is a reply to message #660608] Mon, 21 March 2011 10:12 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 3/19/2011 5:38 PM, slaurent wrote:
> Hello,
>
> I'm using SpringSource ToolSuite 2.6.0 (based on eclipse 3.6.2) with
> tomcat 7.0.11 and a maven project (a Roo example).
>
> When I deploy the webapp without "Serve modules without publishing" it
> works OK.
> But when I activate this feature, the Spring context fails to load
> because it fails to find the persistence.xml file :
>
> java.io.FileNotFoundException:
> /Users/slaurent/dev/workspaces/workspace-sts-2.6.0.RELEASE/c
> linic/src/main/webapp/WEB-INF/classes/META-INF/persistence.x ml (No such
> file or directory)
>
> Indeed, with maven it should be looking for classpath resources in
> target/classes not in src/main/webapp/WEB-INF/classes
>
> I spent some time trying to debug this and I think that the root cause
> is that in the <Context> that WTP generated for tomcat, the <Resources>
> element has the attribute extraResourcePaths="
> /WEB-INF/classes|/Users/slaurent/dev/workspaces/workspace-st
> s-2.6.0.RELEASE/clinic/target/classes "
>
> It seems to be just like bug 318449 but I thought it had been fixed in
> Helios SR2 ??

It got broke again post 7.0.8, see Bug 338564[1]. I assume this is the
cause of your symptom. The fix for Tomcat 7.0.9 and later is already
present in WTP 3.3M6, and was recently committed to WTP 3.2.4. The
timing didn't allow it to get squeezed into WTP 3.2.3.

If you download the "Updated loader jar for Tomcat 7.0.9 and later"
attachment in the bug and save it as
"org.eclipse.jst.server.tomcat.runtime.70.loader.jar" (instead of
"*.zip"), then you can copy this one on top of the one in the
"<workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp?/lib "
directory and it should work correctly. If you disable and re-enable
the "Serve modules without publishing" feature, you will have to re-copy
the jar.

Alternatively, until WTP 3.2.4 comes out, you could replace the copy in
the org.eclipse.jst.server.tomcat.core_1.1.203.v20110201.jar plug-in.
Without the code changes to the plug-in for WTP 3.2.4, it could no
longer support Tomcat 7.0.8, but it would work for Tomcat 7.0.9 and
later, which would be more useful. At least until they break it again.
Hopefully things have stabilized in Tomcat relative to this feature.
I don't see any further improvements of the type the have made so far to
the file in question.

Cheers,
Larry

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=338564
Re: Problem with tomcat 7.0.11 + Maven + "serve modules without publishing" : return of bu [message #661045 is a reply to message #660771] Tue, 22 March 2011 17:21 Go to previous messageGo to next message
slaurent is currently offline slaurent
Messages: 5
Registered: February 2010
Junior Member
Thanks for your reply but I think there's still a bug :

A call to classloader.getResource("log4j.properties") returns the URL :
file:/Users/slaurent/dev/workspaces/workspace-sts-2.6.0.RELE ASE/clinic/src/main/webapp/WEB-INF/classes/log4j.properties

but not such file exists. The correct file that should have been returned is :
file:/Users/slaurent/dev/workspaces/workspace-sts-2.6.0.RELE ASE/clinic/target/classes/log4j.properties

The problem is that Context/Resources has the following attribute :

extraResourcePaths=" /WEB-INF/classes|/Users/slaurent/dev/workspaces/workspace-st s-2.6.0.RELEASE/clinic/target/classes "

when I remove it it works fine.

Besides this bug, I'm wondering why WTP does not use the classes provided by tomcat : org.apache.naming.resources.VirtualDirContext instead of WtpDirContext
and org.apache.catalina.loader.VirtualWebappLoader instead of WtpWebappLoader
?

I tried with my project (by manually editing the Context xml file and it works fine.
Re: Problem with tomcat 7.0.11 + Maven + "serve modules without publishing" : return of bu [message #711436 is a reply to message #661045] Sat, 06 August 2011 01:57 Go to previous message
Steve Ash is currently offline Steve Ash
Messages: 4
Registered: June 2011
Junior Member
Did you ever get a response back to this? I'm having the same exact problem and I'm running WTP 3.3 and Tomcat 7.0.19
Previous Topic:Link inside proposals?
Next Topic:Problem in generated server.xml preventing web-app from reading files
Goto Forum:
  


Current Time: Thu Aug 28 21:25:19 EDT 2014

Powered by FUDForum. Page generated in 0.02142 seconds