1

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?

caiosm1005
  • 1,686
  • 1
  • 19
  • 31
pawkondr
  • 117
  • 1
  • 3
  • 16
  • Did you include Jersey jars? It looks like the error is pointing to some Jersey classes. With JBoss you should be using the included RESTeasy – Paul Samsotha Sep 15 '15 at 13:16
  • Yes, I have included jersey jars, should I delete them? How to tell netbeans that i want to use jboss jars? – pawkondr Sep 15 '15 at 13:27
  • Not really sure. But JBoss already has it's own JAX-RS implementation which is RESTeasy. I would just get rid of all the jars and just add [javaee-api](http://mvnrepository.com/artifact/javax/javaee-api/6.0). This will give you everything you need to compile. The server will have all the implementation jars. The only thing is you will need to stick strictly to the JAX-RS standard classes and configurations. It's likely that whatever confiugrations you currently have with jersey will not work. You will need to confgure it with standard JAX-RS configurations – Paul Samsotha Sep 15 '15 at 13:49
  • You can look at the [RESTEasy documentation](http://docs.jboss.org/resteasy/docs/2.2.1.GA/userguide/html/index.html) for some help – Paul Samsotha Sep 15 '15 at 13:51

5 Answers5

5

Remove this:

<extension module=”org.jboss.as.jaxrs”/>
<subsystem xmlns=”urn:jboss:domain:jaxrs:1.0″/>

from: standalone.xml

Mayur
  • 61
  • 1
  • 3
1

For somebody with the same problem in the future: I deleted all jersey jars and the error is gone.

pawkondr
  • 117
  • 1
  • 3
  • 16
0

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.

0

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.

Mr.Q
  • 4,316
  • 3
  • 43
  • 40
0

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>