3 Replies Latest reply on Feb 1, 2006 1:19 PM by Tobias Adamson

    EntityManagerFactory not found

    Tobias Adamson Newbie

      Hi
      I would appreciate some help as I can't solve this.
      I've got a test application started running with Tomcat and the embedded ejb container.
      I've now trie to add my own persitance context and constantly get the EntityManagerFactory not found exception even though I can see the managed contexts being deployed.
      The code is the registration example and the seam build is from yesterday

      My settings are as the following

      persistence.xml

      <persistence>
       <persistence-unit name="testDatabase">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/testDatasource</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <property name="hibernate.transaction.flush_before_completion" value="true"/>
       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/testDatabase"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      seam.properties
      org.jboss.seam.core.init.managedPersistenceContexts testDatabase
      testDatabase.persistenceUnitJndiName java:/EntityManagerFactories/testData
      


      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="testDatasourceBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
       <property name="driverClass">com.mysql.jdbc.Driver</property>
       <property name="connectionURL">jdbc:mysql://localhost:3306/test?autoReconnect=true</property>
       <property name="userName">test</property>
       <property name="password">test</property>
       <property name="jndiName">java:/testDatasource</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>
       <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
       <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
       </bean>
      
       <bean name="testDatasource" class="java.lang.Object">
       <constructor factoryMethod="getDatasource">
       <factory bean="testDatasourceBootstrap"/>
       </constructor>
       </bean>
      
      </deployment>
      


      RegisterAction.java

       @In(create=true)
       private EntityManager testDatabase;
      


      and the tomcat startup log

      INFO 01-02 16:52:10,359 (Component.java:<init>:168) -Component: org.jboss.seam.core.ejb, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Ejb
      INFO 01-02 16:52:10,375 (Component.java:<init>:168) -Component: testDatabase, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.ManagedPersistenceContext
      INFO 01-02 16:52:10,390 (Scanner.java:getClasses:75) -scanning: C:\dev\projects\seamtest\build\web\WEB-INF\classes
      INFO 01-02 16:52:10,453 (Component.java:<init>:168) -Component: register, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: org.jboss.seam.example.registration.RegisterAction, JNDI: RegisterAction/local
      INFO 01-02 16:52:10,500 (Component.java:<init>:168) -Component: user, scope: SESSION, type: ENTITY_BEAN, class: org.jboss.seam.example.registration.User
      INFO 01-02 16:52:10,500 (Ejb.java:startup:40) -starting the embedded EJB container
      INFO 01-02 16:52:11,468 (LocalTxDataSource.java:bindConnectionFactory:117) -Bound datasource to JNDI name 'java:/DefaultDS'
      INFO 01-02 16:52:12,031 (LocalTxDataSource.java:bindConnectionFactory:117) -Bound datasource to JNDI name 'java:/testDatasource'
      



      Thank you for any help
      /Tobias