This looks like your problem primarily involves Wildfly's modular
classloading and how to package MyBatis classes into a module.
You said that the federation provider jar is a big fat jar that includes
all its dependencies. Herein lies your problem. Your jar apparently
contains javax.xml classes, which it shouldn't.
When you define a jboss module for your provider you specify resources and
dependencies in your module.xml. You have to pull in javax.xml as Bill has
specified:
<module name="javax.api"/>
But you also have to make sure that none of the same classes that you pull
in are present in your big fat provider jar. I bet if you do:
jar tf your-provider.jar
you'll see javax.xml classes listed. You have to remove them.
When you pull in javax.api module dependency you are using the rt.jar
implementation - only slightly bytecode-manipulated when it's loaded.
On Fri, Oct 16, 2015 at 6:49 PM, carmen <carmen.checa(a)masergy.com> wrote:
Hi Bill,
I already had <module name="javax.api”/> in my module.xml
I did find a workaround that I do not like and I am hoping that you can
help me do it right
Ok so I first set jaxp debug to true,
and I was getting the following error
JAXP: using thread context class loader (ModuleClassLoader for Module
"deployment.keycloak-server.war:main" from Service Module Loader) for search
11:03:40,517 ERROR [stderr] (default task-2) JAXP: Looking up system
property 'javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom'
11:03:40,517 ERROR [stderr] (default task-2) JAXP: The value is
'__redirected.__XPathFactory'
11:03:40,517 ERROR [stderr] (default task-2) JAXP:
createInstance(__redirected.__XPathFactory)
11:03:40,518 ERROR [stderr] (default task-2) JAXP: loaded
__redirected.__XPathFactory from
jar:file:/Users/Carmen/software/keycloak-demo-1.5.0.Final/keycloak/jboss-modules.jar!/__redirected/__XPathFactory.class
11:03:40,518 ERROR [stderr] (default task-2) JAXP: could not instantiate
__redirected.__XPathFactory
11:03:40,519 ERROR [stderr] (default task-2) java.lang.ClassCastException:
__redirected.__XPathFactory cannot be cast to javax.xml.xpath.XPathFactory
11:03:40,519 ERROR [stderr] (default task-2) at
javax.xml.xpath.XPathFactoryFinder.createInstance(XPathFactoryFinder.java:306)
11:03:40,519 ERROR [stderr] (default task-2) at
javax.xml.xpath.XPathFactoryFinder._newFactory(XPathFactoryFinder.java:184)
11:03:40,519 ERROR [stderr] (default task-2) at
javax.xml.xpath.XPathFactoryFinder.newFactory(XPathFactoryFinder.java:157)
So it looked like there was a class loader issue and the ClassCast was
not working.
I did not know how to fix that, so I went ahead and I changed the property
javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom back to
the default, to override looking for __redirected.__XPathFactory
The default implementation is a com.sun….. class that lives in rt.jar and
when I tried that I was getting a ClassNotFound, so I went ahead, added
Xalan to my module and changed the property to use the Xalan class:
org.apache.path.jaxp.XPathFactoryImpl
That worked.
I had that same issue with another class that was also overriden with a
__redirected class (DocumentBuilderFactory), and once I set the default
value to the default implementation, the implementation cannot be loaded
because it is in rt.jar. I went around that by adding crimsom to my module.
So it looks like even though there is a dependency defined of java.api,
those jars (at least for xml) do not contain implementations, just the
interfaces, and the actual providers are in rt.jar and I get an error
trying to load them.
I really do not like what I have done. There’s got to be a way to be able
to use the implementations in rt.jar, right?
Thanks
Maria
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user