1 Reply Latest reply on Sep 21, 2009 7:01 AM by Greg Pelly

    EntityManagerFactory not found in JNDI on tomcat

    Greg Pelly Newbie

      I'm upgrading an app from seam 1.2.1 to 2.1.2. I've had several issues establishing connectivity with the db and feel like I've exhausted every possible permutation but still have an issue.


      By the way the various permutations include with an embedded server but that had issues also. I've tried everything i can find on the web.


      This is the exception currently appearing in the log.


      Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/NvtDS
              at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:245)
              at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)
              at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:107)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
              at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
              at org.jboss.seam.Component.unwrap(Component.java:2275)
              at org.jboss.seam.Component.getInstance(Component.java:2041)
              at org.jboss.seam.Component.getInstance(Component.java:1983)



      components




      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:transaction="http://jboss.com/products/seam/transaction"
                  xmlns:security="http://jboss.com/products/seam/security"
                  xmlns:theme="http://jboss.com/products/seam/theme"
                  xmlns:cache="http://jboss.com/products/seam/cache"
                  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.1.xsd
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                       http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd 
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                       http://jboss.com/products/seam/theme http://jboss.com/products/seam/theme-2.1.xsd
                       http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsd
                       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
      
       <core:init debug="true"/>
       <core:manager concurrent-request-timeout="500"
        conversation-id-parameter="cid"
        conversation-timeout="120000"/>
        
      
          <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
      
      
        <persistence:managed-persistence-context name="nvtDatabase"
      auto-create="true"
      persistence-unit-jndi-name="java:/NvtDS"/> 
      
          <transaction:hibernate-transaction session="#{entityManager}"/>
      
      
        <security:rule-based-permission-resolver security-rules="#{securityRules}"/>
       <event type="org.jboss.seam.security.notLoggedIn">
        <action execute="#{pageRedirect.captureCurrentView}"/>
       </event>
       <event type="org.jboss.seam.security.loginSuccessful">
        <action execute="#{pageRedirect.returnToCapturedView}"/>
       </event>
      </components>
      




      persistence.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="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_1_0.xsd" 
                   version="1.0">
                   
         <persistence-unit name="nvtDatabase" transaction-type="JTA">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>java:/NvtDS</jta-data-source>
      <property name="jboss.entity.manager.factory.jndi.name" value="java:/NvtDS"/>
      



      jboss-beans.xml




      <?xml version="1.0" encoding="UTF-8"?>
      
      <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
                  xmlns="urn:jboss:bean-deployer">
                  
        <bean name="Naming" class="org.jnp.server.SingletonNamingServer"/>
      
        <bean name="TransactionManagerFactory" 
          class="org.jboss.seam.microcontainer.TransactionManagerFactory"/>
          
        <bean name="TransactionManager" class="java.lang.Object">
          <constructor factoryMethod="getTransactionManager">
            <factory bean="TransactionManagerFactory"/>
          </constructor>
        </bean>
      
        <bean name="nvtDatasourceFactory" class="org.jboss.seam.microcontainer.DataSourceFactory">
          <property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
          <!-- <property name="connectionUrl">jdbc:oracle:thin:@merlin.nre.vic.gov.au:1521:spatial</property>-->
          <!-- <property name="userName">nativevegapp</property>-->
          <!-- <property name="password">natvegeapp</property>-->
          <property name="connectionUrl">jdbc:oracle:thin:@localhost:1521:xe</property>
          <property name="userName">nativeveg</property>
          <property name="password">nativeveg</property>
          <property name="jndiName">java:/NvtDS</property>
          <property name="minSize">0</property>
          <property name="maxSize">10</property>
          <property name="blockingTimeout">1000</property>
          <property name="idleTimeout">100000</property>
          <property name="transactionManager">
            <inject bean="TransactionManager"/>
          </property>
        </bean>
        <bean name="nvtDatasource" class="java.lang.Object">
          <constructor factoryMethod="getDataSource">
            <factory bean="nvtDatasourceFactory"/>
          </constructor>
        </bean>
        
          <bean name="limsDatasourceFactory" 
             class="org.jboss.seam.microcontainer.DataSourceFactory">
          <!--<property name="driverClass">com.sybase.jdbc2.jdbc.SybDriver</property>-->
          <!--<property name="connectionUrl">jdbc:sybase:Tds:aseproduction001:4100/lims</property>-->
          <!--<property name="userName">batch</property>-->
          <!--<property name="password">batch100</property>-->
          <property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
          <property name="connectionUrl">jdbc:oracle:thin:@localhost:1521:xe</property>
          <property name="userName">nativeveg</property>
          <property name="password">nativeveg</property>
          <property name="jndiName">java:/LimsDS</property>
          <property name="minSize">0</property>
          <property name="maxSize">10</property>
          <property name="blockingTimeout">1000</property>
          <property name="idleTimeout">100000</property>
          <property name="transactionManager">
            <inject bean="TransactionManager"/>
          </property>
        </bean>
        <bean name="limsDatasource" class="java.lang.Object">
          <constructor factoryMethod="getDataSource">
            <factory bean="limsDatasourceFactory"/>
          </constructor>
        </bean>
        
      
        <bean name="vicvisDatasourceFactory" 
             class="org.jboss.seam.microcontainer.DataSourceFactory">
          <property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
          <!--<property name="connectionUrl">jdbc:oracle:thin:@merlin.nre.vic.gov.au:1521:spatial</property>-->
          <!--<property name="userName">appn_ibisnatveg</property>-->
          <!--<property name="password">vicvis</property>-->
          <property name="connectionUrl">jdbc:oracle:thin:@localhost:1521:xe</property>
          <property name="userName">nativeveg</property>
          <property name="password">nativeveg</property>
          <property name="jndiName">java:/VicvisDS</property>
          <property name="minSize">0</property>
          <property name="maxSize">10</property>
          <property name="blockingTimeout">1000</property>
          <property name="idleTimeout">100000</property>
          <property name="transactionManager">
            <inject bean="TransactionManager"/>
          </property>
        </bean>
        <bean name="vicvisDatasource" class="java.lang.Object">
          <constructor factoryMethod="getDataSource">
            <factory bean="vicvisDatasourceFactory"/>
          </constructor>
        </bean>
      
      
              <bean name="polygonDatasourceFactory" 
             class="org.jboss.seam.microcontainer.DataSourceFactory">
                <property name="driverClass">oracle.jdbc.driver.OracleDriver</property>
          <property name="connectionUrl">jdbc:oracle:thin:@localhost:1521:xe</property>
          <property name="userName">nativeveg</property>
          <property name="password">nativeveg</property>
                <!--<property name="connectionUrl">jdbc:oracle:thin:@merlin.nre.vic.gov.au:1521:spatial</property>-->
                <!--<property name="userName">nativevegapp</property>-->
                <!--<property name="password">natvegeapp</property>-->
                <property name="jndiName">java:/PolygonDS</property>
                <property name="minSize">0</property>
                <property name="maxSize">10</property>
                <property name="blockingTimeout">1000</property>
                <property name="idleTimeout">100000</property>
                <property name="transactionManager">
            <inject bean="TransactionManager"/>
                </property>
              </bean>
              <bean name="polygonDatasource" class="java.lang.Object">
                <constructor factoryMethod="getDataSource">
            <factory bean="polygonDatasourceFactory"/>
                </constructor>
              </bean>
      
      </deployment>