I am having problems deploying a Java EE 6 application on JBoss 6. The startup process works fine until after the persistence unit is bound to its JNDI name. The DB connection has been established.
Then I get an error, saying
2012-01-26 13:29:31,451 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Create: name=jboss.j2ee:jar=Content_Hub.war,name=AgofResource,service=EJB3 state=Configured: java.lang.IllegalArgumentException: EntityManagerFactory cannot be null
Can anyone provide a clue, what might cause this error?
Update:
Here is my persistence.xml:
<persistence-unit name="cmsPU" transaction-type="JTA">
<jta-data-source>java:/tteamdb</jta-data-source>
<class>xxxx.entity.AgofEntry</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
<property name="hibernate.connection.url" value="xxxx" />
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
<!-- user/pass for DB , too-->
</properties>
</persistence-unit>
Data source is also configured in JBoss.
I tried to add a components.xml, but that does not seem to affect the error in any way:
<components xmlns="http://jboss.com/products/seam/components" xmlns:persistence="http://jboss.com/products/seam/persistence">
<persistence:entity-manager-factory name="entityManagerFactory" persistence-unit-name="cmsPU" />
<persistence:managed-persistence-context name="em" auto-create="true" entity-manager-factory="#{entityManagerFactory}" />
</components>
I am actually not using an EntityManagerFactory anywhere. Just a plain EntityManager like this:
@PersistenceContext(unitName = "cmsPU")
private EntityManager em;
The problem occurred only in the particular installation of JBoss. Worked fine with a local install. I’ll post a comment should I ever find the reason for the error.