Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317834 - Serve modules without publishing is not working
Summary: Serve modules without publishing is not working
Status: RESOLVED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.common (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Target Milestone: 3.2.1   Edit
Assignee: Carl Anderson CLA
QA Contact: Carl Anderson CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 10:38 EDT by Iván Perdomo CLA
Modified: 2011-03-07 03:04 EST (History)
5 users (show)

See Also:
ccc: pmc_approved? (david_williams)
ccc: pmc_approved? (raghunathan.srinivasan)
ccc: pmc_approved? (naci.dai)
deboer: pmc_approved+
ccc: pmc_approved? (neil.hauge)
ccc: pmc_approved? (kaloyan)
cbridgha: review+


Attachments
Error stack traces when starting the Apache Tomcat server (5.30 KB, text/plain)
2010-06-24 10:38 EDT, Iván Perdomo CLA
no flags Details
Tomcat configuration (59.79 KB, image/png)
2010-06-24 10:39 EDT, Iván Perdomo CLA
no flags Details
.project file used by the webapp (747 bytes, text/xml)
2010-06-24 11:33 EDT, Iván Perdomo CLA
no flags Details
.classpath file (1.34 KB, text/xml)
2010-06-24 11:33 EDT, Iván Perdomo CLA
no flags Details
Changes in the .classpath as suggested by Larry (comment #4) (1.18 KB, text/plain)
2010-06-25 03:42 EDT, Iván Perdomo CLA
no flags Details
Error log from the current workspace session (3.82 KB, text/plain)
2010-06-25 03:43 EDT, Iván Perdomo CLA
no flags Details
.settings/org.eclipse.wst.common.component (925 bytes, text/xml)
2010-06-25 11:31 EDT, Iván Perdomo CLA
no flags Details
Add a simple null check to VirtualContainer.createVirtualResource() (1.51 KB, patch)
2010-07-05 07:10 EDT, Carl Anderson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iván Perdomo CLA 2010-06-24 10:38:39 EDT
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
Comment 1 Iván Perdomo CLA 2010-06-24 10:39:29 EDT
Created attachment 172618 [details]
Tomcat configuration
Comment 2 Iván Perdomo CLA 2010-06-24 11:33:03 EDT
Created attachment 172625 [details]
.project file used by the webapp
Comment 3 Iván Perdomo CLA 2010-06-24 11:33:44 EDT
Created attachment 172626 [details]
.classpath file

I think that here is where the configuration have changed.
Comment 4 Larry Isaacs CLA 2010-06-24 22:09:12 EDT
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.
Comment 5 Iván Perdomo CLA 2010-06-25 03:41:52 EDT
(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
Comment 6 Iván Perdomo CLA 2010-06-25 03:42:49 EDT
Created attachment 172716 [details]
Changes in the .classpath as suggested by Larry (comment #4)
Comment 7 Iván Perdomo CLA 2010-06-25 03:43:14 EDT
Created attachment 172718 [details]
Error log from the current workspace session
Comment 8 Larry Isaacs CLA 2010-06-25 09:15:26 EDT
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.
Comment 9 Iván Perdomo CLA 2010-06-25 11:31:04 EDT
Created attachment 172769 [details]
.settings/org.eclipse.wst.common.component

As requested (in comment #8) the .settings/org.eclipse.wst.common.component file
Comment 10 Iván Perdomo CLA 2010-06-25 11:40:14 EDT
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
Comment 11 Larry Isaacs CLA 2010-06-25 12:26:55 EDT
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.
Comment 12 Bernhard Stader CLA 2010-06-28 04:48:54 EDT
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.
Comment 13 Carl Anderson CLA 2010-07-05 07:10:52 EDT
Created attachment 173407 [details]
Add a simple null check to VirtualContainer.createVirtualResource()
Comment 14 Carl Anderson CLA 2010-07-05 07:14:59 EDT
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.
Comment 15 Chuck Bridgham CLA 2010-07-07 09:13:50 EDT
approved
Comment 16 Carl Anderson CLA 2010-07-07 09:35:34 EDT
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.
Comment 17 Carl Anderson CLA 2010-07-07 11:33:41 EDT
Committed to HEAD for WTP 3.2.1 and WTP 3.3
Comment 18 count negative CLA 2011-03-06 04:48:38 EST
Please reopen for WTP 3.2.3.v201101121727 because there is the same behavior as in 3.2.0
Comment 19 count negative CLA 2011-03-07 03:04:25 EST
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.
Comment 20 count negative CLA 2011-03-07 03:04:58 EST
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.