How to set up Jersey 2.0 Web Services on IntelliJ IDE using Tomcat 7, with complete Maven support?
I have had quite a bit of trouble to put everything together to make it work. To hopefully save some time to people in the same situation, I have made a small guide.
I have taken the time to set up an IntelliJ 13.0 project for a web service using Jersey 2.0 and Tomcat 7, complete with Maven support.
Finally I managed to figure out the complete configuration and it works, so I have decided to give back to the stackoverflow community.
Here is a working template project on GitHub (you should only need to clone it and change the path of your Tomcat 7 installation).
Here are the relevant configuration screens that you can use to set up your Tomcat Home directory:
After cloning the project, go into run configurations.
Then change the tomcat home (here I used HomeBrew on the Mac)
I was getting a 404 error when accessing any of the WS's, I discovered I had to add all the Jersey and Glassfish JAR's to the lib directory under WEB-INF. Just create a lib folder and drag-and-drop all libs.
Fist of all, please make sure that you are using Ultimate Edition of IntelliJ Idea. Unfortunately, community edition does not support J2EE.
Second, here are the best instructions I found. It saved my day:
https://medium.com/#jamsesso/starting-out-with-jersey-apache-tomcat-using-intellij-6338d93ffd40
Related
i have tomcat project the directory structure is
previously i was using tomcat server, whenever i modified .java files i used to build the project and restarted the server in eclipse through plugin than the changes would have taken effect.
Now in my company they changed from tomcat to weblogic since i am new to it, i used to build war file every time and deploy manually to check the changes.
Can any one tell me how to do hot deployment in web logic. i googled it but it says i need to change project type to dynamic project, that i cant do since it already in development.
is their better way just make changes to java file build and no need to restart the server through eclipse in weblogic 12c.
Eclipse IDE luna
weblogic 12c server
project type : tomcat project structure
I think how you doing that is a little old fashioned. With eclipse luna, tomcat 5.0 - tomcat 8.0 is well supported. And take some effort to turn your project into a 'Dynamic Web Project', in that way you will benifit a lot from the experience of other people.
For hot redeploying, you can try JRebel, it reload your changed java class without reloading the whole applcaition.But it's a commercial software, and I don't know a good and free alternative yet.
Sorry if this is the wrong kind of question but currently I have an Apache server which is configured for Pyjamas. All I used to have to do was: pyjsbuild example.py and the GUI would appear in my browser.
I decided to switch to Java, so I picked Vaadin as my framework. How do I do the equivalent for Vaadin? All I want to do is compile the java and have Apache recognise it.
I'm using linux and I'm very new to building web applications, previously I only ever built the GUI side of things, I never had to touch the server.
You need Apache Tomcat to serve java pages. Install it separatly or see http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html for information on how to hook them together.
Vaadin projects work just as any web project. You have to crate a WAR file.
For example, if you are using Eclipse, right-click on the project, choose "Export..." and under "Web" choose "WAR file".
If you are using Netbeans or something else, google "create war in netbeans/intellij/..." to find out how to do this step.
This will generate a file with the extension .war, which you will have to copy in the "webbaps" folder of your Tomcat installation. Restart Tomcat and the application will be automatically deployed.
If you do not have access to the webapps folder, go to Tocatmcat's "Manager App" in the browser and
under the section "Fichier WAR à déployer"(WAR file to depploy) choose the generated file and click Deploy.
To start with, make sure that go through Getting Started chapter in Book of Vaadin. In this chapter you will find overview of the required toolchain and step-by-step installation instructions. Your Linux distribution might have more documentation about installing JDK (For example, see Ubuntu wiki for Oracle JDK installation).
It will be convenient for you to connect Tomcat to Eclipse IDE. This makes starting Tomcat and updating your application easy. For example, see this [blog] for some videos about connecting Eclipse to Tomcat.
Please note that using Eclipse is just one approach and later you might want to see if IntelliJ IDEA or command line works better for you.
I don't know if some one asked this but I have a problem that I am working on this tutorial Hello World Example with annotation driven Spring 3 MVC in Eclipse .Now I am very embarrassed to say that how can I make war file to deploy on tomcat. Please guide me in this regard. Thank you
P.S: Just to inform you that I have Tomcat 6.0 and eclipse indigo 3.7
You have many options depending on the environment you're using; the more simple ways can be:
for testing purpose you can reference a Tomcat installation inside your Eclipse in the Severs tab of the J2EE perspective and add your Dynamic Web Project to it; then you can control (start/stop/debug) your server from Eclipse
to build a war to deploy, you can right click the Dynamic Web Project and choose Export War File
I would recommend using Apache Maven as it will help you much as you project will get bigger and your will have a lot of dependencies. You can try it as Eclipse plugin (m2eclipse) or use it from command line.
I have a jboss(5.1.0.GA)/seam(2.2.0.GA) app that gives me a lot of work everytime I need to setup a development environment for it.
What I want is to port the build to maven, and have it setup all the development environment for me(including downloading and configuring the AS).
How could I acomplish something like that? Currently the build is managed by eclipse and has a default java ee project structure(projects for ear, ejb and jsf) so a simple example of porting an eclipse java ee project to maven with the above requeriments will suffice.
I found these two posts which can explain how you can use seam-gen and convert it to use maven.
This might be helpful for you.
Post 1 and Post 2
Forgive my ignorance - still learning here.
I am using Eclipse Ganymede (Java 1.5) and have been experimenting with web services - I have mangaged to get a simple web service up and running and the nice wizard you get in Eclipse generates all the necessary bits and pieces e.g. wsdl file etc - and you can test the service and everthing else.
Now it seems to use axis.jar and all other axis related stuff and when I run the web service, everything is good - but how is this even working in Tomcat, if I haven't even installed Axis? I can't find anything in my Apache installation or Ganymede about anything to do with Axis??
You will probably find that when you export the application as a WAR archive for installation into Tomcat that the axis jars are included inside the archive. Check in the WebContent/WEB-INF/lib directory and it is likely they'll be there.
Alternatively, Eclipse could well be doing clever things with deployment and linking to the Axis jars when you run your service in test mode within Eclipse.
In the eclipse ganymede distribution if you chose the "J2EE" version or just add the "Web Tool Platform" plugin you will have the axis jar(s) in something like eclipse/plugins/org.apache.axis_version/lib