Thursday, July 22, 2010

Workflow job in jahia 6.1 fails on WebSphere

My jahia 6.1 site running on a WebSphere Application Server 6.1.0.29 was giving the following errors when workflowing a page:


[22/07/10 11:59:28:392 CEST] 0000004b SystemOut     O 2010-07-22 11:59:28,391: INFO  [BackgroundJob] - execute Background job BackgroundJob-a62d9921-ec0b-4f31-9256-ca716c3f2bb8
 started @ Thu Jul 22 11:59:28 CEST 2010
[22/07/10 11:59:28:395 CEST] 0000004b SystemOut     O 2010-07-22 11:59:28,394: ERROR [BackgroundJob] - Cannot execute job
java.lang.NullPointerException
 at org.jahia.services.usermanager.JahiaUserManagerDBProvider.lookupUserByKey(JahiaUserManagerDBProvider.java:462)
 at org.jahia.services.usermanager.JahiaUserManagerRoutingService$7.execute(JahiaUserManagerRoutingService.java:301)
 at org.jahia.services.usermanager.JahiaUserManagerRoutingService$7.execute(JahiaUserManagerRoutingService.java:300)
 at org.jahia.services.usermanager.JahiaUserManagerRoutingService.routeCallAllUntilSuccess(JahiaUserManagerRoutingService.java:433)
 at org.jahia.services.usermanager.JahiaUserManagerRoutingService.lookupUserByKey(JahiaUserManagerRoutingService.java:299)
 at org.jahia.services.usermanager.JahiaUserManagerRoutingService$$FastClassByCGLIB$$d7ce26b5.invoke()
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke(AbstractTraceInterceptor.java:113)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
 at org.jahia.services.usermanager.JahiaUserManagerRoutingService$$EnhancerByCGLIB$$be1b2945.lookupUserByKey()
 at org.jahia.services.scheduler.BackgroundJob.getProcessingContextFromBackgroundJobDataMap(BackgroundJob.java:228)
 at org.jahia.services.scheduler.BackgroundJob.execute(BackgroundJob.java:147)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
[22/07/10 11:59:28:397 CEST] 0000004b SystemOut     O 2010-07-22 11:59:28,397: ERROR [JobRunShell] - Job ActivationJob.BackgroundJob-a62d9921-ec0b-4f31-9256-ca716c3f2bb8 threw an unhandled Exception: 
java.lang.NullPointerException
 at org.jahia.services.scheduler.BackgroundJob.execute(BackgroundJob.java:166)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
[22/07/10 11:59:28:397 CEST] 0000004b SystemOut     O 2010-07-22 11:59:28,397: ERROR [ErrorLogger] - Job (ActivationJob.BackgroundJob-a62d9921-ec0b-4f31-9256-ca716c3f2bb8 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException]
 at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
 at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: java.lang.NullPointerException
 at org.jahia.services.scheduler.BackgroundJob.execute(BackgroundJob.java:166)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:202)

After some debugging I found the cause:

the quartz jobstore driverDelegateClass was set to 'MSSQLDelegate' (as MS SQLServer is the database I used when installing, so I assume th jahia installer put this value in automatically). When changing this driver to the standard delegate 'StdJDBCDelegate', the quartz job executed without problems.

The driveDelegateClass can be set in WEB-INF/etc/config/quartz.properties using the property "org.quartz.jobStore.driverDelegateClass".

The userkey (stored in the JobDataMap of quartz) was null when the job got executed, but was set correctly when defining the job. Because the mssql driver does not seem to work correctly on WAS, the JobExecutionContext did no longer hold these values in its JobDataMap when the job got executed.

Friday, July 16, 2010

Jahia 6.1 in RAD 7.5 on WAS 6.1 - connecting to CVS

When you run a jahia 6.1 project in RAD 7.5, and publish this project directly to a websphere application server 6.1 test server, it gives errors when your project is connected to CVS.

It starts with a trace like this:


[16/07/10 10:26:14:219 CEST] 0000001d SystemOut     O 2010-07-16 10:26:14,218: INFO  [GroovyEventListener] - Listener initialized with listener file name 'EventListener.groovy' and default listener file path 'events/EventListener.groovy'
[16/07/10 10:26:14:607 CEST] 0000001d SystemOut     O 2010-07-16 10:26:14,605: ERROR [NodeTypeRegistry] - Array index out of range: 1
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
at org.jahia.services.content.nodetypes.NodeTypeRegistry.(NodeTypeRegistry.java:66)

then, jahia goes on initializing, a few pages later you get this:

[16/07/10 10:26:23:737 CEST] 0000001d SystemOut     O 2010-07-16 10:26:23,736: ERROR [ContextLoader] - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'VersionService' defined in ServletContext resource [/WEB-INF/etc/spring/applicationcontext-services.xml]: Invocation of init method failed; nested exception is java.lang.StringIndexOutOfBoundsException

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)

Then the beautiful jahia ascii art shows up, to finish with this fatal message:


[16/07/10 10:26:25:076 CEST] 0000001d SystemOut     O 2010-07-16 10:26:25,075: ERROR [JCRStoreProvider] - Repository init error

java.lang.IllegalStateException: repository instance has been shut down



The solution to these errors was to disconnect the project from CVS


and to make sure the cvs resources were deleted