-->
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.  [ 10 posts ] 
Author Message
 Post subject: First Time user's questions
PostPosted: Mon Nov 17, 2003 2:58 am 
Newbie

Joined: Mon Nov 17, 2003 2:43 am
Posts: 10
Hi everybody,
I apologise if this was asked/answered earlier but I wasn't able to locate the answer I needed in a search, hence this question.

I am using Oracle rel.8.1.x and was just testing a sample web-application before I start using Hibernate2 in my project. The application is hosted on Websphere 4.x. When I try to run a simple servlet I am getting the following error:
Code:
net.sf.hibernate.JDBCException: Cannot open connection: No suitable driver: No suitable driver


I do not want to connect to Oracle using URL and would be using the WAS connection pool only and myy hibernate.properties file looks like following:
Code:
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.url = jdbc/TELENEWDataSource
hibernate.connection.username = translation
hibernate.connection.password = translation
hibernate.dialect = net.sf.hibernate.dialect.OracleDialect


The abbreviated code is as follows:
Code:
try{
            Configuration cfg = new Configuration();
            cfg.addClass(Person.class);
            SessionFactory sf = cfg.buildSessionFactory();
            Session session = sf.openSession();
           
            Person person = new Person();
            person.setId(10);
            person.setName("Debashish");
            session.save(person);
            session.flush();
            session.connection().commit();
           
            out.println("done");
        }
        catch(Exception e){
            out.println("Debashish got exception:" + e);
        }


Can anybody help me by analysing what am I doing wrong? Thanks for your time.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 3:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Using the datasource which would be found using the jndi properties. eg. From the documentation:
hibernate.connection.datasource datasource JNDI name
hibernate.jndi.url URL of the JNDI provider (optional)
hibernate.jndi.class class of the JNDI InitialContextFactory (optional)
hibernate.jndi.xxxx pass the property xxxx to the JNDI InitialContextFactory (optional)
hibernate.connection.username database user (optional)
hibernate.connection.password


You properties are for settingup the connection using JDBC internal db pool.

Try the above properties instead and read the appropriate documentation.


Top
 Profile  
 
 Post subject: problem persists :(
PostPosted: Mon Nov 17, 2003 3:37 am 
Newbie

Joined: Mon Nov 17, 2003 2:43 am
Posts: 10
I changed my hibernate.properties file as follows:

Code:
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.datasource = jdbc/TELENEWDataSource
hibernate.connection.username = translation
hibernate.connection.password = translation


But now I am mgetting the following error:

Code:
net.sf.hibernate.MappingException: network subsystem has failed: no further information Nested exception: network subsystem has failed: no further information


Additional info: I am using Oracle thin driver. I am accessing WAS over the network on another machine, not mine.


Top
 Profile  
 
 Post subject: Update
PostPosted: Mon Nov 17, 2003 3:57 am 
Newbie

Joined: Mon Nov 17, 2003 2:43 am
Posts: 10
Apropos the porting document (http://hibernate.bluemars.net/68.html) I changed the DTD name to "hibernate-configuration-2.0.dtd". As a result the network-subsystem error vanished and I am back to square 1. I am now getting the same error I started with:
Code:
net.sf.hibernate.JDBCException: Cannot open connection: No suitable driver


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 4:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
In the options I showed you were the jndi configuration options so that you can use the datasource of your J2EE container - this is what I through you wanted from your first post. Try reading http://www.hibernate.org/hib_docs/reference/html/session-configuration.html#session-configuration-s2
for further configuration information. I cannot help with the JNDI URL setting etc.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 4:19 am 
Newbie

Joined: Mon Nov 17, 2003 2:43 am
Posts: 10
The property file looks like the following. Still the same error:

Code:
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.datasource = jdbc/TELENEWDataSource
hibernate.connection.username = translation
hibernate.connection.password = translation
hibernate.jndi.class = com.ibm.websphere.naming.WsnInitialContextFactory
hibernate.jndi.url iiop://192.168.1.126:900/


Top
 Profile  
 
 Post subject: Final Update
PostPosted: Mon Nov 17, 2003 5:46 am 
Newbie

Joined: Mon Nov 17, 2003 2:43 am
Posts: 10
Hibernate works well with URL based connection (properrty file given below), which is pretty straight forward, but I think the procedure to connect using JNDI name is way too complicated.

Code:
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.url = jdbc:oracle:thin:@192.168.1.100:1521:epatra
hibernate.connection.username = translation
hibernate.connection.password = translation


And there seems no good documentation available to guide one over using Hibernate say with Oracle and Webspehere, as in my case.

I also found it pretty tough to use the code mentioned in first post of this thread because there is absolutely no tutorial/beginners guide for Hibernate-2. I could find some guidance from a post from Matt Raible's blog.

Lastly there is no documentation on which jars are required to be put with the application. Hibernate2 has (apart from the hibernate2.jar file) 22 other jars (5.4 MB) in the binary distribution. Which of these do I need, as a bare minimum, is not clear.

Please don't take this as cribbing, obviously I am frustated coz I am not even able to run a basic Hibernate example with Oracle/Websphere using JNDI, I though I would use it in my project but alas I cannot convince my Proj Manager it seems.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 6:16 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Since you're using your webapp datasource, you must not set hibernate.connection.driver_class.
Are you sure of your App server DS ?

There are docs on hibernate 2.1 on the 2.1 distribution (you may need to build it via ant). For such basic stuffs, hibernate 2.0 and 2.1 work the same way AFAIK.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 6:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
I think the procedure to connect using JNDI name is way too complicated.



You have me completely confused. As per the documentation, to connect to an appserver datasource, you need to set exactly one property:


Code:
hibernate.connection.datasource my/datasource/url


How is that complicated??


Quote:
And there seems no good documentation available to guide one over using Hibernate say with Oracle and Webspehere, as in my case.


We can't possibly provide documentation of every possible combination of appserver and database, obviously. I am not aware of any other project which does this.

I developed Hibernate on WebSphere, so I know that it is quite easy to run Hibernate under WebSphere. I'm not aware of any problems with this combination.


Quote:
Lastly there is no documentation on which jars are required to be put with the application. Hibernate2 has (apart from the hibernate2.jar file) 22 other jars (5.4 MB) in the binary distribution. Which of these do I need, as a bare minimum, is not clear.


In the file lib/VERSIONS, we describe exactly what each jar is for, and which are optional. This file is sitting right next to the jar files themselves. I'm not sure how we could make this easier.


Quote:
Please don't take this as cribbing, obviously I am frustated coz I am not even able to run a basic Hibernate example with Oracle/Websphere using JNDI, I though I would use it in my project but alas I cannot convince my Proj Manager it seems.


Certainly you should not use any new technology if some minor hiccups starting out are this much of a problem for your project manager.


Top
 Profile  
 
 Post subject: Problem Solved
PostPosted: Mon Nov 17, 2003 7:11 am 
Newbie

Joined: Mon Nov 17, 2003 2:43 am
Posts: 10
It seems I hurt few sentiments, rerason why I had said that I am not cribbing. I could very well appreciate the amont of labour people put in and I have vey high respect for the Open Source community. Obviously when we are in hurry we want some quick answers.

Now good news is my problem seems solved. The property file I used is perfectly valid. We need not mention the hibernate.jndi.class and hibernate.jndi.url property probably in my case this holds true since the application is hosted on WAS.

After setting this I was still getting the following error:
Code:
net.sf.hibernate.HibernateException: Could not find datasource: com.ibm.ejs.cm.JDBC1PhaseRF


Fortunatley there was a similar disccussion here which had the solution. Any loaded jar that has the javax.sql classes obviously conflict with the WAS libraries. Such a jar (which comes with Hibernate distribution and which I had copied to my application's WEB-IBF/lib was the jdbc2_0-stdext.jar. One I removed this jar and restarted my applciation, it ran well.

Thanks everybody at Hibernate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.