Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 259938

Summary: Running Tomcat in debug mode fails to deploy properly with multiple projects
Product: [WebTools] WTP Java EE Tools Reporter: David Newcomb <david.newcomb>
Component: jst.j2eeAssignee: Kaloyan Raev <kaloyan>
Status: CLOSED WORKSFORME QA Contact: Chuck Bridgham <cbridgha>
Severity: major    
Priority: P3 CC: ccc, deboer, jsholl
Version: unspecified   
Target Milestone: 3.0.4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description David Newcomb CLA 2009-01-05 05:22:11 EST
Build ID: M20080911-1700

Steps To Reproduce:
1. Create a Dynamic Web Project that calls into another Eclipse project.
2. Create Tomcat server.
3. Deploy Dynamic Web Project to server.

class files are only copied from the DWP and not the support project, so class not found errors occur.

Tomcat 6.0

More information:
My exact set-up is documented here:

Configuring Eclipse to use Tomcat and the Spring Framework:
http://www.bigsoft.co.uk/blog/index.php/2008/08/10/configuring-eclipse-tomcat-spring

I wrote another blog on how you set up inter-project dependencies:

Adding multiple Eclipse projects to Tomcat's classpath:
http://www.bigsoft.co.uk/blog/index.php/2008/11/12/adding-multiple-eclipse-projects-to-tomc

but it doesn't work. Everything works except the class/ project files are not copied from the secondary (non web dynamic) project.

If you do copy of the class/project files by hand it seems to work.
The current work around we are using is to compile the secondary project as a JAR on drop in the primary projects WEB-INF/lib project, but unfortunately this causes the dynamic project to do a rebuild all (because one of its libraries has changed).

Just as a cheeky extra question:
I heard through the grape vine that there was a way to get Eclipse (or Tomcat) to use the class files in the normal bin/classes folder rather than copying them to a deployment folder and running Tomcat on top of that. Is there any truth to this?
Comment 1 Tim deBoer CLA 2009-01-05 09:09:52 EST
David - I suspect the problem is that you haven't added the dependency from the Web module to the utility projects correctly. On the Web project, go to Properties and then Java EE Module Dependencies and make sure that the utility project is selected. This is how the server knows that the utility module is meant to be packaged up as a web library at runtime (and is not a build-time only dependency or one that you're putting on the server's global classpath).
Comment 2 David Newcomb CLA 2009-01-06 06:16:34 EST
There are several places where you can add dependencies. The primary (web) project has a project reference to the secondary, but the secondary doesn't have a reference to the primary (which is fine).

I selected my primary project (sitemanager) and went to the "Java EE Module Dependencies" and added the secondary project (dino_common). Eclipse asks to check out sitemanager\.settings\org.eclipse.wst.common.component and everything appears to work. However if you go back into "Java EE Module Dependencies" the secondary project is unchecked and the file sitemanager\.settings\org.eclipse.wst.common.component is unchanged.

After _a lot_ of fiddling I can not get the second project to stay checked.

I figure that the org.eclipse.wst.common.component file holds all the goodies and it currently contains:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="sitemanager">
        <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
        <property name="java-output-path"/>
        <property name="context-root" value="sitemanager"/>
    </wb-module>
</project-modules>

I really need a work-around otherwise it is back to exporting to jars :(
Comment 3 Tim deBoer CLA 2009-01-06 09:08:10 EST
Ok, agree it should stay set, and that appears to be the problem here. Transferring bug over to the Java EE team, which owns this property page.
Comment 4 Carl Anderson CLA 2009-01-07 13:40:48 EST
Kaloyan - I remember a similar problem being handled/discussed at the shutdown of 3.0.3... isn't this a duplicate of a bug SAP owns?
Comment 5 Kaloyan Raev CLA 2009-01-15 11:28:06 EST
David, which version of WTP do you use?
I cannot reproduce your problem (I refer to comment #2) neither with WTP 3.0.2 (Ganymede SR1), nor with WTP 3.0.3. 
Comment 6 David Newcomb CLA 2009-01-16 05:46:57 EST
I am using:

Vanilla Ganymede SR1
Version: 3.4.1
Build id: M20080911-1700

With plugins:
Spring IDE (SpringFramework)
eclipse-ccase (Clearcase source controller)

My project is on a clearcase drive (windows).
Comment 7 Kaloyan Raev CLA 2009-01-16 05:56:39 EST
So, you use WTP 3.0.2. But I was not able to reproduce what is described in comment #2. I created a web project with the same structure and a java project. The Java EE Dependencies page works fine and the .settings\org.eclipse.wst.common.component updates correctly. 

Do I understand correctly that the problem is described in comment #2?

Could you attach an example workspace where the problem can be reproduced?
Comment 8 Kaloyan Raev CLA 2009-02-02 06:58:55 EST
I close this bug, because I cannot reproduce the problem and there is no answer by the reporter for two weeks. 
Comment 9 David Newcomb CLA 2009-02-02 09:14:39 EST
We have been testing here, and have uncovered some other facts.
Our workspace (.class/.project/.metadata) is on a clearcase drive (under windows) and we have found that Eclipse isn't checking-out the .metadata/ files before making changes.
In some cases, Eclipse will silently fail to write the read-only checked-in file. If you checkout the file by hand Eclipse does write in them.

So I think that our installations have become corrupted and are in an inconsistent state.

We have been in the middle of a big deadline, hence no reply.
I will reopen when I have something you can play with.
Comment 10 David Newcomb CLA 2009-02-12 04:47:01 EST
I have updated everything and I tried again with a new workspace and managed to get it to work.
I think the only thing I did differently was to add Spring nature last. Apart from that I think it was all the same.

I think this issue may be related to bug 249044.
Comment 11 Kaloyan Raev CLA 2009-02-18 10:04:53 EST
Closing.