Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

org.opensaml.xml.schema.impl.XSAnyBuilder cannot be cast to org.opensaml.core.xml.XMLObjectBuilder when running on Tomcat8

Ask Question

I have a saml project based on opensaml which is running OK on tomcat7. Our company is upgrading to tomcat8 and I can't run it. The error message is

java.lang.ClassCastException: org.opensaml.xml.schema.impl.XSAnyBuilder cannot be cast to org.opensaml.core.xml.XMLObjectBuilder

I did some research online and some articles say it may be the reason I mix using opensaml 2 and 3. However, I only use opensaml 3. Here is the pom.xml and error log

        <dependency>
            <groupId>org.opensaml</groupId>
            <artifactId>opensaml-saml-api</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.opensaml</groupId>
            <artifactId>opensaml-saml-impl</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.opensaml</groupId>
            <artifactId>openws</artifactId>
            <version>1.5.4</version>                
        </dependency> 

Stacktrace:

2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] java.lang.ClassCastException: org.opensaml.xml.schema.impl.XSAnyBuilder cannot be cast to org.opensaml.core.xml.XMLObjectBuilder 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.xml.config.XMLConfigurator.initializeObjectProviders(XMLConfigurator.java:238) 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.xml.config.XMLConfigurator.load(XMLConfigurator.java:203) 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.xml.config.XMLConfigurator.load(XMLConfigurator.java:188) 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.xml.config.XMLConfigurator.load(XMLConfigurator.java:162) 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.xml.config.AbstractXMLObjectProviderInitializer.init(AbstractXMLObjectProviderInitializer.java:52) 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.xml.config.XMLObjectProviderInitializer.init(XMLObjectProviderInitializer.java:45) 2019-05-02T15:12:06.323-04:00 [APP/PROC/WEB/0] [ERR] at org.opensaml.core.config.InitializationService.initialize(InitializationService.java:56) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at com.vmware.eucenablement.saml.service.SAMLIDPService.(SAMLIDPService.java:27) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at com.vmware.samltoolkit.idp.IDPService.(IDPService.java:43) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at com.jpmchase.gca.idp.GcaIDP.initIDPService(GcaIDP.java:43) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at com.jpmchase.gca.StartStopListener.InitIDP(StartStopListener.java:69) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at com.jpmchase.gca.StartStopListener.contextInitialized(StartStopListener.java:42) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) 2019-05-02T15:12:06.324-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1129) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1871) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at java.util.concurrent.FutureTask.run(FutureTask.java:266) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 2019-05-02T15:12:06.325-04:00 [APP/PROC/WEB/0] [ERR] at java.lang.Thread.run(Thread.java:748)

Can somebody give some help? Thanks a lot

Change your last dependency... FYI, OpenSAML 2.x will be the xmltooling, openws and opensaml2 jars. 3.x will be entirely opensaml-<modulename> jars with 3.x.x version numbers. Last response at the bottom from here – Vall0n May 3, 2019 at 12:41

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.