• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems related to Hibernate in Websphere 5.1

 
prashanth nagaraj
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to deploy an ear file ( developed on JBoss) on Websphere 5.1
appserver. I have to use this latest version of 5.1 since the application
uses jdk1.4.1 apis.
The application uses hibernate for data access. I have successfully deployed
the appication on Weblogic 8.1 appserver. Currently when I try deploying on
Websphere appserver, I am getting some problems. I have given below the
details, pls go through and suggest me some solutions. This error has become
ShowStopper, the application server shuts down whenever it encounters this
error.

I wanted to create hibernate session. For creating session, since I need an
instance of hibernate Session Factory, I am using the below code for
creating the instance of SessionFactory. I am getting an error while
creating the instance of Session Factory itself.
net.sf.hibernate.cfg.Configuration config= new
net.sf.hibernate.cfg.Configuration();
config.setProperty("hibernate.transaction.manager_lookup_class","net.sf.hibe
rnate.transaction.WebsphereTransactionManagerLookup");
config.setProperty("hibernate.connection.provider_class","net.sf.hibernate.c
onnection.DatasourceConnectionProvider");
config.setProperty("hibernate.connection.datasource","jdbc/DataSourceName")
config.setProperty("hibernate.show_sql","false");
config.setProperty("hibernate.dialect","net.sf.hibernate.dialect.MicrosoftSQ
LServerDialect");
After this I am adding some of my user defined classes (actually java beans)
using config.addClass() method.
net.sf.hibernate.Session session =
config.buildSessionFactory().openSession(new ClassY())
//this classY implements net.sf.hibernate.Interceptor.

I am getting an ClassNotFoundException error. I am getting this error
inspite of adding hibernate2.jar in the classpath(I did copy the same jar
file under appserver/lib folder also). I did modify the ws.ext.dirs
classpath to include the jar file.
I have pasted the error below . Please let me know what could be the
problem. If possible, please suggest some alternate approach to fix this
problem. Also, if you know any examples of Hibernate implementation for
latest websphere appserver, please let me know. When I deploy the same
code on Weblogic by using WeblogicTransactionManagerLookup instead of
WebsphereTransactionManagerLookup, I did not get any error.
Internally, Hibernate Api (inside ReflectHelper of net.sf.hibernate.util
package) uses the below code for getting an instance of
WebsphereTransactionManagerLookup.
Class cls= Thread.currentThread().getContextClassLoader().loadClass(name);
name is string variable of value
"net.sf.hibernate.transaction.WebsphereTransactionManagerLookup";
I am not sure whether this is the problem with the class loader. Let me
whether any explicit settings need to be done for this.
[12/19/03 22:17:18:088 IST] 2aa310e4 TransactionMa I
net.sf.hibernate.transaction.TransactionManagerLookupFactory instantiating
TransactionManagerLookup:
net.sf.hibernate.transaction.WebsphereTransactionManagerLookup
[12/19/03 22:17:18:108 IST] 2aa310e4 TransactionMa E
net.sf.hibernate.transaction.TransactionManagerLookupFactory Could not
instantiate TransactionManagerLookup
[12/19/03 22:17:18:158 IST] 2aa310e4 TransactionMa E
net.sf.hibernate.transaction.TransactionManagerLookupFactory TRAS0014I: The
following exception was logged java.lang.ClassNotFoundException:
net.sf.hibernate.transaction.WebsphereTransactionManagerLookup
at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled
Code))
at
com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java(Compiled
Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at
net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:73)
at
net.sf.hibernate.transaction.TransactionManagerLookupFactory.getTransactionM
anagerLookup(TransactionManagerLookupFactory.java:41)
at
net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:66)
at
net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1023)
at
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:71
6)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic