Pages

April 23, 2014

How to solve 'XML error parsing context.xml' issue in JBOSS-5?

I got below exception while I was trying to deploy my application on 'jboss-5.1.0.GA' :

Stack Trace:

10:07:21,163 INFO  [TomcatDeployment] deploy, ctxPath=/TESTSSO
10:07:21,247 ERROR [JBossContextConfig] XML error parsing: context.xml
org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
    at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:100)
    at org.jboss.web.tomcat.service.deployers.JBossContextConfig.processContextConfig(JBossContextConfig.java:549)
    at org.jboss.web.tomcat.service.deployers.JBossContextConfig.init(JBossContextConfig.java:536)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.StandardContext.init(StandardContext.java:5436)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
    at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
    at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
    at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
    at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)


Cause:
 I checked and found xerces related jar(s) (eg: xercesImpl.jar) is present in my application application.  also found JBoss AS ships the xerces related jar in its JBOSS_HOME/lib/endorsed/ folder.

As my application packages this jar, that's why while deploying it leads to a classlaoder issue whicg ultimately resulting in the ClassCastException

Workaround:
Best solution is to remove the xerces related jar file(s) from your application packaging.

-K Himaanshu Shukla...



Copyright © 2014 - ScrutinyByKHimaanshu

2 comments:

  1. Great it worked for me.. I removed XercesImpl from JBOSS_HOME/lib/endorsed

    ReplyDelete
  2. According to the suggested solution i had deleted unwanted jar files from WEB.INF.

    Following error occur after deleting unwanted JAR files. 2016-04-08 11:30:47,239 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/alfresco]] (main) Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener java.lang.VerifyError: (class: org/alfresco/xmlfactory/SAXParserFactoryXercesImpl, method: signature: ()V) Incompatible argument to function

    ReplyDelete