|Problem in generated server.xml preventing web-app from reading files [message #711440]
||Sat, 06 August 2011 02:08
| Steve Ash
Registered: June 2011
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:
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?
|Re: Problem in generated server.xml preventing web-app from reading files [message #713498 is a reply to message #711443]
||Mon, 08 August 2011 10:27
| Larry Isaacs
Registered: July 2009
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. 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
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.
Powered by FUDForum
. Page generated in 0.03149 seconds