1 2 Previous Next 20 Replies Latest reply on Aug 23, 2012 6:32 AM by drupalspring Go to original post
      • 15. Re: [AS 7.1 / Hibernate 4] Module classpath & DB-Drivers
        smarlow

        Sanne,

         

        It looks like there is a problem with the intended fix that went into 4.1.2.  I'm having problems logging into the Hibernate forum, could you ask them all, if they are using Hibernate standalone or which app server/version they are using.

         

        Scott

        • 16. Re: [AS 7.1 / Hibernate 4] Module classpath & DB-Drivers
          smarlow

          Now that we have a potential fix in Hibernate, could you attach a test case for "2) Native Hibernate API + hibernate.cfg.xml".

           

          That will help us to try it out. 

          • 17. Re: [AS 7.1 / Hibernate 4] Module classpath & DB-Drivers

            I also experience this issue . For some reasons , I cannot use the JBoss datasource but have to define the database connection information directly inside persistence.xml which looks likes :

             

             

            <persistence-unit name="abc" transaction-type="RESOURCE_LOCAL">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <class>com.abc.tableA</class>
                <class>com.abc.tableB</class>
                 <properties>
                      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>          
                      <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> 
                      <property name="hibernate.connection.url" value="jdbc:postgresql://127.0.0.1:5433/db" /> 
                      <property name="hibernate.connection.username" value="username"/>
                      <property name="hibernate.connection.password" value="password"/>
                </properties>
              </persistence-unit>
            

             

            I have already added the module for postresql 9.1 jdbc driver successfully and already also specified to use this postresql  's driver module  inside META-INF/MANIFEST.MF by  adding :

             

             

              Dependencies:  org.postgresql

             

             

              But it still gives me the error "No suitable driver found for jdbc:postgresql://127.0.0.1:5433/db"

             

              10:44:08,334 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-2) HHH000319: Could not get database metadata: java.sql.SQLException: No suitable driver found for jdbc:postgresql://127.0.0.1:5433/db
                  at java.sql.DriverManager.getConnection(DriverManager.java:604) [rt.jar:1.7.0_06]
                at java.sql.DriverManager.getConnection(DriverManager.java:190) [rt.jar:1.7.0_06]
                at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:193) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
                at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]   
            
            
            at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:193) [hibernate-core-4.1.6.Final.jar:4.1.6.Final
            
            at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
                at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
                at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:492) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]
            

             

            Scott Marlow said this problem  looks like to be  fixed in 4.1.2 , but you see that I already upgraded to 4.1.6 but this problem still exists.

             

            As said by the Ste Gr , it works when adding  postresql driver as a dependencies in the module.xml of the  hibernate module but I agree it is not a very nice solution too. So may  I know if this issue is fixed or not ? Any JIRA request created for this issue??

             

            Thanks

            • 18. Re: [AS 7.1 / Hibernate 4] Module classpath & DB-Drivers

              Hi Scott , I have tried out by upgrading hibernate to 4.1.6 but this problem still exist . Please see my situation about this problem in the above post. Thanks

              • 19. Re: [AS 7.1 / Hibernate 4] Module classpath & DB-Drivers
                ctomc

                Hi,

                 

                you should *really* use datasource if possible.

                 

                if that is not an option, you should edit jboss_home\modules\org\hibernate\main\module.xml and add dependancy to your jdbc driver.

                which also has to be configured as a module.

                 

                 

                --

                tomaz

                • 20. Re: [AS 7.1 / Hibernate 4] Module classpath & DB-Drivers

                  Hi Tomaz ,

                   

                  I currently use your suggested approach to add JDBC  driver dependency inside  jboss_home\modules\org\hibernate\main\module.xml .It works .

                   

                  But according to the documentation , I think adding the JDBC driver module using `Dependencies` in the META-INF/MANIFEST.MF of the WAR will also work . However , it does not . So I wonder if it is a bug of JBoss AS or Hibernate .

                   


                  1 2 Previous Next