问题
I have problem with my web applicaion based on Jboss server 6.1. When i try do deploy it on server it throws an error:
Deployment "vfs:///E:/Instalki/jboss/jboss-as-distribution-6.1.0.Final/jboss-6.1.0.Final/server/default/deploy/WholesaleApp.war" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: Only one JAX-RS Application Class allowed. org.glassfish.jersey.server.ResourceConfig org.glassfish.jersey.server.ResourceConfig$WrappingResourceConfig org.glassfish.jersey.server.ResourceConfig$RuntimeConfig
It happens when i try to add simple REST service to my app. Here is code of this class:
@Path("/wholesale")
@Stateless
public class WholesaleREST implements WholesaleInterface{
@EJB
WholesaleEJB bean;
@Override
@GET
@Path("/get")
public String getCars() {
List<Clients> listOfClients = bean.getClients();
StringWriter sw = new StringWriter();
ClientsContainer container = new ClientsContainer(listOfClients);
JAXB.marshal(container, sw);
return sw.toString();
}
}
I have no idea why this happens, is it something wrong with server or with my class or with netbeans? I looked for this problem in the internet and they advised to change web.xml (i don't have such file i have jboss-web.xml) or to modify files and delete some lines in server configuration files which i also dont have. I have to do a project for my university which contains database, sesson bean, rest service and client application with swing. Its so frustrating when I have to fight with server, not the code itself. Please help me, I really don't know what to do.
edit. Nobody knows?
回答1:
Remove this:
<extension module=”org.jboss.as.jaxrs”/>
<subsystem xmlns=”urn:jboss:domain:jaxrs:1.0″/>
from: standalone.xml
回答2:
For somebody with the same problem in the future: I deleted all jersey jars and the error is gone.
回答3:
I got the same issue and got resolved by removing the duplicate jersey jars. Be Aware of Various Jersey Jars like Client, Bundle, Core, JSON, Server...
All looks different but they cause issue.
回答4:
This error happens because REST libraries included in the war file (as dependencies) collide with the default REST implementation in your container (JBOSS) link here. you have two options to solve this:
one is to disable the default REST implementation in JBOSS (in standalone.xml)
The other is to remove any REST implementation dependency (.jar file) in your project.
回答5:
As mentioned here.
You can try to add next lines to the web.xml file
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.providers</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.resources</param-name>
<param-value>false</param-value>
</context-param>
来源:https://stackoverflow.com/questions/32575408/jboss-error-only-one-jax-rs-application-class-allowed