-->
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.  [ 1 post ] 
Author Message
 Post subject: Problems with Hibernate on WebSphere 7.0
PostPosted: Fri Jan 30, 2009 5:40 pm 
Newbie

Joined: Fri Jan 30, 2009 4:58 pm
Posts: 6
I'm trying to port an application from JBossAS 4.2 to WebSphere 7.0 (fix pack 1).

While my application (EAR with JAR containing entities and persistence.xml) is initializing Hibernate I see the following exception in my log:

...
30.1.09 12:44:47:921 CET 0000000a SessionFactor I org.hibernate.impl.SessionFactoryObjectFactory addInstance Factory name: java:/hibernate/MySessionFactory
30.1.09 12:44:47:937 CET 0000000a NamingHelper I org.hibernate.util.NamingHelper getInitialContext JNDI InitialContext properties:{}
30.1.09 12:44:47:937 CET 0000000a javaURLContex E NMSV0310E: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. Exception stack trace:
javax.naming.ConfigurationException
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaul tJavaNS(javaURLContextImpl.java:420)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:398) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154) at org.hibernate.util.NamingHelper.bind(NamingHelper.java:59)
at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObject Factory.java:90)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:306)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration .java:713)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(Hibe rnatePersistence.java:127)
at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1451)< br /> at com.ibm.ws.jpa.management.JPAPUnitInfo.createEntityManagerFactory(JPAPUnitInfo. java:1292)
at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java: 393)
...
Caused by: javax.naming.NameNotFoundException: Name "hibernate" not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1178)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:394) ... 29 more

My persistence.xml looks like this:

<persistence ...>
<persistence-unit name="MyUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:MyDS</jta-data-source>
<properties>
<property name="hibernate.session_factory_name" value="java:/hibernate/MySessionFactory"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>

<!-- WebSphere transaction manager lookup class -->
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
</properties>
</persistence-unit>
</persistence>

In ISC admin I have defined a DataSource with JNDI name=java:MyDS. On the DataSource I have configured credentials through the link JAAS - J2C authentication data. I have tested that the connection works properly. I can also see that the SchemaUpdate actually hits the database. JNDI registration of the session factory somehow fails, though, with the exception above.

Any suggestions would be greatly appreciated.

Regards,
Magnus


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

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.