Running Java EE 7 on Tomcat 7 in Netbeans

青春壹個敷衍的年華 提交于 2019-12-11 21:36:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!