-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Websphere EntityManagerFactory creation problem
PostPosted: Tue Nov 18, 2008 5:31 am 
Newbie

Joined: Tue Nov 11, 2008 9:54 am
Posts: 6
Hello,

I am assigned a decision analysis resolution task for a new project in my company. I am evaluating Websphere Application Server v7.0 with Hibernate as JPA provider, and having some integration troubles.

Websphere cannot create an EntityManagerFactory and gives the following error.

Code:
CWWJP0009E: The server cannot create an EntityManagerFactory factory for the Frameworks persistent unit from the org.hibernate.ejb.HibernatePersistence provider in file:/C:/Documents and Settings/burak/IBM/rationalsdp/workspace/Frameworks/ejbModule/ module.


I found out that there are other people having exactly the same problem but I am not sure whether the source of the problem is a mistake by me, a bug in Websphere or Hibernate. Also you can check this post: http://groups.google.com/group/ibm.soft ... 0?lnk=raot

I have configured my persistence.xml as follows:

Code:
<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="Frameworks">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>jdbc/OracleJDBCDriverXADataSource</jta-data-source>
       <class>gov.tubitak.frameworks.domain.Framework</class>
       <exclude-unlisted-classes>true</exclude-unlisted-classes>
       <properties>
         <property name="hibernate.dialect"
            value="org.hibernate.dialect.Oracle9Dialect"/>
      </properties>
   </persistence-unit>
</persistence>


And I have added the hibernate core, annotations and entitymanager jars to my EAR project.

Because of this problem EntityManager injection fails:

Code:
@PersistenceContext private EntityManager entityManager;


Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 7:28 am 
Newbie

Joined: Tue Nov 11, 2008 9:54 am
Posts: 6
btw i have managed to integrate the latest openjpa implementation the sam way. i have checked it out from its svn repo and it works fine with websphere.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 13, 2009 7:54 am 
Newbie

Joined: Fri Feb 13, 2009 7:32 am
Posts: 1
Hi.

Hope this helps yet.
I had the same problem (using WAS 6.1 level 6.0.21 and EJB 3 FP) and after investigate a little I´ve found at FFDC log:

Code:
------Start of DE processing------ = [13/02/09 08:58:21:160 BRST] , key = java.lang.NullPointerException com.ibm.ws.jpa.management.JPAPUnitInfo.getFactory 773
Exception = java.lang.NullPointerException
Source = com.ibm.ws.jpa.management.JPAPUnitInfo.getFactory
probeid = 773
Stack Dump = java.lang.NullPointerException
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:114)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
   at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
   at com.ibm.ws.jpa.management.JPAPUnitInfo.getFactory(JPAPUnitInfo.java:1191)
   at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:348)
   at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:140)
   at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApplInfo.java:169)
   at com.ibm.ws.jpa.management.JPAComponentImpl.startingDeployedModule(JPAComponentImpl.java:780)
   at com.ibm.ws.jpa.management.JPAComponentImpl.stateChanged(JPAComponentImpl.java:646)
   at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1258)
   at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1148)
   at com.ibm.ws.runtime.component.DeployedModuleImpl.setState(DeployedModuleImpl.java:214)
   at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:584)
   at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:832)
   at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:952)
   at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2166)
   at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

Dump of callerThis =
Object type = com.ibm.ws.jpa.management.JPAPUnitInfo
com.ibm.ws.jpa.management.JPAPUnitInfo@2f102f10

Exception = java.lang.NullPointerException
Source = com.ibm.ws.jpa.management.JPAPUnitInfo.getFactory
probeid = 773
Dump of callerThis =
Object type = com.ibm.ws.jpa.management.JPAPUnitInfo
com.ibm.ws.jpa.management.JPAPUnitInfo@2f102f10




So I get the source of the class "SettingsFactory" and there I found (lines 113 and 114):
Code:
108: boolean useJdbcMetadata = PropertiesHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", props, true );
109:  if ( useJdbcMetadata ) {
110:        try {
111:             Connection conn = connections.getConnection();
112:              try {
113:                        DatabaseMetaData meta = conn.getMetaData();
114:                        databaseName = meta.getDatabaseProductName();


Somehow conn.getMetaData() is returning null, and then we have our NullPointerException indicated at the FFDC log.

To fix this, just include in your persistence.xml the property "hibernate.temp.use_jdbc_metadata_defaults" with value "false".


Bye!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.