-->
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.  [ 1 post ] 
Author Message
 Post subject: PSQLException (PGbox3d) after use of latest postgis.jar 115
PostPosted: Fri Nov 03, 2006 1:44 pm 
Newbie

Joined: Fri May 12, 2006 9:48 am
Posts: 14
Location: Toulouse
Hibernate version: 3.2.0 GA

Name and version of the database you are using: PostGreSQL 8.1.4 (22/05/2006)

Postgis version: 1.1.5 (14/10/2006)


Hi all,

I have a very particular problem.
Since 2 weeks, there is a new version of Postgis I want to use on top of our PostgreSQL DB server.
Since I added the new postgis.jar in the library, I am having the same error all over. (By resetting the old postgis.jar into the lib, it works !!)

I created a very simple test program to demonstrate.

So every time I am getting the exception:
The class org.postgis.PGbox3d does not implement org.postgresql.util.PGobject.

I searched all over the net and found things like:
I should replace mapping objects by:
((org.postgresql.PGConnection)connection).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.PGConnection)connection).addDataType("box3d","org.postgis.PGbox3d");

But then I read elsewhere this is already the case in the DriverWrapper classes of PostGIS.

Anyone any idea how to solve this (of course setting the old postgis.jar back is not really a 'solution') ?

TIA
Whiteman

Code
Code:

public final class Utils {

   public static Session session;

   public static Properties getProperties(boolean test) {
      
      Properties props = new Properties();
      props.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
      props.put("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
      props.put("hibernate.connection.driver_class", "org.postgresql.Driver");
      props.put("current_session_context_class", "thread");
      props.put("hibernateJdbcUseStreamsForBinary","true");
      props.put("show_sql","true");
      props.put("hibernate.connection.username", "postgres");
      props.put("hibernate.connection.password", "#######");
      if (test)
         props.put("hibernate.connection.url", "jdbc:postgresql://localhost:5432/test");
      else
         props.put("hibernate.connection.url", "jdbc:postgresql://localhost:5432/catalog");
      
      return props;
   }
}


   public static void main(String[] args) {
      logger.setLevel(Level.DEBUG);
      BasicConfigurator.configure();
      logger.info("Entering application.");
      
      Properties props = Utils.getProperties(true);

      SessionFactory sessionFactory = new AnnotationConfiguration()
      .addAnnotatedClass(Test.class)
      .addProperties(props)
      .buildSessionFactory();
      
      logger.debug("sessionFactory.openSession().................");
      session = sessionFactory.openSession();
      logger.debug("openSession() DONE....................");
      
      Transaction tx = null;
      try {
         
   
         //tx =session.beginTransaction();

         Test mytest = new Test("Tom");
         logger.debug("Saving....................");
         session.save(mytest);
         logger.debug("Saving DONE....................");
         //tx.commit();

            
      } catch (Exception ex) {
         if (null != tx) tx.rollback();
         logger.error(ex);
      }
      finally {
         session.close();
      }
   }






Full stack trace of any exception that occurs:
Code:
org.postgresql.util.PSQLException: The class org.postgis.PGbox3d does not implement org.postgresql.util.PGobject.
   at org.postgresql.jdbc2.TypeInfoCache.addDataType(TypeInfoCache.java:98)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.addDataType(AbstractJdbc2Connection.java:429)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes(AbstractJdbc2Connection.java:466)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
   at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:369)
   at org.postgresql.Driver.connect(Driver.java:245)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
   at trials.DoInsertName.main(DoInsertName.java:35)




Debug level Hibernate log excerpt:

Code:
11 [main] DEBUG org.hibernate.cfg.Configuration null - processing native query and ResultSetMapping mappings
611 [main] DEBUG org.hibernate.cfg.Configuration null - processing association property references
611 [main] DEBUG org.hibernate.cfg.Configuration null - processing foreign key constraints
641 [main] DEBUG org.hibernate.validator.ClassValidator null - ResourceBundle ValidatorMessages not found in Validator classloader. Delegate to org.hibernate.validator.resources.DefaultValidatorMessages
771 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider null - Using Hibernate built-in connection pool (not for production use!)
771 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider null - Hibernate connection pool size: 20
771 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider null - autocommit mode: false
781 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider null - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/test
781 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider null - connection properties: {user=postgres, password=thewall12}
781 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider null - opening new JDBC connection
931 [main] WARN org.hibernate.cfg.SettingsFactory null - Could not obtain connection metadata
org.postgresql.util.PSQLException: La classe class org.postgis.PGbox3d n'implémente pas org.postgresql.util.PGobject.
   at org.postgresql.jdbc2.TypeInfoCache.addDataType(TypeInfoCache.java:98)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.addDataType(AbstractJdbc2Connection.java:429)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes(AbstractJdbc2Connection.java:466)
......................


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.