Community
Participate
Working Groups
Created attachment 172617 [details] Error stack traces when starting the Apache Tomcat server I have downloaded Eclipse Helios (that includes WTP 3.2.0) and tested the usual configuration I use in 3.5 for a Apache tomcat based webapp. I know that there has been enhancements in the 'Serve modules without publishing' feature, but to me it fails with a NPE, and then the tomcat server tries to load the application from the disk and there is nothing there. Attached you'll find the two error stack trace (errors.log) when starting the tomcat server. I have tested the same server configuration without the 'Serve modules without publishing' and it works just fine. Cheers, Iván
Created attachment 172618 [details] Tomcat configuration
Created attachment 172625 [details] .project file used by the webapp
Created attachment 172626 [details] .classpath file I think that here is where the configuration have changed.
As shown in the stack trace, the TomcatPublishModuleVisitor is calling VirtualContainer.getResources(). It does this simply to get a list of resources it needs to examine in an attempt to identify all the "webcontent" folders it needs to handle. Some "edge case" in your project is causing this getResources() request to throw the NPE. My first guess would be the classpathentry items in the ".classpath" file that contain [kind="src" path="/OpenbravoTrl"] and [kind="src" path="/OpenbravoWAD"]. You could try temporarily removing those two items from the ".classpath" file and see if the server will publish without the NPE with "Server Modules..." enabled. Until the "problem" resource is identified, it will be hard to say where the bug actually is. At this point, I can only say it isn't in the WTP Tomcat plug-ins.
(In reply to comment #4) > As shown in the stack trace, the TomcatPublishModuleVisitor is calling > VirtualContainer.getResources(). It does this simply to get a list of > resources it needs to examine in an attempt to identify all the "webcontent" > folders it needs to handle. Some "edge case" in your project is causing this > getResources() request to throw the NPE. My first guess would be the > classpathentry items in the ".classpath" file that contain [kind="src" > path="/OpenbravoTrl"] and [kind="src" path="/OpenbravoWAD"]. You could try > temporarily removing those two items from the ".classpath" file and see if the > server will publish without the NPE with "Server Modules..." enabled. Until > the "problem" resource is identified, it will be hard to say where the bug > actually is. At this point, I can only say it isn't in the WTP Tomcat > plug-ins. Hi Larry, First of all, thanks for your suggestions. I tried removing the two additional projects from the .classpath and is still failing. Attached you'll find the changes in the .classpath (diff) and the exported error log from the current workspace session. Any more ideas? Iván
Created attachment 172716 [details] Changes in the .classpath as suggested by Larry (comment #4)
Created attachment 172718 [details] Error log from the current workspace session
Please attach the ".settings/org.eclipse.wst.common.component" file from your project. The "problem" resource could be in there. Also, you could try creating a new project. Then start duplicating the Java Build Path and Deployment Assembly settings of your "problem" project in the new project and see if you can find which setting causes the NPE for the new project. Thanks.
Created attachment 172769 [details] .settings/org.eclipse.wst.common.component As requested (in comment #8) the .settings/org.eclipse.wst.common.component file
Hi Larry, You pointed me in the right direction. When double checking the .setting/org.eclipse.wst.common.component file I noticed that I had some entries pointing to deleted folders. With a clean wst.common.component file (as the one attached) the application loads just fine. Again, thanks for your support. Best Regards, Iván
Thanks, that was going to be my next guess. Re-opening since there is still a bug. Given the cause you discovered, I would say that VirtualContainer.createVirtualResource() shouldn't be throwing NPEs in this case.
I too have problems when using serve modules without publishing. Whereas the same configuration works with publishing. Some resources are not found because the false folder is used. For example: i have a maven project with file structe src/main/java, src/main/webapp and src/main/resources. in src/main/resources/ the file log4j.properties exists and the standard java output path is target/classes When starting the server the file log4j.properties is in (workspace location)/target/classes but it is expected to be in (workspace location)/src/main/webapp/WEB-INF/classes. So a java.io.FileNotFoundException is thrown.
Created attachment 173407 [details] Add a simple null check to VirtualContainer.createVirtualResource()
Since we are already shutting down WTP 3.2.1, and since PMC review is needed, I am adding in Chuck Bridgham as a reviewer just to ensure that another set of eyes reviews this code fix before requesting PMC approval.
approved
This is a minor NPE which is preventing the "Serve modules without publishing" from working properly under certain conditions. There is no workaround. I have run the JUnit bucket against this fix, as well as tested by hand. Simply put, if there is no underlying Eclipse resource for a component resource, VirtualContainer.createVirtualResource() now returns null instead of an NPE. (Note that it would already return null if the type was not a FILE or a FOLDER.) Chuck Bridgham has reviewed this fix. This is a low risk fix- we are adding in a null check, and returning null from a method that could already return null.
Committed to HEAD for WTP 3.2.1 and WTP 3.3
Please reopen for WTP 3.2.3.v201101121727 because there is the same behavior as in 3.2.0
Ah, ok. After some investigations on weekend. I can now say it's only _not_ working if you use a tomcat 7 installation (7.0.8) and enable "serve modules without publish". On my old tomcat 6, everything is working fine.