Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312897 - Deployment feature doesn't deploy classpath dependencies.
Summary: Deployment feature doesn't deploy classpath dependencies.
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 minor with 1 vote (vote)
Target Milestone: 3.2.3   Edit
Assignee: Rob Stryker CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-14 08:17 EDT by Jose Guerra CLA
Modified: 2011-08-12 03:59 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jose Guerra CLA 2010-05-14 08:17:56 EDT
Build Identifier: 20100218-1602

Some weird problem with the dependencies happens when you try to deploy a dynamic web project into eclipse.

In my case I have eclipse 3.5.2 set up with Tomcat 6.0.x and Java 1.6.x.

The problem happens when you try to deploy a Web Dynamic project with external jars as  dependencies on the classpath. The jars don't are being copied into WEB-INF/lib Tomcat directory to satisfy the dependencies at run time for Tomcat.

Ps, don't hesitate to contact me if you require more info.

Reproducible: Always

Steps to Reproduce:
1. Create a Dynamic Web Project with eclipse 3.5 and Tomcat 6 as a server.
2. Add to the classpath a jar file as a project dependency.
3. Select project properties -> Java EE Module Dependencies and tick the jar file to be copied into the WEB-INF/lib folder at deployment time.
4. Run the Web project and the project will fail because the dependency is not present at run time.


WORKAROUND:
Copy the jar file into the project WEB-INF/lib directory straight away instead. At deployment time the dependency is satisfied and the project is executed successfully. The jar now shows up under the Project/Libraries/Apache Tomcat v6.0 folder.
Comment 1 Carl Anderson CLA 2010-05-24 16:08:49 EDT
Jose, Eclipse 3.5.2 corresponds to WTP 3.1.2.  Since the WTP 3.1.x development stream is shut down (and WTP 3.2 is shutting down), I am targetting this at 3.2.1.

Assigning to Rob for initial investigation.
Comment 2 Larry Isaacs CLA 2010-05-25 09:17:33 EDT
Hi Jose,

Please be aware that the scenaio you provide works fine for a large number of users, including myself.  The behavior you are seeing is coming from something unique to your situation.  Given that I've never been able to duplicate this problem, it's hard for me to guess what it is that might be unique.  It's not clear if "reproducibly always" means it always happens for a particular project or always happens for all projects.  Does this happen for just one of your projects or many, including new projects?  For now, it might help to attach the ".classpath" and ".settings/org.eclipse.wst.common.component" files from a project exhibits this behavior.

Larry
Comment 3 Calvin Vette CLA 2010-07-03 17:39:46 EDT
This bug has cropped up consistently over the years. It is very re-creatable and not unique to Jose. 

I did a fresh installation of Eclipse-3.5.2 Reporting for MacOS X Cocoa (32-bit).
I created a new Dynamic Web Project.
I modified the build path, creating 2 new User Libraries - 1 for Spring Core 3 and 1 for Spring Security 3 (the specific libraries are irrelevant).
I added both to the build path.
I exported both in the JEE Module Dependencies.
I added in an index.html in the WebContent folder
I modified the web.xml to include a ContextListener and context-param for Spring I added a spring-beans.xml file.
I ran it on the server, creating an Apache Tomcat 6.0.20 local server in the process. 

Tomcat's console dumped a ClassNotFoundError on the ContextListener:
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

I verified in the deployed WEB-INF/lib folder that there were no jars.

No amount of twiddling seems to get it to copy them over. That includes going back to the build path and JEE Module dependencies and reassert them. That include removing the project from the server, republishing/restarting the server, then re-adding the project back on. It continues to fail to copy the dependent libs into WEB-INF/lib

If I removed the project from the server, restart Eclipse, then re-add and restart the project it will usually work.

However, I forgot to add commons-logging, so it gave me a different ClassNotFoundError. I added the new UserLibrary to the project build path, exported it, and checked it in the JEE Module Dependencies. 

I republished and redeployed. The same ClassNotFound for commons-logging.

I verified in the deployed WEB-INF/lib folder that commons-logging jars were not there (but the Spring jars were).

I knew this was not a unique bug - it's been happening consistently. Sometimes it seems to go away in various patches of Eclipse, but it often comes back.

I've had the same bug happen on different versions of JBoss and Tomcat.

I've had the reverse happen when I *remove* a UserLibrary that's a JEE Module dependency that continues to get published anyways. 

I've looked at the org.eclipse.wst.common.component file as well as the .classpath - there's nothing there to indicate that it isn't working properly. It's something it's holding in memory.
Comment 4 Rob Stryker CLA 2010-07-06 00:36:23 EDT
Have you guys tested with a 3.2 build yet? If not, please do. The code was substantially changed between wtp 3.1 and 3.2.
Comment 5 Abel Morelos CLA 2010-08-05 05:29:47 EDT
I patched my current WTP installation with the 3.1 patches available via the WTP Update Site and now my project is working correctly, you may want to try the same.
Comment 6 Jose Guerra CLA 2010-08-07 14:11:44 EDT
It looks to me that another feature could be broken now, but I am not sure.

Either Tomcat or glassfish JEE projects don't work the classpath option under the Run Configuration window.
Currently my Tomcat/Glassfish projects have a directory WEB-INF/config. This directory keeps the log4j.properties file. I added the directory to the classpath following Run -> Run Configuration -> Classpath -> Advanced -> add Folders. 
Now on either project, log4j has left to work. The message ...

log4j:WARN No appenders could be found for logger (tng.iac.tracking.vme.service.ws.VMEMasterService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

is on and on.

This is happening to me after the update. Maybe I messed up something on my projects, but I don't certainly know what's happening now.
Comment 7 Jose Guerra CLA 2010-08-07 14:49:18 EDT
Big pardon guys!
The problem I described before related to the classpath, it's happening only on Glassfish projects. On Tomcat based projects is OK.

Cheers
Comment 8 Carl Anderson CLA 2010-09-23 14:07:10 EDT
Rob, since 3.2.2 is declaring, I am retargetting to 3.2.3.  Please retarget as appropriate.
Comment 9 Rob Stryker CLA 2011-01-20 15:28:05 EST
As per Jose's comment this seems fixed...

If this isn't fixed or is still replicatable, please feel free to re-open =]
Comment 10 fashoom CLA 2011-01-25 06:09:51 EST
This is still broken exactly as reported by Calvin in comment 3 with WTP 3.2.2.

I upgraded from an earlier WTP to 3.2.2 to see if that would fix the problem, but no luck. 

As reported, jars added to the project via Properties - Java Build Path - Libraries are never copied to the WEB-INF/lib directory, resulting (with a Spring project) in Tomcat throwing 
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

I can also confirm as reported that this bug has been hanging around for years. I have verified that neither jars added directly nor jars in user libraries get copied.
Comment 11 Rob Stryker CLA 2011-08-12 03:59:53 EDT
It could be this is related to:  https://bugs.eclipse.org/bugs/show_bug.cgi?id=354346