Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Restful Web Service runs in Shell but not Eclipse Juno

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am using Eclipse Juno, Jersey, Maven 2.2.1, tomcat 7, and m2eclipse plug-in.

Am able to create a war file for my Web Service using both m2eclipse and maven using the command line.

Afterwards, I have a shell script which deploys the war file from my $ProjectDir/target to $CATALINA_HOME/webapps

When I start up tomcat from the command line, everything runs well in catalina.out (console output).

However, when I run tomcat using Eclipse, it gives me this error:



My web.xml file looks like this:



Inside my particular web app's WEB-INF/lib dir, I have the following files (automatically packaged by maven install):

asm-3.1.jar
jersey-core-1.15.jar
jersey-server-1.15.jar

Why do I not receive this stack trace when running tomcat from the command line but I do receive it in Eclipse?

Thank you for taking the time to read this...
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look inside the file /home/dev01/DevTools/apache-tomcat-7.0.32/webapps/RESTfulExample.war and make sure that the jersey libraries are there also. I suspect that Eclipse didn't package them...
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

James Dekker wrote:Hello, I am using Eclipse Juno, Jersey, Maven 2.2.1, tomcat 7, and m2eclipse plug-in.

Am able to create a war file for my Web Service using both m2eclipse and maven using the command line.

Afterwards, I have a shell script which deploys the war file from my $ProjectDir/target to $CATALINA_HOME/webapps

When I start up tomcat from the command line, everything runs well in catalina.out (console output).

However, when I run tomcat using Eclipse, it gives me this error:



My web.xml file looks like this:



Inside my particular web app's WEB-INF/lib dir, I have the following files (automatically packaged by maven install):

asm-3.1.jar
jersey-core-1.15.jar
jersey-server-1.15.jar

Why do I not receive this stack trace when running tomcat from the command line but I do receive it in Eclipse?

Thank you for taking the time to read this...



Hi All,

We get this error because of build path issue. You should add "Server Runtime" libraries in Build Path.

"java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer"

Please follow below steps to resolve class not found exception.

Right click on project --> Build Path --> Java Build Path --> Add Library --> Server Runtime --> Apache Tomcat v7.0

Thanks,
Sachin G N
 
Normally trees don't drive trucks. Does this tiny ad have a license?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic