users@glassfish.java.net

GF4: Cannot start batch job from _at_Startup EJB

From: Harald Wellmann <hwellmann.de_at_gmail.com>
Date: Sun, 09 Jun 2013 17:17:48 +0200

I'm currently experimenting with the new javax.batch API in GlassFish
4.0b89.

I'm getting exceptions when trying to start a batch job from a
@PostConstruct method of a @Singleton @Startup EJB.

However, the same code works fine when running within a servlet.

It seems the batch runtime is not yet fully set up when the EJB startup
methods are run.

See the message about failed lookup of "jddb/batch" below.

Is this a bug, or is it illegal to use the Batch API in this early phase?

[#|2013-06-09T17:00:44.550+0200|INFO|glassfish
4.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=1;_ThreadName=main;_TimeMillis=1370790044550;_LevelValue=800;_MessageID=ejb.portable_jndi_names;|
   EJB5181:Portable JNDI names for EJB InitializerService:
[java:global/batch-demo/InitializerService!com.blogspot.hwellmann.batch.init.InitializerService,
java:global/batch-demo/InitializerService]|#]

[#|2013-06-09T17:00:44.638+0200|INFO|glassfish
4.0|org.jboss.weld.Version|_ThreadID=1;_ThreadName=main;_TimeMillis=1370790044638;_LevelValue=800;|
   WELD-000900 2.0.0 (SP1)|#]

[#|2013-06-09T17:00:45.600+0200|WARNING|glassfish
4.0|org.jboss.weld.interceptor.util.InterceptionTypeRegistry|_ThreadID=1;_ThreadName=main;_TimeMillis=1370790045600;_LevelValue=900;|
   Class 'javax.ejb.PostActivate' not found, interception based on it is
not enabled|#]

[#|2013-06-09T17:00:45.601+0200|WARNING|glassfish
4.0|org.jboss.weld.interceptor.util.InterceptionTypeRegistry|_ThreadID=1;_ThreadName=main;_TimeMillis=1370790045601;_LevelValue=900;|
   Class 'javax.ejb.PrePassivate' not found, interception based on it is
not enabled|#]

[#|2013-06-09T17:00:46.130+0200|SEVERE|glassfish
4.0|com.ibm.jbatch.container.services.impl.JDBCPersistenceManagerImpl|_ThreadID=1;_ThreadName=main;_TimeMillis=1370790046130;_LevelValue=1000;|
   Lookup failed for JNDI name: jdbc/batch. One cause of this could be
that the batch runtime is incorrectly configured to EE mode when it
should be in SE mode.|#]

[#|2013-06-09T17:00:46.131+0200|SEVERE|glassfish
4.0|com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl|_ThreadID=1;_ThreadName=main;_TimeMillis=1370790046131;_LevelValue=1000;|
   Could not instantiate service:
com.ibm.jbatch.container.impl.BatchKernelImpl due to
exception:java.lang.reflect.InvocationTargetException|#]


Best regards,
Harald