title: javax.xml.parsers.DocumentBuilderFactory could not be instantiated in Websphere Application Server with Hibernate 5.2.2 Upgrade
body: <p>Upgrading Hibernate 4.2 to Hibernate 5.2 version</p>
  
  <p>While deploying application in Websphere 8.5.5.13 version, throwing up following error </p>
  
  <blockquote>
    <p>00000001 ContainerHelp E   WSVR0501E: Error creating component
    com.ibm.ws.runtime.component.CompositionUnitMgrImpl@b9dc2b3a
    com.ibm.ws.exception.RuntimeWarning:
    com.ibm.ws.exception.RuntimeError: com.ibm.ws.exception.RuntimeError:
    java.lang.RuntimeException:
    javax.xml.parsers.FactoryConfigurationError: Provider
    javax.xml.parsers.DocumentBuilderFactory could not be instantiated:
    java.util.ServiceConfigurationError:
    javax.xml.parsers.DocumentBuilderFactory: Provider
    org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype   at
    com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCUList(CompositionUnitMgrImpl.java:1303)
      at
    com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:275)</p>
  </blockquote>
  
  <p>I tried Removing xml-api jar and maven exclusion</p>
  
  <pre><code>         &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate-core.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                  &lt;groupId&gt;xml-apis&lt;/groupId&gt;
                  &lt;artifactId&gt;xml-apis&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt; 
  </code></pre>
  
  <p>However, Web Application deployment was successful in Tomcat 9 without any changes.</p>
  
  <p>Stack Trace:</p>
  
  <pre><code>00000001 ContainerHelp E   WSVR0501E: Error creating component com.ibm.ws.runtime.component.CompositionUnitMgrImpl@b9dc2b3a
  com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.exception.RuntimeError: com.ibm.ws.exception.RuntimeError: java.lang.RuntimeException: javax.xml.parsers.FactoryConfigurationError: Provider javax.xml.parsers.DocumentBuilderFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCUList(CompositionUnitMgrImpl.java:1303)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:275)
      at com.ibm.ws.runtime.component.ContainerHelper.startComponents(ContainerHelper.java:540)
      at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:627)
      at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:618)
      at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:252)
      at com.ibm.ws.runtime.component.ContainerHelper.startComponents(ContainerHelper.java:540)
      at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:627)
      at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:618)
      at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:540)
      at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:316)
      at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:229)
      at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:702)
      at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
      at java.lang.reflect.Method.invoke(Method.java:508)
      at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:234)
      at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:96)
      at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:77)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
      at java.lang.reflect.Method.invoke(Method.java:508)
      at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
      at java.lang.reflect.Method.invoke(Method.java:508)
      at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
      at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
      at org.eclipse.core.launcher.Main.run(Main.java:981)
      at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:407)
      at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:170)
  Caused by: com.ibm.ws.exception.RuntimeError: com.ibm.ws.exception.RuntimeError: java.lang.RuntimeException: javax.xml.parsers.FactoryConfigurationError: Provider javax.xml.parsers.DocumentBuilderFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype
      at com.ibm.wsspi.runtime.component.WsComponentImpl.join(WsComponentImpl.java:436)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCUList(CompositionUnitMgrImpl.java:1295)
      ... 39 more
  Caused by: com.ibm.ws.exception.RuntimeError: java.lang.RuntimeException: javax.xml.parsers.FactoryConfigurationError: Provider javax.xml.parsers.DocumentBuilderFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:818)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2279)
      at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5554)
      at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5680)
      at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2284)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:436)
      at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:379)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:127)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:985)
      at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:524)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
  Caused by: java.lang.RuntimeException: javax.xml.parsers.FactoryConfigurationError: Provider javax.xml.parsers.DocumentBuilderFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype
      at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:1063)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:795)
      ... 12 more
  Caused by: javax.xml.parsers.FactoryConfigurationError: Provider javax.xml.parsers.DocumentBuilderFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype
      at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
      at com.ibm.ws.webservices.engine.utils.XMLUtils.getDocumentBuilderFactory(XMLUtils.java:460)
      at com.ibm.ws.webservices.engine.utils.XMLUtils.newDocument(XMLUtils.java:539)
      at com.ibm.ws.webservices.engine.utils.XMLUtils.newDocument(XMLUtils.java:557)
      at com.ibm.ws.webservices.engine.encoding.custom.Utils.loadCustomProviders(Utils.java:267)
      at com.ibm.ws.webservices.tools.resource.ToolEnv$3.run(ToolEnv.java:332)
      at java.security.AccessController.doPrivileged(AccessController.java:638)
      at com.ibm.ws.webservices.tools.resource.ToolEnv.loadCustomProviders(ToolEnv.java:329)
      at com.ibm.ws.webservices.tools.resource.ToolEnv.getCustomBindingProviders(ToolEnv.java:324)
      at com.ibm.ws.webservices.wsdl.toJava.Emitter.initCustomBindingRegistry(Emitter.java:972)
      at com.ibm.ws.webservices.wsdl.toJava.Emitter.setup(Emitter.java:959)
      at com.ibm.ws.webservices.wsdl.Parser.parse(Parser.java:326)
      at com.ibm.ws.webservices.wsdl.Parser.run(Parser.java:313)
      at com.ibm.ws.webservices.tools.WSDLQuery.parse(WSDLQuery.java:142)
      at com.ibm.ws.webservices.engine.deployment.wsdd.WSDDGen.getWSDLQuery(WSDDGen.java:214)
      at com.ibm.ws.webservices.engine.deployment.wsdd.WSDDPort.expand(WSDDPort.java:554)
      at com.ibm.ws.webservices.engine.deployment.wsdd.WSDDPort._initTMR(WSDDPort.java:311)
      at com.ibm.ws.webservices.component.WSServerImpl.setupWsddPort(WSServerImpl.java:1264)
      at com.ibm.ws.webservices.component.WSServerImpl.warMetaDataCreated(WSServerImpl.java:2151)
      at com.ibm.ws.webservices.component.WSServerImpl.metaDataCreated(WSServerImpl.java:639)
      at com.ibm.ws.runtime.component.MetaDataMgrImpl.fireMetaDataCreated(MetaDataMgrImpl.java:279)
      at com.ibm.ws.runtime.component.MetaDataMgrImpl.fireMetaDataCreated(MetaDataMgrImpl.java:262)
      at com.ibm.ws.webcontainer.metadata.WebMetaDataFactory.createMetaData(WebMetaDataFactory.java:244)
      at com.ibm.ws.runtime.component.MetaDataMgrImpl.createMetaDataFromFactories(MetaDataMgrImpl.java:228)
      at com.ibm.ws.runtime.component.MetaDataMgrImpl.createMetaData(MetaDataMgrImpl.java:411)
      at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:631)
      at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:979)
  </code></pre>