-->
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: Problem running Hibernate in WebSphere
PostPosted: Mon Sep 06, 2004 9:05 am 
Newbie

Joined: Mon Sep 06, 2004 8:49 am
Posts: 7
Hi,

I am trying to use Hibernate as the OR mapping tool within WebSphere Application Server. loadParents method is a session bean method with TX attribute Required.

The data retrieval logic of session.find works fine standalone however when I add the update logic with the transaction begin and commit portion I get the exception trace attached. The config.xml is also attached for reference. Can any one provide a solution for the problem.


Hibernate version:2.1.2

Code between sessionFactory.openSession() and session.close():
public void loadParents(){
Session session = HibernateUtil.currentSession();
try {
Transaction t = session.beginTransaction();
List l = session.find(" FROM Parent p WHERE 1=1");

int parentCount = l.size();
for(int i=0; i<parentCount; i++){
Parent p = (Parent)l.get(i);
p.setMiddleName("CHG");
System.out.println("Parent: " + i+"--");
System.out.println(p);
session.update(p);
}
t.commit();
session.close();
} catch(HibernateException hibEx){
hibEx.printStackTrace();
}
}

Full stack trace of any exception that occurs:
[9/6/04 18:36:34:466 IST] 7d2ef635 SessionFactor I net.sf.hibernate.impl.SessionFactoryObjectFactory no JNDI name configured
[9/6/04 18:36:34:466 IST] 7d2ef635 WebSphereTran I net.sf.hibernate.transaction.WebSphereTransactionManagerLookup WebSphere 5.1
[9/6/04 18:36:34:937 IST] 7d2ef635 JTATransactio E net.sf.hibernate.transaction.JTATransaction Could not find UserTransaction in JNDI
[9/6/04 18:36:34:947 IST] 7d2ef635 JTATransactio E net.sf.hibernate.transaction.JTATransaction TRAS0014I: The following exception was logged javax.naming.NameNotFoundException: Name comp/UserTransaction not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1663)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1009)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:932)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1261)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:196)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:132)
at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2195)
at com.vinraj.rd.hibernate.session.CalloutBean.loadParents(CalloutBean.java:93)
at com.vinraj.rd.hibernate.session.EJSLocalStatelessCallout_2a04f665.loadParents(EJSLocalStatelessCallout_2a04f665.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:68)
at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:110)
at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:366)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
.



Name and version of the database you are using:
Oracle 8i

config.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<!--<property name="hibernate.connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="hibernate.connection.url">
jdbc:oracle:thin:@pc-p41010:1521:db
</property>
<property name="hibernate.connection.username">
LTC_REPORTAPPLICATION
</property>
<property name="hibernate.connection.password">
LTC_REPORTAPPLICATION
</property>
<property name="hibernate.default_schema">LTC_REPORT</property>-->
<property name="connection.datasource">java:comp/env/jdbc/ltcadb</property>
<property name="hibernate.connection.pool_size">20</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="jta.UserTransaction">java:comp/UserTransaction/</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">
net.sf.hibernate.transaction.JTATransactionFactory
</property>
<property name="transaction.manager_lookup_class">
net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
</property>
<property name="hibernate.cache.provider_class">
net.sf.hibernate.cache.HashtableCacheProvider
</property>
<property name="jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>
<property name="jndi.url">iiop://localhost:2809/</property>
<mapping resource="com/vinraj/rd/hibernate/model/Parent.hbm.xml" />
<mapping resource="com/vinraj/rd/hibernate/model/Child.hbm.xml" />
</session-factory>
</hibernate-configuration>


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.