-
Bug
-
Resolution: Done
-
Major
-
jBPM 3.2.1
-
None
When configuraing jBPM / Hibernate with a datasource in an Enterprise application, using a local JNDI reference (java:comp/env/...) the web application works properly, accessing the database without any problem.
But if you declare the JobExecutorServlet in the web application's web.xml, each time the this servlet JobExecutorThread fires, it generates exceptions:
[22/08/07 18:33:03:175 CEST] 0000005e SystemOut O 18:33:03 DEBUG org.jbpm.job.executor.JobExecutorThread : acquiring jobs for execution...
[22/08/07 18:33:03:315 CEST] 0000005f javaURLContex E NMSV0310E: Une opération JNDI sur un nom "java:" ne peut pas aboutir car le contexte d'exécution du serveur ne peut pas associer l'unité d'exécution de l'opération à un composant d'application J2EE. Cette condition peut se produire lorsque le client JNDI utilisant le nom "java:" n'est pas exécuté sur l'unité d'exécution d'une demande d'application du serveur. Assurez-vous qu'une application J2EE n'exécute pas d'opérations JNDI sur des noms "java:" dans des blocs de code statiques ou dans des unités d'exécution créées par cette application J2EE. Un code de ce type ne s'exécute pas nécessairement sur l'unité d'exécution d'une demande d'application du serveur et n'est donc pas pris en charge par les opérations JNDI sur les noms "java:". Trace de pile d'exceptions :
javax.naming.ConfigurationException [Root exception is javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".]
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:411)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:354)
at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:563)
at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:109)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:56)
Caused by: javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1767)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1083)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
... 17 more
[22/08/07 18:33:03:347 CEST] 0000005e SystemOut O 18:33:03 FATAL org.hibernate.connection.DatasourceConnectionProvider : Could not find datasource: java:comp/env/jdbc/dsJBPM
javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the serverruntime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".]
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:416)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:354)
at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:563)
at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:109)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:56)
Caused by:
javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1767)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1083)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
... 17 more
[22/08/07 18:33:03:347 CEST] 0000005e SystemOut O 18:33:03 ERROR org.jbpm.job.executor.JobExecutorThread : exception in job executor thread. waiting 10000 milliseconds
org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:354)
at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:563)
at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:109)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:56)
Caused by:
javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the serverruntime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".]
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:416)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
... 13 more
Caused by:
javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1767)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1083)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
... 17 more
The exception is raised even if there is no timer in the process definition.
If I replace the local JNDI reference (java:comp/env/jdbc/datasource) with the global JNDI name (jdbc/dsOracle) the JobExecutorThread works fine (even if Websphere logs warning due to direct use of the global JNDI reference). The JobExecutorThread also works if I replace the datasource with the database access parameters (driver, url, ...).
(sample ear is available to reproduce the bug if necessary)
- relates to
-
JBPM-836 "ejb local timer lookup problem" in EjbSchedulerService.java
- Resolved