问题
I'm not able to run a Java EE 7 webapp on tomcat 7 while in Eclipse using the same tomcat server it works. I can find my tomcat 7 server if I change the following in my pom.xml:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
If i change it to 6.0 it works fine in Netbeans but the problem is I'm using Jersey for my Rest API and at client side I use:
new Gson().fromJson(resp.readEntity(String.class), User.class);
But it doesn't know the method readEntity anymore and I only have the option using the getEntity method but I can't get it to work and I refuse to change all my code...
It's working in Eclipse and not complaining... Netbeans fault I think Ok weird thing is Tomcat 7 doesn't support Java EE 7. How come this is working in Eclipse with no problems?
回答1:
Nevermind, it's Jersey fault. I changed to java--ee 6 version in pom and some dependencies fixes with Jersey.
来源:https://stackoverflow.com/questions/22578570/running-java-ee-7-on-tomcat-7-in-netbeans