ExceptionInInitializerError in Castor

Discussion in 'Java' started by Ravi M, Apr 28, 2005.

  1. Ravi M

    Ravi M Guest

    Hi All,
    I am using castor -0.96 to marshall and unmarshall the xml
    file. Following is the scenario where I am having problem.

    I use castor to generate the xml file and convert into a byte array and
    make a call to a remote service using axis. Now the webservice tries to
    unmarshall the byte array using castor. I tried printing the byte array
    and it prints the exact xml file that is being sent by the application
    calling this webservice. I am running axis on Tomcat 4.1.29
    But when I try to unmarshall the byte array, I get the
    following error


    Could sombody please help as to what I am doing wrong.

    Thanks in advance.
    Ravi

    java.lang.ExceptionInInitializerError
    at
    org.exolab.castor.xml.Unmarshaller.initConfig(Unmarshaller.java:272)
    at
    org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:225)
    at
    org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:212)
    at
    org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:736)
    at webservices.PCSABean.unmarshal(PCSABean.java:363)
    at webservices.PCSA.add(PCSAAxisService.java:92)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod
    (RPCProvider.j
    ava:402)
    at
    org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider
    ..java:309)
    at
    org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:
    333)
    at
    org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
    y.java:71)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java :120)
    at
    org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481
    )
    at
    org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
    at org.apache.axis.transport.http.AxisServlet.doPost
    (AxisServlet.java:85
    4)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at
    org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
    e.java:339)
    at javax.servlet.http.HttpServlet.service
    (HttpServlet.java:853)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:256)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext (StandardPipeline.java:643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:191)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java :643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at
    org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2417)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at
    org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:171)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:172)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at
    org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java :643)
    at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

    at
    org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:19
    3)
    at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :781)
    at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:549)
    at
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :589)
    at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:666)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: org.apache.commons.logging.LogConfigurationException:
    org.apache.comm
    ons.logging.LogConfigurationException:
    org.apache.commons.logging.LogConfigurati
    onException: Class org.apache.commons.logging.impl.Log4JLogger does not
    implemen
    t Log
    at
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    Impl.java:532)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance
    (LogFactory
    Impl.java:272)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactory
    Impl.java:246)
    at
    org.exolab.castor.util.LocalConfiguration.<clinit>(LocalConfiguration
    ..java:105)
    ... 51 more
    Caused by: org.apache.commons.logging.LogConfigurationException:
    org.apache.comm
    ons.logging.LogConfigurationException: Class
    org.apache.commons.logging.impl.Log
    4JLogger does not implement Log
    at
    org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogF
    actoryImpl.java:416)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    Impl.java:525)
    ... 54 more
    Caused by: org.apache.commons.logging.LogConfigurationException: Class
    org.apach
    e.commons.logging.impl.Log4JLogger does not implement Log
    at
    org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor (LogF
    actoryImpl.java:412)
    ... 55 more
     
    Ravi M, Apr 28, 2005
    #1
    1. Advertising

  2. Ravi M wrote:

    > I use castor to generate the xml file and convert into a byte array and
    > make a call to a remote service using axis. Now the webservice tries to
    > unmarshall the byte array using castor. I tried printing the byte array
    > and it prints the exact xml file that is being sent by the application
    > calling this webservice. I am running axis on Tomcat 4.1.29
    > But when I try to unmarshall the byte array, I get the
    > following error


    [...]

    > java.lang.ExceptionInInitializerError
    > at
    > org.exolab.castor.xml.Unmarshaller.initConfig(Unmarshaller.java:272)
    > at
    > org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:225)
    > at


    A variable initializer of class org.exolab.castor.xml.Unmarshaller threw
    an exception. Specifically:

    [...]

    > Caused by: org.apache.commons.logging.LogConfigurationException:
    > org.apache.comm
    > ons.logging.LogConfigurationException:
    > org.apache.commons.logging.LogConfigurati
    > onException: Class org.apache.commons.logging.impl.Log4JLogger does not
    > implemen
    > t Log
    > at
    > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    > Impl.java:532)
    > at org.apache.commons.logging.impl.LogFactoryImpl.getInstance
    > (LogFactory
    > Impl.java:272)
    > at


    [...]

    Since it seems exceedingly unlikely that one of the Commons Logging's
    own loggers would fail to implement its Log interface, the most likely
    scenario is multiple versions of the Commons Logging package in the
    classpath. This sort of thing sometimes happens when an application or
    package, such as Axis, Castor, or Tomcat comes packaged with various
    external libraries, such as Commons Logging. It is possible for
    multiple versions of the same package to coexist peacefully, but it is
    necessary to exercise some care to get it right. In short, look into
    the server configuration.

    --
    John Bollinger
     
    John C. Bollinger, Apr 28, 2005
    #2
    1. Advertising

  3. Ravi M

    Ravi M Guest

    Hi John,
    Thank you very much for reply. I forgot to remove the
    commons-loging.jar that comes with axis, thus had two versions of
    commons-loging.jar in both tomcat/lib and
    tomcat/webapps/axis/web-inf/lib. Once I remove the commons-logging.jar
    from the tomcat/webapps/axis/web-inf/lib it worked.

    Thanks again.
    Ravi

    John C. Bollinger wrote:
    > Ravi M wrote:
    >
    > > I use castor to generate the xml file and convert into a byte array

    and
    > > make a call to a remote service using axis. Now the webservice

    tries to
    > > unmarshall the byte array using castor. I tried printing the byte

    array
    > > and it prints the exact xml file that is being sent by the

    application
    > > calling this webservice. I am running axis on Tomcat 4.1.29
    > > But when I try to unmarshall the byte array, I get the
    > > following error

    >
    > [...]
    >
    > > java.lang.ExceptionInInitializerError
    > > at
    > >

    org.exolab.castor.xml.Unmarshaller.initConfig(Unmarshaller.java:272)
    > > at
    > > org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:225)
    > > at

    >
    > A variable initializer of class org.exolab.castor.xml.Unmarshaller

    threw
    > an exception. Specifically:
    >
    > [...]
    >
    > > Caused by: org.apache.commons.logging.LogConfigurationException:
    > > org.apache.comm
    > > ons.logging.LogConfigurationException:
    > > org.apache.commons.logging.LogConfigurati
    > > onException: Class org.apache.commons.logging.impl.Log4JLogger does

    not
    > > implemen
    > > t Log
    > > at
    > >

    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    > > Impl.java:532)
    > > at

    org.apache.commons.logging.impl.LogFactoryImpl.getInstance
    > > (LogFactory
    > > Impl.java:272)
    > > at

    >
    > [...]
    >
    > Since it seems exceedingly unlikely that one of the Commons Logging's


    > own loggers would fail to implement its Log interface, the most

    likely
    > scenario is multiple versions of the Commons Logging package in the
    > classpath. This sort of thing sometimes happens when an application

    or
    > package, such as Axis, Castor, or Tomcat comes packaged with various
    > external libraries, such as Commons Logging. It is possible for
    > multiple versions of the same package to coexist peacefully, but it

    is
    > necessary to exercise some care to get it right. In short, look into


    > the server configuration.
    >
    > --
    > John Bollinger
    >
     
    Ravi M, Apr 29, 2005
    #3
  4. Ravi M

    Ravi M Guest

    Hi John,
    Thank you very much for reply. I forgot to remove the
    commons-loging.jar that comes with axis, thus had two versions of
    commons-loging.jar in both tomcat/lib and
    tomcat/webapps/axis/web-inf/lib. Once I remove the commons-logging.jar
    from the tomcat/webapps/axis/web-inf/lib it worked.

    Thanks again.
    Ravi

    John C. Bollinger wrote:
    > Ravi M wrote:
    >
    > > I use castor to generate the xml file and convert into a byte array

    and
    > > make a call to a remote service using axis. Now the webservice

    tries to
    > > unmarshall the byte array using castor. I tried printing the byte

    array
    > > and it prints the exact xml file that is being sent by the

    application
    > > calling this webservice. I am running axis on Tomcat 4.1.29
    > > But when I try to unmarshall the byte array, I get the
    > > following error

    >
    > [...]
    >
    > > java.lang.ExceptionInInitializerError
    > > at
    > >

    org.exolab.castor.xml.Unmarshaller.initConfig(Unmarshaller.java:272)
    > > at
    > > org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:225)
    > > at

    >
    > A variable initializer of class org.exolab.castor.xml.Unmarshaller

    threw
    > an exception. Specifically:
    >
    > [...]
    >
    > > Caused by: org.apache.commons.logging.LogConfigurationException:
    > > org.apache.comm
    > > ons.logging.LogConfigurationException:
    > > org.apache.commons.logging.LogConfigurati
    > > onException: Class org.apache.commons.logging.impl.Log4JLogger does

    not
    > > implemen
    > > t Log
    > > at
    > >

    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
    > > Impl.java:532)
    > > at

    org.apache.commons.logging.impl.LogFactoryImpl.getInstance
    > > (LogFactory
    > > Impl.java:272)
    > > at

    >
    > [...]
    >
    > Since it seems exceedingly unlikely that one of the Commons Logging's


    > own loggers would fail to implement its Log interface, the most

    likely
    > scenario is multiple versions of the Commons Logging package in the
    > classpath. This sort of thing sometimes happens when an application

    or
    > package, such as Axis, Castor, or Tomcat comes packaged with various
    > external libraries, such as Commons Logging. It is possible for
    > multiple versions of the same package to coexist peacefully, but it

    is
    > necessary to exercise some care to get it right. In short, look into


    > the server configuration.
    >
    > --
    > John Bollinger
    >
     
    Ravi M, Apr 29, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Matthews
    Replies:
    0
    Views:
    725
    Mike Matthews
    Jul 23, 2003
  2. Stefan Becker
    Replies:
    0
    Views:
    826
    Stefan Becker
    Nov 17, 2003
  3. Stefan Becker
    Replies:
    0
    Views:
    1,444
    Stefan Becker
    Nov 18, 2003
  4. Boaz
    Replies:
    2
    Views:
    433
    John C. Bollinger
    Nov 8, 2004
  5. Sam Hwang
    Replies:
    0
    Views:
    623
    Sam Hwang
    Apr 26, 2005
Loading...

Share This Page