Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Problem in generated server.xml preventing web-app from reading files
Problem in generated server.xml preventing web-app from reading files [message #711440] Sat, 06 August 2011 06:08 Go to next message
Steve Ash is currently offline Steve AshFriend
Messages: 4
Registered: June 2011
Junior Member
Hello,

I am using Tomcat 7.0.19, Eclipse 3.7 (i.e. WTP 3.3) and Maven (via m2e-wtp from jboss). If I use default options (i.e. automatically publish, no check in "serve modules without publishing") then everything works fine -- except that it redeploys constantly.

When I try to run with "serve modules without publishing" I cannot start my web app. I can't find some files:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.19
log4j:ERROR Could not read configuration file from URL [file:/home/ashsteph/workspace/fuzzy-project_trunk/fuzzy-admin-webapp/src/main/resources/WEB-INF/classes/log4j.properties].
java.io.FileNotFoundException: /home/ashsteph/workspace/fuzzy-project_trunk/fuzzy-admin-webapp/src/main/resources/WEB-INF/classes/log4j.properties (No such file or directory)

This path its looking for is invalid and incorrect. It should be looking in target. Following the path of someone else on this forum I examined the server.xml that WTP is generated and spotted something strange:

In the <Context> tag there was an attribute:

extraResourcePaths="/WEB-INF/classes|/home/ashsteph/workspace/fuzzy-project_trunk/fuzzy-admin-webapp/target/classes;/home/ashsteph/workspace/fuzzy-project_trunk/fuzzy-admin-webapp/target/m2e-wtp/web-resources

this /WEB-INF/classes| business seems a bit odd-- the rest are semicolon delimited. If I remove the "/WEB-INF/classes|" but keep the rest of the semi-colon list -- then everything works beautfiully.

Who is appending this /WEB-INF/classes| pipe-delimited thing? And how do I fix this?

Steve

Re: Problem in generated server.xml preventing web-app from reading files [message #711443 is a reply to message #711440] Sat, 06 August 2011 06:12 Go to previous messageGo to next message
Steve Ash is currently offline Steve AshFriend
Messages: 4
Registered: June 2011
Junior Member
It appears that its related to bug 318449 which was supposed to have been fixed in 3.3.0 -- I'm guessing this didn't happen.
Re: Problem in generated server.xml preventing web-app from reading files [message #713498 is a reply to message #711443] Mon, 08 August 2011 14:27 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
On 8/6/2011 2:12 AM, Steve Ash wrote:
> It appears that its related to bug 318449 which was supposed to have
> been fixed in 3.3.0 -- I'm guessing this didn't happen.

Actually, I believe your problem is a side effect of Bug 333102[1]. I
may not be recollecting exactly, but the problem goes something like
this. To get servlet annotations working, the servlet classes have to
be accessible as resources in addition to being accessible via
classloading. As a result, when Tomcat "asks" if "WEB-INF/classes"
exists as a resource, the answer from the custom classloader used by the
"Serve modules without publishing" is "yes". Tomcat then asks for the
URL to "/WEB-INF/classes" in your project, appends the name of the
resource (such as "log4j.properties") to that URL and tries to use the
URL to read the resource. Since resources destined for
"WEB-INF/classes" exist in multiple locations in your project, the URL
returned above can only work for one of them. In your case, it's the
wrong one.

The workaround is to either not use "Serve modules without publishing",
or arrange for the desired file to be at the location the
"WEB-INF/classes" URL will try to access.

Cheers,
Larry

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=333102
Previous Topic:Problem with tomcat 7.0.11 + Maven + "serve modules without publishing" : return of bug 31
Next Topic:DOM of editing file
Goto Forum:
  


Current Time: Thu Mar 28 21:56:35 GMT 2024

Powered by FUDForum. Page generated in 0.02272 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top