Eclipse stopped deploying any of the project's [maven] dependencies to tomcat
I'm having this problem for a while now. I tried so many things that failed that I had to switch to netbeans in order to be able to develop. But netbeans lacks some important features, so I really need this to work in eclipse.
From scratch: I have a "parent" maven project with several modules in our svn repo. 2 of the modules are web projects that I need to deploy in a tomcat server. These web projects have several dependencies, among them are the other modules of the parent maven project.
I had this configuration running with eclipse ganymede, but 3 weeks ago I started to get ClassNotFoundException
s while starting the server, I have no clue why this started happening.
Since then I've tried to get new Eclipse (Java EE) packages, but no matter how I do it, this is what happens:
- I get eclipse with maven+svn running and add my tomcat installation to eclipse's server list.
- I check out the parent project, this includes the modules. Eclipse gives me a whole list of projects.
- The crap starts: I cannot add the 2 web projects to the tomcat, it tells me no projects can be added (meaning "you dont have any web projects!"). Also, I cannot choose "Run as -> Run on Server" on Servlet classes ("Selection did not contain any resources that can run on a server"), even though they clearly extend HttpServlet. Since I spent way too many hours into this, I found out how to deal with this: Convert the project into a "Faceted Project" in the project's properties.
- Now I can add both projects to the tomcat server
When starting the server, i get
FATAL: Error loading WebappClassLoader context: /BEWeb delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@55ae3b4d de.comp.utils.servlet.SInvokerServlet
This class is in one of the modules that are listed as a dependency
WEB-INF/lib
of the deployed project ist empty. No libs at all, maven and/or eclipse doesn't do what it did 3 weeks ago.
I tried messing around with the eclipse files in .settings
and also with .project
and .classpath
, but nothing useful turned out.
Can someone point me in the right direction? I'll do everything from scratch if you need me to, it would not make a difference as I did this a lot of times already (with different versions of eclipse, maven, tomcat, ...)
If you need me to post any files, I'll be happy to comply.
Since this kept me awake at nights for quite some time now, I'll put a bounty on this one. thx so far.
================================
EDIT in order to answer the upcoming questions
Just to check: building your projects from the command line and deploying them by hand does work, right?
Yes, mvn package
works fine, copying that .war file to tomcat results in a working application, also the war file contains all dependencies.
When you say "get new Eclipse (Java EE) packages", do you mean you are now using Eclipse Indigo (3.7)?
Yes. But I had the same problems with 3.5, the eclipse versions didn't show any difference in their behavior.
When you say "I get eclipse with maven+svn running", are you using m2eclipse or have you generated eclipse configuration using maven eclipse plugin?
I have m2e installed and checked out the projects from svn using "Right click -> Checkout as Maven Project". There are no eclipse-specific files in the repository though, it seems they are being generated upon checkout.
When I use mvn eclipse:eclipse
, then close+reopen the projects, I cannot add them to the tomcat server ("There are no resources that can be added or removed from the server"), meaning that eclipse does not recognize them as web projects.
First of all: do not use the maven-eclipse-plugin together with m2e/m2eclipse, the two are not compatible. m2e should be able to import your Maven projects and set them up as Eclipse expects.
Did you install the WTP add-on for m2e? This blog post may be worth reading. If any of your pom.xml files invokes any specific plugin (e.g. for code generation) you may need a corresponding m2e add-on. This wiki post may give you an idea of why.
Another attempt you might consider is setting up a Helios based environment. Check that all the plugins you might need are still available, though.
精彩评论