ClassCastException deploying on JBoss AS 5

Help
2010-03-14
2013-01-13
  • Hi,

    I just tried to complete the tutorial for my application, but when I should deploy the app the first time to lookup if the servlet works, I get the following exception:

    =======================================================
    INFO  15:13:48,304  ||| deploy, ctxPath=/simulation
    ERROR 15:13:48,460 [                 ] ||| Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfi
    gureListener
    java.lang.ClassCastException: org.apache.crimson.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory
            at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:128)
            at com.sun.faces.config.ConfigureListener$WebXmlProcessor.getConfiguredFactory(ConfigureListener.java:698)
            at com.sun.faces.config.ConfigureListener$WebXmlProcessor.scanForFacesServlet(ConfigureListener.java:670)
            at com.sun.faces.config.ConfigureListener$WebXmlProcessor.<init>(ConfigureListener.java:644)
            at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:156)
            at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:75)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:312)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
            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(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            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)
            at $Proxy36.start(Unknown Source)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
            at org.jboss.system.ServiceController.start(ServiceController.java:460)
            at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
            at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290)
            at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
            at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)

    =============================================

    Seems like Cewolf was built on some xml parsing engine that conflicts with the one used by the application server:
    "java.lang.ClassCastException: org.apache.crimson.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory"

    Well now I don't exactly know which of the libs used to build and use the Cewolf-lib contains that piece of code depending on some crimson parser.
    I also tried to add the crimson library to the application, but this exception will happen anyway.

    Any suggestions for this?

    King regards,
    Felix aka cybrstorm

     
  • Ulf Dittmer
    Ulf Dittmer
    2010-03-14

    Where do you see the connection to Cewolf? The exception happens in a JSF class, and the stack trace contains no cewolf class. Furthermore, Cewolf does not do any XML processing.

    So - when you say "the tutorial", what exactly do you mean by that? And how does JSF enter the picture?

     
  • The tutorial is the one from http://cewolf.sourceforge.net/new/index.html and it tells to deploy the application in "Tutorial: Step 3
    Install the Cewolf Servlet in your Web App". That's the point where this exception happened. I don't know where the connection to ceowolf is exactly, but at least some of the used libraries use some xml parser that conflicts with the one already being used by the app server. And as i'm not that deep into JSF things (didn't even use any JSF features here, not even a JSP, just the servlet described in step 2 (via copy-paste). So I don't know where there should be a connection to JSF, as you mentioned. The only reason that I could imagine is that some ceowolf lib or whatever invoked this call:
    "ERROR 15:13:48,460 [ ] ||| Exception sending context initialized event to listener instance of class…"
    Deploying the application without the step-2-servlet and without the ceowolf or the 3rd party libs works fine.

    The point for me filling this request is not to disable some JSF stuff, as I didn't use it, but to find a way to get around the parser conflict that was caused by afaik ceowolf dependecy.

     
  • Ulf Dittmer
    Ulf Dittmer
    2010-03-15

    I would start by using not the cewolf distribution available here, but the one I maintain at http://www.ulfdittmer.com/code/cewolf.html. It'll become the official distribution one of these days, and until then, it has lots of bug fixes and enhancements. It comes with an example web app that should work out of the box. If you use that, and are still facing problems, I'll be in a better position to speculate what might be going on.

     
  • Ok, this one works out of the box, as you said. The only thing to mention is that you rather should package the example app to a .war file, not a .zip one. I don't know if this only was a local error because of unzipping, but the app server threw a ZipException:

    "DEPLOYMENTS IN ERROR:
      Deployment "vfszip:/D:/Programme/jboss-5.0.1.GA/server/default/deploy/cewolfexample-1.1.zip/" is in error due to the following reason(s): java.util.zip.ZipException: error in ope
    ning zip file"

    Tried it three times with the zip, every time it didn't work. After that i tried exploded-mode deployment and that worked fine. Anyway a .war file would be better.

    But thanks for the advice using your distro, would be cool to see some entry on the original web page :)

    Regards,
    Felix

     
  • Ulf Dittmer
    Ulf Dittmer
    2010-03-16

    A standard web app is a good idea; I'll do that for the next release.

    As to the forked distro, it'll be folded back into the original project here; I just need to find the time to do that.