Issue Type: Bug Bug
Affects Versions: 4.2.0.Final
Assignee: Unassigned
Components: core
Created: 20/Apr/13 1:46 AM
Description:

If when The persistence Unit is started the JNDI binding failed, then either
1) It should not attempt to unbind() at all during shutdown. Maybe it will unbind() somebody elses instance by mistake, not the instance it things it owns?
2) If it must attempt to unbind() anyway, it should more silently emit a log message, indicating failure but also that bind() never completed during startup.

At the moment it throws an exception noisily for a condition that is expected in the situation.

But no such exception is thrown during startup, even through that is a more major concern. That expected configuration option requested could not be enforced during startup.

So it seems a bit backwards, you'd expect a startup failure Exception and a quietness on shutdown. Since it was shutting down anyway!

During Deploy.

09:03:12,802 DEBUG [org.hibernate.service.jndi.internal.JndiServiceImpl] (ServerService Thread Pool – 69) Bound name: java:/jboss/com.domain.jpa
09:03:12,802 INFO [org.hibernate.internal.SessionFactoryRegistry] (ServerService Thread Pool – 69) HHH000094: Bound factory to JNDI name: java:/jboss/com.domain.jpa
09:03:12,803 DEBUG [org.hibernate.internal.SessionFactoryRegistry] (ServerService Thread Pool – 69) HHH000127: Could not bind JNDI listener

During Undeploy:

09:04:22,974 WARN
[org.hibernate.internal.SessionFactoryRegistry] (ServerService Thread Pool – 70) HHH000374: Could not unbind factory from JNDI: org.hibernate.service.jndi.JndiException: Error performing unbind [java:/jboss/com.domain.jpa]
at org.hibernate.service.jndi.internal.JndiServiceImpl.unbind(JndiServiceImpl.java:181)
at org.hibernate.internal.SessionFactoryRegistry.removeSessionFactory(SessionFactoryRegistry.java:117)
at org.hibernate.internal.SessionFactoryImpl.close(SessionFactoryImpl.java:1389)
at org.hibernate.ejb.EntityManagerFactoryImpl.close(EntityManagerFactoryImpl.java:194)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$2.run(PersistenceUnitServiceImpl.java:124) [jboss-as-jpa-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final]
Caused by: javax.naming.NamingException: JBAS011836: Could not resolve service service jboss.naming.context.java.jboss."com.domain.jpa"
at org.jboss.as.naming.WritableServiceBasedNamingStore.unbind(WritableServiceBasedNamingStore.java:121) [jboss-as-naming-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at org.jboss.as.naming.WritableServiceBasedNamingStore.unbind(WritableServiceBasedNamingStore.java:112) [jboss-as-naming-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at org.jboss.as.naming.NamingContext.unbind(NamingContext.java:286) [jboss-as-naming-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at org.jboss.as.naming.InitialContext.unbind(InitialContext.java:165) [jboss-as-naming-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
at javax.naming.InitialContext.unbind(InitialContext.java:439) [rt.jar:1.7.0_17]
at org.hibernate.service.jndi.internal.JndiServiceImpl.unbind(JndiServiceImpl.java:178)
... 8 more

Environment: EAP 6.1, Java7
Project: Hibernate ORM
Priority: Minor Minor
Reporter: Darryl Miles
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira