在Netbeans的Tomcat 7上运行Java EE 7 [英] Running Java EE 7 on Tomcat 7 in Netbeans
问题描述
在Eclipse中,使用相同的tomcat服务器,我无法在tomcat 7上运行Java EE 7 webapp.如果我在pom.xml中更改以下内容,则可以找到我的tomcat 7服务器:
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>
如果我将其更改为6.0,则可以在Netbeans中正常工作,但是问题是我正在使用Jersey作为我的Rest API,并且在客户端使用了:
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);
但是它不知道方法readEntity了,我只能使用getEntity方法,但是我无法使其工作,并且我拒绝更改我的所有代码...
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...
它正在Eclipse中运行并且没有抱怨...我认为是Netbeans错误 好的,奇怪的是Tomcat 7不支持Java EE7.为什么它在Eclipse中正常工作呢?
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?
推荐答案
没关系,这是泽西岛的错误.我在pom中更改为Java--ee 6版本,并使用Jersey修复了一些依赖项.
Nevermind, it's Jersey fault. I changed to java--ee 6 version in pom and some dependencies fixes with Jersey.
这篇关于在Netbeans的Tomcat 7上运行Java EE 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!