Discussion:
[jboss-user] [jBPM] - Could not find datasource: java:jboss/datasources/jbpmDS
Yogesh Garg
2012-11-05 11:18:19 UTC
Permalink
Yogesh Garg [https://community.jboss.org/people/nsit_yogesh] created the discussion

"Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/774783#774783

--------------------------------------------------------------
Hi all,

I am receiving following error. I am using jBPM5.3 and JBOSS AS 5.x. Please let me know what am I missing.
16   05/11 16:40:32,344[main] ERROR hibernate.connection.DatasourceConnectionProvider.configure  - Could not find datasource: java:jboss/datasources/jbpmDS
javax.naming.NameNotFoundException: unable to find a bound object at name 'java:jboss/datasources/jbpmDS'
    at bitronix.tm.jndi.BitronixContext.lookup(BitronixContext.java:83)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
    at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.sample.ProcessMain.startTaskService(ProcessMain.java:219)
    at com.sample.ProcessMain.main(ProcessMain.java:50)
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.sample.ProcessMain.startTaskService(ProcessMain.java:219)
    at com.sample.ProcessMain.main(ProcessMain.java:50)
Caused by: org.hibernate.HibernateException: Could not find datasource
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
    at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
    ... 5 more
Caused by: javax.naming.NameNotFoundException: unable to find a bound object at name 'java:jboss/datasources/jbpmDS'
    at bitronix.tm.jndi.BitronixContext.lookup(BitronixContext.java:83)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
    ... 13 more
*I am using the following persistence.xml*
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
    version="1.0"
    xsi:schemaLocation=
      " http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence
       http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
       http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm
       http://java.sun.com/xml/ns/persistence/orm_1_0.xsd http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
    xmlns:orm=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
    xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence">
  <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <non-jta-data-source>java:jboss/datasources/jbpmDS</non-jta-data-source>
    <mapping-file>META-INF/Taskorm.xml</mapping-file>
    <class>org.jbpm.task.Attachment</class>
    <class>org.jbpm.task.Content</class>
    <class>org.jbpm.task.BooleanExpression</class>
    <class>org.jbpm.task.Comment</class>
    <class>org.jbpm.task.Deadline</class>
    <class>org.jbpm.task.Comment</class>
    <class>org.jbpm.task.Deadline</class>
    <class>org.jbpm.task.Delegation</class>
    <class>org.jbpm.task.Escalation</class>
    <class>org.jbpm.task.Group</class>
    <class>org.jbpm.task.I18NText</class>
    <class>org.jbpm.task.Notification</class>
    <class>org.jbpm.task.EmailNotification</class>
    <class>org.jbpm.task.EmailNotificationHeader</class>
    <class>org.jbpm.task.Reassignment</class>
    <class>org.jbpm.task.Status</class>
    <class>org.jbpm.task.Task</class>
    <class>org.jbpm.task.TaskData</class>
    <class>org.jbpm.task.SubTasksStrategy</class>
    <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
    <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
    <class>org.jbpm.task.User</class>
    <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
      <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
      <property name="hibernate.connection.url" value="jdbc:h2:~/test" />
      <property name="hibernate.connection.username" value="sa"/>
      <property name="hibernate.connection.password" value=""/>
      <property name="hibernate.connection.autocommit" value="true" />
      <property name="hibernate.max_fetch_depth" value="3"/>
      <property name="hibernate.hbm2ddl.auto" value="create" />
      <property name="hibernate.show_sql" value="true" />
    </properties>       
  </persistence-unit> 
</persistence>
Regards,
Yogesh Garg
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/774783#774783]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-05 11:24:42 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/774788#774788

--------------------------------------------------------------
make sure you have data source definition in your jboss as. an example of such data source definition you can find in jbpm-installer/db/jBPM-ds.xml

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/774788#774788]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Yogesh Garg
2012-11-06 05:14:41 UTC
Permalink
Yogesh Garg [https://community.jboss.org/people/nsit_yogesh] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/774942#774942

--------------------------------------------------------------
How should I make ensure that I have data-source defined especially when I am using JBOSS AS5. There is standalone.xml where a datasource is defined but I have read on the internet that it is relevant for AS7, and as far as AS5 is concerned in JBOSS_HOME/server/default/deploy/ there is a jbpm-ds.xml where a data-source is defined but it's not the one which I am using. Please clarify on this or something else needs to be done.

Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/774942#774942]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-06 10:20:45 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/775006#775006

--------------------------------------------------------------
check if the name in jbpm-ds.xml matches one defined as data source in your persistence.xml, below is an example taken from jbpm-installer:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>jboss/datasources/jbpmDS</jndi-name>
    <connection-url>jdbc:h2:tcp://localhost/runtime/jbpm-demo</connection-url>
    <driver-class>org.h2.jdbcx.JdbcDataSource</driver-class>
    <user-name>sa</user-name>
    <password></password>
  </local-tx-datasource>
</datasources>

jndi-name is that one that you should check

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/775006#775006]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Yogesh Garg
2012-11-08 06:17:19 UTC
Permalink
Yogesh Garg [https://community.jboss.org/people/nsit_yogesh] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/775478#775478

--------------------------------------------------------------
I cross-checked in jbpm-ds.xml at JBOSS_HOME/server/default/deploy/ and in standalone.xml, jndi-name was same but connection-url were different which I changed so as to synchronize. However I thought of delving into server logs for more insight and observed that there are numerous errors in it. I have attached my server log after starting the jboss.

Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/775478#775478]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Yogesh Garg
2012-11-09 11:19:15 UTC
Permalink
Yogesh Garg [https://community.jboss.org/people/nsit_yogesh] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/775723#775723

--------------------------------------------------------------
Please ignore above reply. PFA latest server log and jBPM-ds.xml. My persistence.xml for the project is mentioned above. I am using jboss as 5 in jbpm 5.3. Please let me know why I am receiving this error and these tables are not getting created.

Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/775723#775723]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2012-11-09 11:56:29 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/775725#775725

--------------------------------------------------------------
above is persistence.xml only for human task could you provide your perssitence.xml for jbpm engine (persistence unit org.jbpm.perssitence.jpa)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/775725#775725]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Yogesh Garg
2012-11-20 06:32:27 UTC
Permalink
Yogesh Garg [https://community.jboss.org/people/nsit_yogesh] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/777309#777309

--------------------------------------------------------------
Hi,

I want persistence for tasks only and not want for process engine. I later on realized that this definition of org.jbpm.perssitence.jpa will clash with the one present inside wars, so I changed the org.jbpm.perssitence.jpa with workflow.org.jbpm.persistence.jpa in both code and my peristence.xml file. But it still throws the "Could not find datasource" error. I recently realized in server log there was an error "org.h2.jdbc.JdbcSQLException: Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-161]" when I was starting the jboss. Please let me know what hints does this error reflect. I am attaching my server log when I started the jboss.

Regards.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/777309#777309]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Wooi Joe Chuah
2013-04-02 03:11:33 UTC
Permalink
Wooi Joe Chuah [https://community.jboss.org/people/joe.chuah] created the discussion

"Re: Could not find datasource: java:jboss/datasources/jbpmDS"

To view the discussion, visit: https://community.jboss.org/message/805893#805893

--------------------------------------------------------------
Hi,

Regarding your initial stacktrace.
You can try removing the jbpm-test.jar because it has a jndi.properties file that points it to use the BitronixInitialContextFactory.

It solved my problem with the same stacktrace.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805893#805893]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...