I have this error
java.lang.LinkageError: ClassCastException: attempting to tomcat-debug-eclispe/wtpwebapps/xwiki-debug-eclipse/WEB-INF/lib/jsr311-api-1.1.1.jar!/javax/ws/rs/ext/RuntimeDelegate.class to tomcat-debug-eclispe/lib/jboss-jaxrs-api_2.0_spec-1.0.1.Final.jar!/javax/ws/rs/ext/RuntimeDelegate.class
I'm using an open source wiki platform called xwiki
https://github.com/xwiki/xwiki-platform
This platform somewhere include jsr311-api-1.1.1.jar
and need it.
Now I want to connect through an XWiki Extension some keycloak feature and I need this
<!-- https://mvnrepository.com/artifact/org.keycloak/keycloak-admin-client -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>4.3.0.Final</version>
</dependency>
As we can see here keycloak-admin-client need some provided dependencies including :
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<version>1.0.1.Final</version>
<scope>provided</scope>
</dependency>
and so from org.keycloak.admin.client.Keycloak
I call
Keycloak.getInstance(keycloakUrl, keycloakRealm, keycloakUser, keycloakPwd, "admin-cli");
And at this moment my running applicatiom ( because everything run well ) give me the ClassCastException
above.
It's more a global jave ( JEE ) question here, I can't give more code 'cause at the end you won t be able to build an XWiki/Keycloak running environment and reproduce the issue ( because in eclipse, throught unit test, outside the xwiki environment there is ofc no conflict and Keycloak.getInstance
works fine ).
what can I do in this situation ? is there a maven way to avoid theses conflict ? maybe a class to reimplement ?
Environment :
tomcat 9.0.12
XWiki 10.6.1
Keycloak 4.3.0
Java 8