AnsweredAssumed Answered

ExceptionInInitializerError - Logger cannot be created

Question asked by bpaas on May 14, 2012
Hi everyone,

We're using the Activiti API from within an OSGi bundle. We ran into class loader issues after updating our bundles, which we try to pass by using the following code to build our process engine.


ClassLoader cl = Thread.currentThread().getContextClassLoader();

Thread.currentThread().setContextClassLoader(<class loader that the Activiti library was initially loaded with>);
try{
   ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
   
   processEngineConfiguration.setClassLoader(Thread.currentThread().getContextClassLoader())
   .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE).setJdbcUrl(dbPath)
   .setJdbcDriver("com.mysql.jdbc.Driver")
   .setJdbcPassword(conf.getPassword())
   .setJdbcUsername(conf.getUsername()).setJobExecutorActivate(true);
   
   processEngine = processEngineConfiguration.buildProcessEngine();               
}
finally{
   Thread.currentThread().setContextClassLoader(cl);            
}

Using this solution, we no longer get ClassCastExceptions, but a different stacktrace:

java.lang.ExceptionInInitializerError
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:406)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:293)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:270)
   at de.paas.engine.adapter.activiti.ActivitiEngine.initializeEngine(ActivitiEngine.java:91)
   at de.paas.engine.core.ProcessEngineModule.initializeEngine(ProcessEngineModule.java:68)
   at de.paas.engine.core.ProcessEngineModule.<init>(ProcessEngineModule.java:50)
   at de.paas.modelwrapper.ApplicationAccount.findAccount(ApplicationAccount.java:145)
   at de.paas.handler.LoginHandler.post(LoginHandler.java:48)
   at de.paas.dispatcher.LoginDispatcher.doPost(LoginDispatcher.java:53)
   at de.paas.controller.FrontController.startService(FrontController.java:87)
   at de.paas.controller.FrontController.doFilter(FrontController.java:160)
   at de.paas.filter.core.PaasChain.doFilter(PaasChain.java:28)
   at de.paas.filter.PaasMessageFilter.doFilter(PaasMessageFilter.java:44)
   at de.paas.filter.core.PaasChain.doFilter(PaasChain.java:28)
   at de.paas.dispatcher.LoginDispatcher.service(LoginDispatcher.java:36)
   at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:91)
   at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:110)
   at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:115)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
   at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.ibatis.logging.LogException: Error creating logger for class class org.apache.ibatis.datasource.pooled.PooledDataSource.  Cause: java.lang.NullPointerException
   at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:43)
   at org.apache.ibatis.datasource.pooled.PooledDataSource.<clinit>(PooledDataSource.java:17)
   … 37 more
Caused by: java.lang.NullPointerException
   at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:41)
   … 38 more

Can you think of what may be causing this problem?

Thank you very much in advance!
Johannes

Outcomes