Reputation: 3142
I am really stuck up at a major situation. I have a class in the maven dependancy and also can be referenced from within the class but on running the server displays ClassNotFoundException.
Thanks in advance
update:
Environment:-
I created a maven project in eclipse and converted it to a dynamic web project in facet changes - and added the following in the pom.xml and also gave the mvn eclipse:eclipse -Dwtpversion=2.0
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
This has downloaded the available jars containing the class com.sun.jersey.spi.container.servlet.ServletContainer
But on running the server - java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
Upvotes: 1
Views: 7138
Reputation: 939
First I would suggest you use the latest version of Eclipse (now its 4.3 Kepler) as it has m2e plugin built in and has much much better support for Maven. You're no longer have to add Maven Dependency to your project classpath manually.
Try creating a new Maven Project from within Eclipse, then choose maven-archetype-webapp as the archetype. Eclipse will set up everything for you including classpath for Maven depdencies.
Whenever you modify a POM.xml, make sure your classpath are updated, though most of the cases this is done automatically by the m2e plugin. Look at the Markers tab at the lower part of your Eclipse to see if you have such problems, if you see something like "Maven Problem, project configurations are not up to date", right click on your project and Choose Maven->Update Projects.
Upvotes: 1
Reputation: 1976
First, make sure you've added the right dependencies:
I think you also need the "jersey-servlet" artifact
Then, make sure you add Maven dependencies to your Java build path?
If not, try the following:
Upvotes: 0