This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes Deploying a Jersey REST Web Service to Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Deploying a Jersey REST Web Service to Tomcat" Watch "Deploying a Jersey REST Web Service to Tomcat" New topic
Author

Deploying a Jersey REST Web Service to Tomcat

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1064
Hello,

I'm wondering how you deploy a REST web service to Tomcat.

The code Intellij creates for the "helloworld" service has a "main" method for testing. That works fine, but when I try to add Tomcat into the mix as a separate deployment, it doesn't work at all. I'm clearly doing something wrong and am confused about deploying REST web services under Tomcat.

I'm not sure what's special about port 9998 used in the sample code or if that port was just chosen at (sort-of) random.

Would appreciate any tips on getting the Jersey "HelloWorld" app to run by itself under Tomcat. Doesn't appear to be your typical "Web app" from a deployment perspective.

Thanks,

-mike
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61086
    
  66

(Me again.) It should be. There's no reason for it not to be a typical JEE web app.

Personally, I use IntelliJ as an editor on steroids, but run a standalone Tomcat instance.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Indeed, Jersey can be deployed as part of any web app. The Jersey docs unfortunately complicate matters needlessly by wanting to use Maven, and by setting up some test harness outside of a servlet container. A quick search for "example jersey web app" found http://www.ibm.com/developerworks/web/library/wa-aj-tomcat/, which looks like a good starting point. It talks about Jersey 1.0, but you should be able to substitute a current 1.1 version w/o problems.


Ping & DNS - my free Android networking tools app
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1064
Bear Bibeault wrote:(Me again.) It should be. There's no reason for it not to be a typical JEE web app.

Personally, I use IntelliJ as an editor on steroids, but run a standalone Tomcat instance.


Yeah, I'm trying to use Intellij also. I love Intellij once the project is set up -- as an editor that really "knows my code" and does excellent refactoring, etc.. Best editor available, IMHO.

-mike

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deploying a Jersey REST Web Service to Tomcat