Hi ,
I am getting org.hibernate.HibernateException: org.hibernate.HibernateException: Could not obtain WebSphere JTSXA instance exception.
.I am using webshpere 5.0.2 Application Server on Solaris ,but when i am using same code in WebShpere 5.0 on windows it is working fine .My hibernate version is 3.0
my hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- datasource connection properties -->
<!--<property name="connection.datasource">jdbc/iTracds</property>-->
<!-- Database Settings -->
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="hibernate.default_schema">G</property>
<property name="show_sql">true</property>
<!-- Transaction Settings -->
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereTransactionManagerLookup</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_outer_join">true</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.cglib.use_reflection_optimizer">false</property>
<mapping resource="com/dcx/itrac/domainobject/base/PrivilegeMaintence.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Role.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/RolePrivilege.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/SamAnalyst.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/UserRole.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Proxy.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Attachment.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/CatalogItem.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/CatalogItemComponent.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/CatalogItemAttachment.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Category.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/CategoryField.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Charge.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Component.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/ComponentFieldValue.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/ComponentAttachment.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/DictionaryField.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/DictionaryFieldAlias.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/FavoriteCatalogItem.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/FavoriteOrderItem.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/FavoriteOrder.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/FinancialApprover.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Format.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/IPASPO.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/IpasPoShipTo.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Order.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderApproval.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderAttachment.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderItem.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderItemAttachment.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderItemCharge.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderItemComponent.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderItemSpecialFieldValue.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/OrderText.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Person.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Release.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/Requisition.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/SpecialProcess.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/SpecialProcessField.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/SystemCode.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/SystemCodeValue.hbm"/>
<mapping resource="com/dcx/itrac/domainobject/base/KeyGen.hbm"/>
</session-factory>
</hibernate-configuration>
and code
import org.hibernate.*;
import org.hibernate.cfg.*;
import javax.naming.*;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.dcx.itrac.util.ITRACException;
import java.util.Hashtable;
/*
*
* @author dmishra1
*
* The HibernateHelper class is a utility calss which
* handles all the hibernate related stuffs.
*
*/
public class HibernateHelper
{
/*
* The default constructor
*/
public HibernateHelper()
{
}
/*
* The Logger which helps to log into the logfile.
*/
private ITRACLogger logger = new ITRACLogger(HibernateHelper.class);
/*
* The session Factory object
*/
private static SessionFactory SESSIONFACTORY;
/*
* The configuration object.
*/
private Configuration config;
/*
* The connection object
*/
private Connection connection;
public SessionFactory getFactory() throws HibernateException {
config = new Configuration();
try {
if (SESSIONFACTORY == null) {
SESSIONFACTORY =config.configure().buildSessionFactory();
//new Configuration().configure().buildSessionFactory();
logger.log("SessionFactory initialized in HibernateFactory",ITRACConstants.LOGGER_INF0);
}
} catch (HibernateException ex) {
logger.log("Initial SessionFactory creation failed.",ITRACConstants.LOGGER_INF0);
throw new HibernateException(ex);
}
return SESSIONFACTORY;
}
}
[1/11/06 11:18:07:944 EST] 26a3c3 SystemErr R org.hibernate.HibernateException: org.hibernate.HibernateException: Could not obtain WebSphere JTSXA instance
at com.dcx.itrac.util.HibernateHelper.getFactory(HibernateHelper.java:68)
at com.dcx.itrac.dao.DB2DAO.getRolePrivilegesForTheUser(DB2DAO.java:770)
at com.dcx.itrac.bo.UserBO.getRolePrivilegesForTheUser(UserBO.java:69)
at com.dcx.itrac.ejb.UserEJBBean.getRolePrivilegesForTheUser(UserEJBBean.java:85)
at com.dcx.itrac.ejb.EJSRemoteStatelessUserEJB_e49d7529.getRolePrivilegesForTheUser(Unknown Source)
at com.dcx.itrac.ejb._UserEJB_Stub.getRolePrivilegesForTheUser(_UserEJB_Stub.java:309)
at com.dcx.itrac.framework.action.LoginAction.execute(LoginAction.java:60)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
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:1073)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:598)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:206)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:80)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:214)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
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:623)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:447)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
Caused by: org.hibernate.HibernateException: Could not obtain WebSphere JTSXA instance
at org.hibernate.transaction.WebSphereTransactionManagerLookup.getTransactionManager(WebSphereTransactionManagerLookup.java:49)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:270)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
at com.dcx.itrac.util.HibernateHelper.getFactory(HibernateHelper.java:62)
... 31 more
Caused by: java.lang.ClassNotFoundException: com.ibm.ejs.jts.jta.JTSXA
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:115)
at org.hibernate.transaction.WebSphereTransactionManagerLookup.getTransactionManager(WebSphereTransactionManagerLookup.java:40)
... 34 more
please anybody can help me ...........
Regards,
Prashant Ingole
[b][/b]
|