0 Replies Latest reply on Aug 9, 2017 11:41 AM by allen.antony

    Warning "Could not unbind factory from JNDI: org.hibernate.engine.jndi.JndiException" on Wildfly 9.0.1 shutdown

    allen.antony

      I am migrating my enterprise application from Jboss 5.0 to Wildfly 9. On shutting down Wildfly , I am seeing the following exception in the console.

       

      17:12:09,632 WARN  [org.hibernate.internal.SessionFactoryRegistry] (ServerService Thread Pool -- 89) HHH000374: Could not unbind factory from JNDI: org.hibernate.engine.jndi.JndiException: Error performing unbind [java:jboss/SessionFactory]

      at org.hibernate.engine.jndi.internal.JndiServiceImpl.unbind(JndiServiceImpl.java:230)

      at org.hibernate.internal.SessionFactoryRegistry.removeSessionFactory(SessionFactoryRegistry.java:139)

      at org.hibernate.internal.SessionFactoryImpl.close(SessionFactoryImpl.java:1369)

      at org.hibernate.jpa.internal.EntityManagerFactoryImpl.close(EntityManagerFactoryImpl.java:370)

      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$2$1.run(PersistenceUnitServiceImpl.java:220)

      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$2$1.run(PersistenceUnitServiceImpl.java:206)

      at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:665)

      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$2.run(PersistenceUnitServiceImpl.java:239)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      at java.lang.Thread.run(Thread.java:745)

      at org.jboss.threads.JBossThread.run(JBossThread.java:320)

      Caused by: java.lang.IllegalStateException

      at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47)

      at org.jboss.as.naming.service.DefaultNamespaceContextSelectorService$1.getContext(DefaultNamespaceContextSelectorService.java:56)

      at org.jboss.as.naming.InitialContext$DefaultInitialContext.findContext(InitialContext.java:187)

      at org.jboss.as.naming.InitialContext$DefaultInitialContext.unbind(InitialContext.java:278)

      at javax.naming.InitialContext.unbind(InitialContext.java:439)

      at javax.naming.InitialContext.unbind(InitialContext.java:439)

      at org.hibernate.engine.jndi.internal.JndiServiceImpl.unbind(JndiServiceImpl.java:227)

      ... 11 more

       

      My persistence.xml file is given below.

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

        <persistence-unit name="InterfaceServerPU" transaction-type="JTA">

           <description>Interface Server JPA application</description>

          <jta-data-source>java:jboss/MSSQLDS</jta-data-source>

          <shared-cache-mode>ALL</shared-cache-mode>

          <properties>

            <property name="hibernate.cache.use_second_level_cache" value="true"/>

            <property name="hibernate.session_factory_name" value="java:jboss/SessionFactory"/>

            <property name="hibernate.session_factory_name_is_jndi" value="true"/>

            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

            <property name="hibernate.show_sql" value="false"/>

          </properties>

        </persistence-unit>

      </persistence>

       

      Could anyone help me in resolving this warning message? Thanks in advance.