I want to use Jersey MVC in my project. I've never used Jersey MVC before.
I'm working in:
, using:
Jersey 2.25.1
Apache Tomcat 7.0.76.
Here's the example I'm trying to run:
Hello.java
MyApp.java
NewFile.jsp
I have downloaded jersey 2.25.1 from here
and added all jar files in
Here's how I call my web service:
The underlined import line tells:
So this is the problem I want to solve.
Because I have not found any information related to this problem I searched for jersey mvc related jar file. I found it here.
I added jersey-mvc-2.25.1.jar in lib folder.
So the package (and Viewable class) was found.
But when I run on server I get the following stack trace:
Thank you in advance.
Here's how I solved the problem:
First of all, jersey-mvc-2.25.1.jar is not enough to use MVC Jersey.
I downloaded the file jersey-mvc-jsp-2.25.jar.
I put both jars in lib
Now here's my working basic example:
The structure of my project is:
The source code is:
MyApp.java
NewFile.jsp
To see the result I started the Tomcat server, then:
It worked!
Related to classpath/buildpath setting in Eclipse:
I didn't Add Jars (jersey-mvc-2.5.1.jar and jersey-mvc-2.5.1.jar) in classpath or buildpath. It worked anyway.
What really helped to understand all this is: