Search code examples
javarestjboss

Jboss error: Only one JAX-RS Application Class allowed


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?


Solution

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