'javax.xml.parsers.FactoryConfigurationError: Поставщик для класса javax.xml.parsers.DocumentBuilderFactory не может быть создан' для Tomcat Valve

Я работал над созданием специального клапана Apache Tomcat на основе единого входа на основе SAML 2.0. Во время инициализации этого клапана Tomcat при некоторых запусках запуска сервера (это происходит не часто при каждом запуске сервера) я обнаружил следующее исключение в журналах Tomcat:

05-Feb-2016 00:35:08.643 SEVERE [localhost-startStop-1] org.apache.catalina.session.StandardManager.startInternal Exception loading sessions from persistent storage
 javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created
    at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:311)
    at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
    at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
    at org.opensaml.xml.parse.BasicParserPool.initializePool(BasicParserPool.java:505)
    at org.opensaml.xml.parse.BasicParserPool.<init>(BasicParserPool.java:141)
    at org.opensaml.xml.XMLConfigurator.<init>(XMLConfigurator.java:88)
    at org.opensaml.xml.XMLConfigurator.<init>(XMLConfigurator.java:74)
    at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:220)
    at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:207)
    at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:100)
    at org.wso2.appserver.webapp.security.sso.saml.SAMLSSOUtils.doBootstrap(SAMLSSOUtils.java:175)
    at org.wso2.appserver.webapp.security.sso.saml.SAMLSSOUtils.<clinit>(SAMLSSOUtils.java:113)
    at org.wso2.appserver.webapp.security.sso.bean.LoggedInSession$SAML2SSO.readObject(LoggedInSession.java:189)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1900)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1924)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
    at org.apache.catalina.session.StandardSession.doReadObject(StandardSession.java:1629)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1092)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:261)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:180)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:460)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5198)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created
    at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:308)
    ... 43 more
Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
    at java.util.ServiceLoader.fail(ServiceLoader.java:239)
    at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:294)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
    ... 43 more

05-Feb-2016 00:35:08.650 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/chiranga/WSO2-Internship-Projects/wso2-products/product-as/distribution/target/application-server-6.0.0/webapps/bar-app.war has finished in 1,119 ms
05-Feb-2016 00:35:08.651 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/chiranga/WSO2-Internship-Projects/wso2-products/product-as/distribution/target/application-server-6.0.0/webapps/sample.war
05-Feb-2016 00:35:09.615 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
05-Feb-2016 00:35:09.625 SEVERE [localhost-startStop-1] org.apache.catalina.session.StandardManager.startInternal Exception loading sessions from persistent storage
 java.lang.NoClassDefFoundError: Could not initialize class org.wso2.appserver.webapp.security.sso.saml.SAMLSSOUtils
    at org.wso2.appserver.webapp.security.sso.bean.LoggedInSession$SAML2SSO.readObject(LoggedInSession.java:189)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1900)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1924)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
    at org.apache.catalina.session.StandardSession.doReadObject(StandardSession.java:1629)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1092)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:261)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:180)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:460)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5198)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Я просмотрел несколько форумов, на которых предлагалось использовать следующую зависимость:

<dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
</dependency>

Как и предполагалось, это решало проблему, которая часто возникала ранее, но я видел, что вышеупомянутое исключение иногда возникало при запуске сервера.

И у меня также есть вышеупомянутый DocumentBuilderFactory.class в папке lib Tomcat.

Я что-то упускаю из своего кода или это проблема, связанная с производительностью? Любая помощь высоко ценится.

0 ответов

Другие вопросы по тегам