users@jersey.java.net

[Jersey] Unit Testing with Tomcat

From: Clemons,Cody <Cody.Clemons_at_Cerner.com>
Date: Thu, 8 Sep 2011 14:41:11 -0500

Hi, I'm trying to perform a very simple unit test with Jersey on Tomcat, through Eclipse. I have the RESTful web service working fine, but I'm getting errors when I try to test it. I'm very new to REST and Jersey, so I'm sure it's something I have set wrong (probably in the pom.xml). When trying to run the test through Eclipse, I get the error: java.lang.NoClassDefFoundError: com/sun/grizzly/http/embed/GrizzlyWebServer. And if I run the test through the maven command line (mvn test -Dcontainer.type="External") I get the following error:

1) com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.0.3

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.jersey.jersey-test-framework -D
artifactId=jersey-test-framework-grizzly -Dversion=1.0.3 -Dpackaging=jar -Dfile=
/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:

      mvn deploy:deploy-file -DgroupId=com.sun.jersey.jersey-test-framework -Dar
tifactId=jersey-test-framework-grizzly -Dversion=1.0.3 -Dpackaging=jar -Dfile=/p
ath/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) com.sun.jersey.samples:helloworld:jar:1.0.3
        2) com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:ja
r:1.0.3

2) com.sun.jersey.test.framework:jersey-test-framework-external:jar:1.0.3

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.jersey.test.framework -Dartifac
tId=jersey-test-framework-external -Dversion=1.0.3 -Dpackaging=jar -Dfile=/path/
to/file

  Alternatively, if you host your own repository you can deploy the file there:

      mvn deploy:deploy-file -DgroupId=com.sun.jersey.test.framework -DartifactI
d=jersey-test-framework-external -Dversion=1.0.3 -Dpackaging=jar -Dfile=/path/to
/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) com.sun.jersey.samples:helloworld:jar:1.0.3
        2) com.sun.jersey.test.framework:jersey-test-framework-external:jar:1.0.
3

----------
2 required artifacts are missing.

for artifact:
  com.sun.jersey.samples:helloworld:jar:1.0.3

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  maven2-repository.dev.java.net (http://download.java.net/maven/2/),
  maven-repository.dev.java.net (http://download.java.net/maven/1)

I believe I have all the necessary JARs in "WebContent\WEB-INF\lib". Let me know if you want any of my files. Thank you for your time.

Cody Clemons
Software Engineer, Patient Accounting
cody.clemons_at_cerner.com | 816-201-7311
http://www.cerner.com
[http://www.cerner.com/uploadedImages/email_logo.png]



----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.