-->
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.  [ 14 posts ] 
Author Message
 Post subject: Proxool problem with Hibernate 2.1.4
PostPosted: Fri Jun 04, 2004 1:50 pm 
Newbie

Joined: Mon Sep 29, 2003 5:56 am
Posts: 10
Location: Belgrade, Serbia
After uprgrading my applications with Hibernate 2.1.4, Proxool connection pool does not work. I use XML configuration file and after strarting application I am getting error that connection url is null. I had no problems with Hibernate 2.1.3 and when I put hibernate2.jar file from 2.1.3 version everything works OK.
Was there some changes regarding to Proxool connection pool provider in Hibernate 2.1.4?

Dejan


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 1:54 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
on release note you can see
Quote:
* improved Proxool integration, better property handling



have you upgraded all jars?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 4:41 am 
Newbie

Joined: Mon Sep 29, 2003 5:56 am
Posts: 10
Location: Belgrade, Serbia
I am pretty sure I have upgraded all jars. In fact, as I could see proxool.jar is the same. Only hibernate2.jar is different.

I have debugged ProxoolConnectionProvider class and as I could see in 2.1.3, if proxool properties could not be found then hibernate properties would be used for configuring Proxool. Since I don't use separate proxool configuration (all is done in hibernate.cfg.xml) I guess Hibernate 2.1.3 would use proxool properties defined in hibernate config file. There is a method extractProxoolProperties which is called to get those properties from configure() method.

In Hibernate 2.1.4, there is still method extractProxoolProperties() but it is never called. So if I understood this correctly, proxool properties from hibernate files are not used for Proxool configuration and that's why I am getting error.

Is this a bug or is it left by intention? Am I required to use separate proxool configuration?

Here is my hibernate configuration file:

Code:
<?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>

    <!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory >

        <!-- properties -->

        <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
        <property name="show_sql">false</property>
      <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
      <property name="connection.username">webinfo</property>
      <property name="connection.password">desig6</property>      
      <property name="connection.url">jdbc:oracle:thin:@10.16.64.14:1521:orc1</property>
      
      <property name="connection.provider_class">net.sf.hibernate.connection.ProxoolConnectionProvider</property>
      
      <property name="cglib.use_reflection_optimizer">true</property>
      
      <property name="cache.provider_class">net.sf.ehcache.hibernate.Provider</property>
      <property name="cache.use_query_cache">true</property>
   
      <property name="use_outer_join">false</property>
      
      <property name="proxool.maximum-connection-count">5</property>
      <property name="proxool.minimum-connection-count">3</property>
      <property name="proxool.test-before-use">10s,15m</property>      
      
      <!--
      <property name="c3p0.max_size">5</property>
      <property name="c3p0.min_size">3</property>
      <property name="c3p0.statistics">900</property>
      <property name="c3p0.max_statements">100</property>
      -->

   
   
        <!-- mapping files -->
        <mapping resource="Application.hbm.xml"/>
        <mapping resource="Entity.hbm.xml"/>
        <mapping resource="Description.hbm.xml"/>
        <mapping resource="Attribute.hbm.xml"/>
        <mapping resource="Relationship.hbm.xml"/>       
        <mapping resource="Table.hbm.xml"/>
        <mapping resource="View.hbm.xml"/>       
        <mapping resource="Column.hbm.xml"/>
        <mapping resource="Domain.hbm.xml"/>
        <mapping resource="Function.hbm.xml"/>
        <mapping resource="Module.hbm.xml"/>         
        <mapping resource="Term.hbm.xml"/>         

    </session-factory>

</hibernate-configuration>


And here is error I got when I use Hibernate 2.1.4. Remeber, there is no such error with Hibernate 2.1.3:
Code:
...
(cfg.SettingsFactory                 62  ) Use outer join fetching: false
(connection.ConnectionProviderFactory 53  ) Initializing connection provider: net.sf.hibernate.connection.ProxoolConnectionProvider
(transaction.TransactionManagerLookupFactory 33  ) No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
(cfg.SettingsFactory                 95  ) Could not obtain connection metadata
java.sql.SQLException: The url cannot be null
   at java.sql.DriverManager.getConnection(DriverManager.java:489)
   at java.sql.DriverManager.getConnection(DriverManager.java:193)
   at net.sf.hibernate.connection.ProxoolConnectionProvider.getConnection(ProxoolConnectionProvider.java:55)
   at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
   at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
   at yu.nbs.metadata.persistence.HibernateSession.configureSessionFactory(HibernateSession.java:83)
   at yu.nbs.metadata.persistence.HibernateSession.getSessionFactory(HibernateSession.java:65)
   at yu.nbs.metadata.persistence.HibernateSession.getCurrentSession(HibernateSession.java:45)
   at yu.nbs.metadata.persistence.BaseDAO.getSession(BaseDAO.java:231)
   at yu.nbs.metadata.persistence.BaseDAO.retrieveObj(BaseDAO.java:78)
   at yu.nbs.metadata.persistence.ApplicationDAO.getApplication(ApplicationDAO.java:25)
   at yu.nbs.metadata.persistence.ApplicationDAOTest.testGetApplication(ApplicationDAOTest.java:36)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
(cfg.SettingsFactory                 102 ) Use scrollable result sets: false
(cfg.SettingsFactory                 105 ) Use JDBC3 getGeneratedKeys(): false
...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 9:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Configuration of proxool from hibernate.properties is no longer supported and never really worked properly anyway. Specify the dirver in proxool.xml, as per the proxool docs.

http://proxool.sourceforge.net/configure.html


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 11:11 am 
Newbie

Joined: Mon Sep 29, 2003 5:56 am
Posts: 10
Location: Belgrade, Serbia
Thanks Gavin. Does it mean I have to use file on the file system, not on the classpath? Reading proxool documentation and ProxoolConnectionProvider source code I got that impression.

Dejan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 2:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
yes, this is a misfeature of proxool IMO


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 5:45 pm 
Newbie

Joined: Mon Sep 29, 2003 5:56 am
Posts: 10
Location: Belgrade, Serbia
Gavin, as I could see (http://proxool.sourceforge.net/api/org/logicalcobwebs/proxool/configuration/JAXPConfigurator.html), passing filepath is just one way to configure proxool. How about using other methods? Passing Reader or InputStream objects?

I would really like to continue using proxool, since it performed much better for our application than DBCP or C3P0. I don't like the idea of relying on file system for reading configuration file.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 6:31 am 
Regular
Regular

Joined: Tue Oct 07, 2003 1:13 pm
Posts: 70
Location: Paris, France
I've got the same problem, and I wonder if the correct (ugly) solution is not to patch the proxool version with a lookup in the classpath .... :-(
I can't rely on the file system.
Richarfd.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 7:22 am 
Regular
Regular

Joined: Tue Oct 07, 2003 1:13 pm
Posts: 70
Location: Paris, France
I've done it, it works like a charm. Tell me if you want the patched proxool.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 11, 2004 3:29 am 
Newbie

Joined: Thu Oct 23, 2003 3:33 am
Posts: 5
Location: Kharkov, Ukraine
Proxool configuration can be read from classpath - you should use slightly tweaked version of net.sf.hibernate.connection.ProxoolConnectionProvider.
For version 2.1.4 just replace two lines that actually load config:

Code:
JAXPConfigurator.configure(jaxpFile, false);

to something like
Code:
JAXPConfigurator.configure(new java.io.InputStreamReader(getClass().getClassLoader().getResourceAsStream(jaxpFile)), false);

and
Code:
PropertyConfigurator.configure(propFile);

to something like
Code:
Properties aprops = new Properties();
aprops.load((getClass().getClassLoader().getResourceAsStream(propFile)));
PropertyConfigurator.configure(aprops);


Probably this should go in to hibernate codebase (with some option added - from where to load file - from filesystem or classpath).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 3:48 am 
Newbie

Joined: Fri Jun 25, 2004 3:29 am
Posts: 1
Location: Oslo, Norway
Thanks for the tip!
One needed bugfix in your suggestion:
Code:
JAXPConfigurator.configure(new java.io.InputStreamReader(getClass().getClassLoader().getResourceAsStream(jaxpFile)), false);


fails, possibly due to jaxpFile being a String not a File...?
May I suggest:
Code:
JAXPConfigurator.configure(this.getClass().getClassLoader().getResource(jaxpFile).getFile(), false);

i.e. fetching the full filename through the URL given by getResource().

This solution require proxool.xml or whatever you chose to call your hibernate-proxool configuration file, in your classpath. I have not tested usage of hibernate.properties, but suspect there is a need for a similer fix in your suggestion there too.

Does anyone know the motivation for requiring full path for ProxoolConnectionProvider.configure(..)?

Note: this error existed in hibernate 2.1.4...

_________________
Dag


Top
 Profile  
 
 Post subject: HB-987, Proxool problem with Hibernate 2.1.4
PostPosted: Fri Jun 25, 2004 9:10 am 
Newbie

Joined: Thu Jun 24, 2004 7:33 pm
Posts: 3
Location: US ATL GA
Shouldn't HB-987 been reopen?
I updated hibernate thinking is was fixed.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 12:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The original bug was fixed.

If anyone has any additional patches that they would like integrated into the Hibernate core, they need to submit to JIRA as a new "improvement" issue.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 1:23 pm 
Newbie

Joined: Thu Oct 23, 2003 3:33 am
Posts: 5
Location: Kharkov, Ukraine
Created
http://opensource.atlassian.com/projects/hibernate/browse/HBI-40


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