I have a problem similar to my previous one. I have a webapp that runs fine in JBoss EAP 6.4. I want to add some functionality to my webapp so that it can manipulate a hive-metastore. I add a single dependency to my pom.xml:
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>3.1.2</version>
</dependency>
If I now try to start my webapp, it fails at start up:
15:07:37,718 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."myapp-0.0.1-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myapp-0.0.1-SNAPSHOT.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "myapp-0.0.1-SNAPSHOT.war" ... Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.servlet.WebAppResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig org.glassfish.jersey.server.ResourceConfig$WrappingResourceConfig org.glassfish.jersey.server.ResourceConfig org.glassfish.jersey.server.ResourceConfig$RuntimeConfig com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.mycompany.RestApplication com.sun.jersey.api.core.ApplicationAdapter com.sun.jersey.api.core.ClasspathResourceConfig
The message "JBAS011232: Only one JAX-RS Application Class allowed" seems to be caused by my webapp trying to use both RestEasy (v. 2.3.10.Final-redhat-1) and Jersey. JBoss uses RestEasy by default. Apparently, hive-jdbc must directly or indirectly have a Jersey application class.
I would like to eliminate this problem by indicating that I don't want to use a Jersey-based application class. What strategy can I employ to discover where that Jersey-based class exists? If I generate the dependency tree with mvn,
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:tree -Dverbose=true
hive-jdbc has nearly 800 lines of dependencies. There must be a better strategy than looking through the source code of all of the dependencies. Or, is there somehow a way to tell JBoss to ignore Jersey application classes?
BTW, unlike my previous question, hadoop-common doesn't seem to be the culprit. When I look at the occurrences of "hadoop-common" in the dependency tree, I see the following:
My current strategy goes like this:
Repeat
add exclusion to likely looking package in pom file
start JBoss and examine console log
if console log has no JBAS01132 error then
if console log has no startup failure due to NoClassDefFound error then
Done!
else remove exclusion
until Done
I can't get to "done". At this point, I seem to be stuck on the jersey-server package. Without it being present, we get the NoClassDefFound error. With it, we get JBAS011232: Only one JAX-RS Application Class allowed.
