I have a datasource defined in JBoss 7. I have verified the setup by using JNDI lookup and obtaining a DB connection to it using Java code in a servlet as below.
DataSource patternSpyDB; Connection conn; try { Context ctx = new InitialContext(); patternSpyDB = (DataSource)ctx.lookup("java:jboss/datasources/patternspy"); conn = patternSpyDB.getConnection(); System.out.println("### SQLServer database connection obtained..."); And it works well.
Now I tried using org.jbpm.task persistence unit (or any other persistence.xml file) and the Hibernate seems to be waiting forever to obtain DB connection. Please see excerpt below.
10:55:10,250 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "T1.war" 10:55:10,287 INFO [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on 127.0.0.1:9999 10:55:10,311 INFO [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on 127.0.0.1:4447 10:55:10,528 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 10:55:10,530 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/patternspy] 10:55:10,974 INFO [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011401: Read persistence.xml for mgTest 10:55:11,689 INFO [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011907: Register module: Module "deployment.T1.war:main" from Service Module Loader 10:55:11,703 INFO [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'T1.war#mgTest' 10:55:12,567 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-1) HCANN000001: Hibernate Commons Annotations {4.0.1.Final-redhat-1} 10:55:12,573 INFO [org.hibernate.Version] (MSC service thread 1-1) HHH000412: Hibernate Core {4.1.3.Final-redhat-1} 10:55:12,575 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH000206: hibernate.properties not found 10:55:12,577 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH000021: Bytecode provider name : javassist 10:55:12,924 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-1) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
And it hangs there until timeout.
Why is it hanging? The datasource setup is correct as verified above. What can be missing?
Here is a smaller persistence unit I tested with in addition to org.jbpm.task.
<persistence-unit name="org.jbpm.task"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:jboss/datasources/patternspy</jta-data-source> <mapping-file>META-INF/Taskorm.xml</mapping-file> <class>org.jbpm.task.Attachment</class> <class>org.jbpm.task.BooleanExpression</class> <class>org.jbpm.task.Comment</class> <class>org.jbpm.task.Content</class> <class>org.jbpm.task.Deadline</class> <class>org.jbpm.task.Delegation</class> <class>org.jbpm.task.EmailNotification</class> <class>org.jbpm.task.EmailNotificationHeader</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.OnAllSubTasksEndParentEndStrategy</class> <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class> <class>org.jbpm.task.PeopleAssignments</class> <class>org.jbpm.task.Reassignment</class> <class>org.jbpm.task.Status</class> <class>org.jbpm.task.SubTasksStrategy</class> <class>org.jbpm.task.Task</class> <class>org.jbpm.task.TaskData</class> <class>org.jbpm.task.User</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/> <property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.connection.username" value="pattern2008"/> <property name="hibernate.connection.password" value="pattern2008"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.default_schema" value="dbo"/> </properties> </persistence-unit>
Thanks for helping.
Madhav
|