2 Replies Latest reply on Jul 6, 2005 8:44 AM by elkner

    NullPointerException: factory must not be null

    elkner

       

      ...
      2005-07-05 16:17:18,883 DEBUG [ScannerThread:org.jboss.system.ServiceController:391] - starting service jboss.j2ee:service=EJB3,name=org.osc.server.ProductManager
      2005-07-05 16:17:18,884 DEBUG [ScannerThread:org.jboss.system.ServiceMBeanSupport:262] - Starting jboss.j2ee:service=EJB3,name=org.osc.server.ProductManager
      2005-07-05 16:17:18,886 DEBUG [ScannerThread:org.jboss.ejb3.tx.UserTransactionImpl:42] - new UserTx: org.jboss.ejb3.tx.UserTransactionImpl@135fb1c
      2005-07-05 16:17:18,937 DEBUG [ScannerThread:org.jboss.system.ServiceMBeanSupport:279] - Starting failed jboss.j2ee:service=EJB3,name=org.osc.server.ProductManager
      java.lang.NullPointerException: factory must not be null
       at org.jboss.ejb3.entity.InjectedEntityManager.<init>(InjectedEntityManager.java:40)
       at org.jboss.ejb3.injection.PersistenceContextHandler.bindEntityManagerToEnc(PersistenceContextHandler.java:136)
       at org.jboss.ejb3.injection.PersistenceContextHandler.loadFieldInjectors(PersistenceContextHandler.java:158)
      ...
      


      Hmmm - not sure, whether this is a bug or whether I missed something in the specs.
      Actually, I'm using a bla.par with the following persistence.xml/application.xml and
      @PersistenceContext private EntityManager manager; without a unit name in the beans.

      <?xml version="1.0" encoding="UTF-8"?>
      <entity-manager>
      <!--
       <name>OscManager</name>
      -->
       <jta-data-source>java:/OscDS</jta-data-source>
       <properties>
       <!--
       <property name="hibernate.transaction.manager_lookup_class"
       value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <property name="hibernate.query.factory_class"
       value="org.hibernate.hql.ast.ASTQueryTranslatorFactory"/>
       -->
       <property name="hibernate.dialect"
       value="org.hibernate.dialect.MySQLMyISAMDialect"/>
       <property name="hibernate.hbm2ddl.auto"
       value="update"/>
       <property name="hibernate.show_sql"
       value="false"/>
       <property name="hibernate.cglib.use_reflection_optimizer"
       value="true"/>
       <property name="hibernate.cache.provider_class"
       value="org.hibernate.cache.HashtableCacheProvider"/>
       <!-- Clustered cache with TreeCache -->
       <!--
       <property name="hibernate.cache.provider_class"
       value="=org.jboss.ejb3.entity.TreeCacheProviderHook"/>
       <property name="hibernate.treecache.mbean.object_name"
       value="jboss.cache:service=EJB3EntityTreeCache"/>
       -->
       </properties>
      </entity-manager>
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE application PUBLIC
       "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
       "http://java.sun.com/dtd/application_1_3.dtd">
      
      <application>
       <display-name>OsC</display-name>
       <module>
       <ejb>bla.par</ejb>
       </module>
       <module>
       <ejb>bla.ejb3</ejb>
       </module>
      </application>
      


      Wrt. to the specs, I would say, since @PersistenceContext has no parameter, the Interceptor should automatically assign the name "bla". And since the persistence.xml does not contain a name, the "par Reader" should automatically assign the name "bla". So since both names match, it should work IMHO. Any hints ?