Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Migration problem 4.1.0 to 4.1.2
PostPosted: Wed Apr 11, 2012 10:39 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Hi all

I am in the prcess of migrating a project from 3.2.5ga all the way up to 4.1.2.

Everything works just fine in 4.1.0-Final but when I attempt to move up to 4.1.2-Final, I get the classic "No suitable driver found" problem...

Code:
Caused by: java.sql.SQLException: No suitable driver found for jdbc:pervasive://127.0.0.1:1583/JS2010R2;encoding=cp1252
   at java.sql.DriverManager.getConnection(DriverManager.java:604)
   at java.sql.DriverManager.getConnection(DriverManager.java:190)
   at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:192)
   at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:278)
   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)


Given that my project works with 4.1.0-Final libraries - and that I have NOT done anything with the sql Driver, can anyone point me towards a solution?

thanks, db


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Fri Apr 13, 2012 9:32 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 988
I guess it has to do with https://hibernate.onjira.com/browse/HHH-7169


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Sat Apr 14, 2012 8:16 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Yes - I'm sure you are correct, the changes in DriverManagerConnectionProviderImpl seem to have broken my 'normal' method of loading the driver.

If I make a specific call to Class.forName("com.pervasive.jdbc.v2.Driver"); before any call to hibernate classes, then my code works.

I have to say though that there does seem to be somthing 'wrong' with the new DriverManagerConnectionProviderImpl. if I step though the code in debug, I can see that line 104 "serviceRegistry.getService( ClassLoaderService.class ).classForName( driverClassName );" is called and the name of my driver is passed in. The driver is on the classpath (confirmed this with complete certainty) but is not made available to hibernate. Further down (line 117) the new DriverManagerConnectionProviderImpl code I can see a call to Class.forName( driverClassName ); - but this is never called.

For me, 4.1.2 appears broken and I'm sure this is bound to cause real problems for other desktop application developers.


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Mon Apr 16, 2012 1:11 pm 
Beginner
Beginner

Joined: Wed Sep 03, 2003 9:31 am
Posts: 21
I had the exactly same problem after upgrade to 4.1.2, and the only two solutions where to use Class.forName or downgrade to 4.1.1.


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Mon Apr 16, 2012 2:46 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Thanks iranm

Hopefully the developers will pick up on this


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Tue Apr 17, 2012 11:59 pm 
Newbie

Joined: Tue Apr 17, 2012 11:52 pm
Posts: 1
I also experienced the same problem when migrating from 4.1.1 to 4.1.2.

I hope Hibernate developers will fix this soon.


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Wed Apr 18, 2012 9:10 pm 
Red Hat Associate
Red Hat Associate

Joined: Wed Apr 18, 2012 9:06 pm
Posts: 3
Are you using an application server? Which application server and which version? Or are you using Hibernate 4.1.2 standalone?

Scott


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Thu Apr 19, 2012 4:51 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
I'm currently debugging Hibernate standalone in a desktop application - but I also use in a webapp wher I have the same problem

I am quite certain this is NOT a classpath issue; a simple call to System.out.println(System.getProperty("java.class.path")); confirms that the required jars are on the classpath - and in any event if I make a direct call to Class.forName("com.pervasive.jdbc.v2.Driver"); before any Hibernate call, everything works just fine.

I have continued to dig into this over the last couple of days and can confirm that the PervasiveSQL driver class IS returned by the classForName(String className) method in org.hibernate.service.classloading.internal.ClassLoaderServiceImpl confirming that the driver IS on the classpath and suggesting that the driver should be available hovever, line 192:
Connection conn = DriverManager.getConnection( url, connectionProps ); in org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl fails to make a connection with the following trace:

Code:
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Could not open connection
   at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)
   at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
   at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.extractPhysicalConnection(ConnectionProxyHandler.java:82)
   at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:138)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
   at $Proxy4.prepareStatement(Unknown Source)
   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147)
   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166)
   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145)
   at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1720)
   at org.hibernate.loader.Loader.doQuery(Loader.java:828)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
   at org.hibernate.loader.Loader.doList(Loader.java:2447)
   at org.hibernate.loader.Loader.doList(Loader.java:2433)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263)
   at org.hibernate.loader.Loader.list(Loader.java:2258)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:122)
   at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1589)
   at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
   at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
   at hibernatetest3.HibernateTest3.init(HibernateTest3.java:29)
   at hibernatetest3.HibernateTest3.main(HibernateTest3.java:43)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:pervasive://127.0.0.1:1583/JS2010R2
   at java.sql.DriverManager.getConnection(DriverManager.java:604)
   at java.sql.DriverManager.getConnection(DriverManager.java:190)
   at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:192)
   at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:278)
   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
   ... 21 more
Java Result: 1


db


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Thu Apr 19, 2012 8:52 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
sorry - should have added.. wepapp runs under tomcat 6.0.35


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Fri Apr 20, 2012 2:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1812
Location: Austin, TX
The only thing I can surmise is that these drivers are not following the JDBC Driver contract requirement that:
Quote:
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager.


As confirmed by bolsover,
Quote:
I have continued to dig into this over the last couple of days and can confirm that the PervasiveSQL driver class IS returned by the classForName(String className) method in org.hibernate.service.classloading.internal.ClassLoaderServiceImpl confirming that the driver IS on the classpath and suggesting that the driver should be available hovever


So Hibernate found the Driver class. It loaded the Driver class. We know from the JDBC requiremnet that loading the Driver class should have caused the Driver to register itself with the DriverManager; yet this, for whatever reason did not seem to happen. So the question seems to be... why not? Why did the Driver not register itself with thwe DriverManager?


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Fri Apr 20, 2012 2:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1812
Location: Austin, TX
Also, I do have to point out that y'all do realize you are using a class explicitly documented to be not supported right?


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Sun Apr 22, 2012 7:04 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
steve wrote:
The only thing I can surmise is that these drivers are not following the JDBC Driver contract requirement that:
Quote:
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager.


As confirmed by bolsover,
Quote:
I have continued to dig into this over the last couple of days and can confirm that the PervasiveSQL driver class IS returned by the classForName(String className) method in org.hibernate.service.classloading.internal.ClassLoaderServiceImpl confirming that the driver IS on the classpath and suggesting that the driver should be available hovever


So Hibernate found the Driver class. It loaded the Driver class. We know from the JDBC requiremnet that loading the Driver class should have caused the Driver to register itself with the DriverManager; yet this, for whatever reason did not seem to happen. So the question seems to be... why not? Why did the Driver not register itself with thwe DriverManager?


I guess it is possible that the Pervasive Drivers are misbehaving in some way - but others here are using using MySQL and Oracle. Also, how do we expain why everything works fine following a call to Class.forName("com.pervasive.jdbc.v2.Driver");?


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Sun Apr 22, 2012 7:09 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
steve wrote:
Also, I do have to point out that y'all do realize you are using a class explicitly documented to be not supported right?


Understood (reference to DriverManagerConnectionProviderImpl:96 - HHH000402: Using Hibernate built-in connection pool (not for production use!)).

But have also tested with c3p0 pool and have same issue - although the error messages differ, the underlying issue is the same.


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Sun Apr 22, 2012 7:23 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
steve wrote:
So Hibernate found the Driver class. It loaded the Driver class. We know from the JDBC requiremnet that loading the Driver class should have caused the Driver to register itself with the DriverManager; yet this, for whatever reason did not seem to happen. So the question seems to be... why not? Why did the Driver not register itself with thwe DriverManager?

[/quote]

I need to do more digging - and I'm contacting Pervasive for their take on this - but a quick look into the driver class files reveals:
Code:
private static void register() {
   try {
       DriverManager.registerDriver(new Driver());
   } catch (SQLException sqlexception) {
       /* empty */
   }
    }


Top
 Profile  
 
 Post subject: Re: Migration problem 4.1.0 to 4.1.2
PostPosted: Sun Apr 22, 2012 9:10 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Getting a bit closer on this...

Digging into the Pervasive Driver, I find that it does NOT implement the META-INF/services/java.sql.Driver file. I think that this issue alone would be enough to prevent support by the Service Provider mechanism - but I suspect there are other issues since retrofitting the pvjdbc2.jar (Driver) with the appropriate file does not solve the problem although it does alter the errors thrown out by my test routines when using the c3p0 cache manager.

I think I'll simply have to admit defeat here, contact Pervasive and see if they are willing to the driver for JDBC4.0 compliance.

My thanks to all and particularly Steve for their patience on this forum and elsewhere.

db


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

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.