(This post has been significantly edited now that I've produced a proper test case and had a stupid mistake pointed out to me. Old text is struck so that responses seen below still make sense.)
I'm increasingly stumped with the problems I'm having getting my app running on JBoss AS 6. It deploys & works perfectly on Glassfish 3.1's OSGi runtime, but for the life of me I can't seem to make it do so on JBoss AS 6.
The main problem is that I need Jersey 1.5. JBoss bundles an older version RESTEasy instead. In Glassfish I just include Jersey 1.5 in my war's lib/ and Glassfish uses it by preference. On JBoss, this seems to cause a variety of exciting failures because of the jaxb-impl and stax jars that Jersey pulls in by default.
A more minimalist test case ( https://github.com/ringerc/scrapcode/tree/master/testcases/javaee/jbossas6-jersey15-testcase ) that only tries to deploy jersey-server to jboss, with nothing but a web.xml and my pom.xml, fails with:
18:35:07,569 ERROR [AbstractKernelController] Error installing to PreReal: name=vfs:///C:/jboss-6.0.0.Final/server/default/deploy/jbossjerseydemo.war state=PostClassLoader mode=Manual requiredState=PreReal: org.jboss.deployers.spi.DeploymentException: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.WebAppResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.api.core.ApplicationAdapter com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig at org.jboss.resteasy.integration.deployers.ResteasyScannerDeployer.scan(ResteasyScannerDeployer.java:175) [:6.0.0.Final]
... so it looks like there's a conflict between RESTEasy and Jersey. Is there anything I can put in my deployment descriptor (jboss-web.xml) to turn off RESTEasy for my app and tell JBoss that I have my own Jersey I want to use instead?
I found this post:
.. which suggests that it's possible to remove RESTEasy from JBoss, but I can't really expect anybody using JBoss to do that. They're more likely to deploy Glassfish in parallel or deploy my app standalone under the embedded glassfish runtime.
Additionally, JBoss AS 6 doesn't seem to like Jersey 1.5, complaining that com.sun.jersey.server.impl.cdi.CDIExtension is not serializable (http://pastebin.com/D4GxiBRX).
I really don't know where to go from here. It "just works" on Glassfish and I've been fighting to get it going for half a day on JBoss. I realise now that that's because JBoss ships a different JAX-RS provider, but I'm still not sure quite where to go from here.
My full apps' current POM is here, though I'd recommend the simpler test case linked to above instead: https://github.com/ringerc/postupload/blob/master/pom.xml
... and the full code for the project is here: https://github.com/ringerc/postupload/
I think right now I'm going to get it running on the embedded glassfish container and/or tomcat or jetty. Standalone deployment is more important anyway, but I wanted to support JBoss as a "nice to have". Ideas on how that might be possible while retaining the use of Jersey 1.5?