apiman.war deploy failed. Unable to instantiate ExceptionMapper
See original GitHub issueAfter the merge of #811 from @volkflo, I’m facing this error after build with
mvn clean install -Pinstall-all-wildfly10
Am I doing anything wrong?
15:35:59,919 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "apiman.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./apiman" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./apiman: java.lang.RuntimeException: RESTEASY003925: Unable to instantiate ExceptionMapper
Caused by: java.lang.RuntimeException: RESTEASY003925: Unable to instantiate ExceptionMapper
Caused by: org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318: Cannot resolve an ambiguous dependency between:
- Managed Bean [class io.apiman.manager.api.rest.exceptions.mappers.RestExceptionMapper] with qualifiers [@Any @Default],
- Managed Bean [class io.apiman.manager.api.rest.exceptions.mappers.RestExceptionMapper] with qualifiers [@Any @Default]"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./apiman"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
API war deployment is failing - SmartBear Community
We build war file for some APIs defined in XML file and deploy it and run it. No issues with older versions of...
Read more >[Apiman-user] How to set apiman logging ...
You have modified "apiman-gateway.logger-factory" to have the ... <JBOSS_HOME>/standalone/deployment/apiman-gateway-api.war/WEB-INF/lib/ ...
Read more >Javaee With Wildfly: Rest Resource Not Found - Why - ADocLib
Wildfly Thorntail fails to deploy due to Operation timed out awaiting service Make optional in the sense that deployment does not fail Missing...
Read more >Recently Active 'wildfly-8' Questions - Page 12 - Stack Overflow
I am deploying my JPA project to wildfly 8.2 server. its giving me exception Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/ext/ExceptionMapper Can ...
Read more >Java Examples for javax.ws.rs.core.Application - Javatips.net
private void deploy(final String contextRoot, final Class<?> ... WAR, deploymentUnit)) { return; } final DeploymentUnit parent = deploymentUnit.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, I think I understand this now. Thank you for the detailed explanation. 😃 It is good to know this if there are changes in the future.
The reason is that in Tomcat we’re not using classpath scanning to discover the JAX-RS classes (resource classes and exception mappers). Instead, the JAX-RS application is configured using a JAX-RS
Application
class. And in that class is where we list out all of the classes needed by our JAX-RS app. TheRestExceptionMapper
class is one of the classes included in that collection. Even though there are two of them on the classpath, it doesn’t matter which one is actually used (they are the same). Including a duplicate class on the classpath is obviously still not something you’d want to do…and it could get you in trouble potentially. But in this case that class is only loaded once here: https://github.com/apiman/apiman/blob/master/manager/api/war/tomcat8/src/main/java/io/apiman/manager/api/war/tomcat8/Tomcat8ApiManagerApplication.java#L65But when running in e.g. WildFly, we use an empty
Application
class and just let classpath scanning do its thing to find all of the relevant JAX-RS classes: https://github.com/apiman/apiman/blob/master/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/ApiManagerApplication.javaSo in that context, having a duplicate class on the classpath is problematic because classpath scanning will find them both and realize they do the same thing…and then will fail because it doesn’t know which one to use. Note that I believe it would also fail if you had two exception mappers with different names but that handled the same exception class.