0 Replies Latest reply on Jun 19, 2013 7:49 AM by anir post

    java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI

    anir post Newbie

      Currently I am migrating an seam 2.2 application from jboss as 6.1 to 7.2. The ear was migrated but i can't connect the datasource with EntityManagerFactory.It's giving an error :java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI.

       

      DataSource in stanalone.xml is :

      ==============================================================================

      <subsystem xmlns="urn:jboss:domain:datasources:1.1">

                  <datasources>

                      <datasource jta="true" jndi-name="java:jboss/datasources/eformappDatasource" pool-name="eformappDatasource" enabled="true" use-java-context="true">

                          <connection-url>jdbc:postgresql://192.168.200.65:5432/ssdgwb;DB_CLOSE_DELAY=-1</connection-url>

                          <driver>org.postgresql</driver>

                          <security>

                              <user-name>ssdgwb</user-name>

                              <password>ssdgwb</password>

                          </security>

                      </datasource>

                      <drivers>

                          <driver name="org.postgresql" module="org.postgresql">

                              <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>

                          </driver>

                      </drivers>

                  </datasources>

              </subsystem>

      ==============================================================================

      Persistence.xml looks like :

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

      <!-- Persistence deployment descriptor for dev profile -->

      <persistence:persistence version="2.0" xmlns:persistence="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">

                  

         <persistence-unit name="eformapp">

            <provider>org.hibernate.ejb.HibernatePersistence</provider>

            <jta-data-source>java:jboss/datasources/eformappDatasource</jta-data-source>

            <!--  <jta-data-source>eformappDatasource</jta-data-source> -->

            <!-- The <jar-file> element is necessary if you put the persistence.xml in the WAR and the classes in the JAR -->

            <!--

            <jar-file>../../vehicles.jar</jar-file>

            -->

            <properties>

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

               <property name="hibernate.hbm2ddl.auto" value="none"/>

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

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

                          

              <!--  <property name="hibernate.default_catalog" value="ssdgap"/>

               <property name="hibernate.default_schema" value="ssdgap"/> -->

               <!-- <property name="jboss.entity.manager.jndi.name" value="java:/entityManager" /> -->

               <property name="jboss.entity.manager.factory.jndi.name" value="java:/eformappEntityManagerFactory"/>

               <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/>

               <property name="net.sf.ehcache.configurationResourceName" value="WEB-INF/ehcache.xml"/>

            </properties>

         </persistence-unit>

      </persistence>

      =================================================================================

      components.xml looks like:

       

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

      <components xmlns="http://jboss.com/products/seam/components"

      xmlns:core="http://jboss.com/products/seam/core"

      xmlns:drools="http://jboss.com/products/seam/drools"

      xmlns:mail="http://jboss.com/products/seam/mail"

      xmlns:persistence="http://jboss.com/products/seam/persistence"

      xmlns:security="http://jboss.com/products/seam/security"

      xmlns:web="http://jboss.com/products/seam/web"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd

      http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd

      http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd

      http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd

      http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd

      http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd 

      http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd 

      http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd

      http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.2.xsd">

      <!--  <core:init debug="true" jndi-pattern="@jndiPattern@"/> -->

       

      <core:init jndi-pattern="java:global/eformsap.jar/#{ejbName}" debug="true" distributable="false"/>

       

      <core:manager concurrent-request-timeout="500"

        conversation-id-parameter="cid" conversation-timeout="120000" parent-conversation-id-parameter="pid"/>

      <!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->

      <web:hot-deploy-filter url-pattern="*.seam"/>

      <persistence:managed-persistence-context auto-create="true"

        name="entityManager" persistence-unit-jndi-name="java:app/eformappEntityManagerFactory"/>

       

       

       

         <persistence:managed-persistence-context name="centralAppManager" auto-create="true"

                            persistence-unit-jndi-name="java:global/centralappEntityManagerFactory"/>

                           

      <drools:rule-base name="securityRules">

            <drools:rule-files>

               <value>/security.drl</value>

            </drools:rule-files>

         </drools:rule-base>

       

       

         <security:rule-based-permission-resolver security-rules="#{securityRules}"/>

       

       

         <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>

      <event type="org.jboss.seam.security.notLoggedIn">

        <action execute="#{redirect.captureCurrentView}"/>

      </event>

      <event type="org.jboss.seam.security.loginSuccessful">

        <action execute="#{redirect.returnToCapturedView}"/>

      </event>

      <mail:mail-session host="localhost" port="25"/>

      <component name="org.jboss.seam.web.MultipartFilter">

        <property name="createTempFiles">true</property>

        <property name="maxRequestSize">1000000</property>

      </component>

      <!-- For use with jBPM pageflow or process management

       

       

         <bpm:jbpm>

            <bpm:process-definitions></bpm:process-definitions>

            <bpm:pageflow-definitions></bpm:pageflow-definitions>

         </bpm:jbpm>

         -->

         <component name="org.jboss.seam.web.ContextFilter">

                    <property name="disabled">false</property>

                </component>

       

                <component class="org.jboss.seam.transaction.EjbSynchronizations"

                  jndi-name="java:app/eformsap/EjbSynchronizations"/>

          <component class="org.jboss.seam.async.TimerServiceDispatcher"

                  jndi-name="java:app/eformsap/TimerServiceDispatcher"/>

      </components>

       

      I can't login into the application with error specified Error invoking login method: javax.el.ELException: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:app/eformappEntityManagerFactory.

       

       

      I have tried with java:app, java:jboss, java:global but nothing worked.