I received an email asking how I deployed Jersey 2 on JBoss 7 (specifically 7.1.1) while still being able to
access Jersey resources (see my Stackoverflow post here).
The solution that worked for me was to add a jboss-deployment-structure.xml in my
app’s WEB-INF directory and manually register Jersey resources rather than rely on automatic package scanning:
Here’s the jboss-deployment-structure.xml:
Here’s a simplified web.xml:
Here’s an implementation of the javax.ws.rs.Application / ResourceConfig
referenced in the web.xml above, where each Jersey resource needs to be manually registered (there’s probably a way
to make this work automatically, but as shown below the automatic package scanning wasn’t working in JBoss…):
Lastly, here’s the Jersey library I used in my Maven pom.xml: