5 Replies Latest reply on Feb 11, 2009 2:58 AM by Stuart Douglas

    No object bound to name EntityManagerFactory

    Dirk Neander Newbie
      Hi,

      I've got problems getting started with Seam using seam-gen. First of all my application-stack:
      - jboss-seam-2.1.0.SP1
      - Sun Java System Application Server 9.1 Update 2 (GlassfishV2U2)
      - Oracle 10g

      What did I do:
      1) "seam setup": EAR, configured the Oracle-DB, generation from existing tables, RichFaces, Packagenames, etc. (nothing special from my point of view)
      2) "seam create-project": works as expected
      3) "seam generate": works as expected
      4) In my Eclipse i did for the generated project a "Import existing project into workspace"
      5) I executed the "deploy[default]"-target of the build.xml. The ant-log looks good.

      My first attempt to deploy the generated ear of the dist-folder into glassfish appserver failed because of
      missing ejbs in my jar-archive. in some article i found the solution in removing the entry
         <module>
            <ejb>reverse.jar</ejb>
         </module>
      of the application.xml file. After that the deployment succeeded.

      But the application will not work. When i try to open the app in my webbrowser i get the following error:
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: algDocumentList
           at org.jboss.seam.Component.newInstance(Component.java:2096)
           at org.jboss.seam.Component.getInstance(Component.java:1978)
      ...

      with cause-by-execption:
      Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/reverseEntityManagerFactory
           at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:231)
           at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)
      ...

      and another cause-by-exception:
      Caused by: javax.naming.NameNotFoundException: No object bound to name java:/reverseEntityManagerFactory
           at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:834)
           at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:218)
      ...
      (after that cropped stack)

      so obviously there is a problem trying to lookup the EntityManagerFactory, but i have no clue how to fix that.
      here's the relevant part of the generated component.xml:
      ...
         <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
         <core:manager concurrent-request-timeout="500"
                       conversation-timeout="120000"
                       conversation-id-parameter="cid"
                       parent-conversation-id-parameter="pid"/>
         <persistence:managed-persistence-context name="entityManager"
                                           auto-create="true"
                            persistence-unit-jndi-name="java:/reverseEntityManagerFactory"/>                         
         <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"/>
      ...

      i'm doing a poc for seam on glassfish and it's very important for me to get this thing running.
      i hope somebody can help me through this.

      Thanks in advance

      Dirk