5 Replies Latest reply on Apr 19, 2010 6:24 AM by shane lee

    Seam-gen and postgres 8.4 : Apparently wrong driver class specified

    Benjamin Janssens Newbie

      Hello, I try to setup a new seam project with seam-gen.


      This is my build.properties from seam-gen :



      #Generated by seam setup
      #Tue Dec 01 12:02:45 CET 2009
      hibernate.connection.password=password*0
      workspace.home=c\:/Projects/seamgen/eclipse
      hibernate.connection.dataSource_class=org.postgresql.jdbc3.Jdbc3ConnectionPool
      model.package=com.mydomain.helloseamgen.model
      driver.jar=C\:/postgresql-8.4-701.jdbc3.jar
      action.package=com.mydomain.helloseamgen.action
      test.package=com.mydomain.helloseamgen.test
      database.type=postgres
      richfaces.skin=glassX
      glassfish.domain=domain1
      hibernate.default_catalog.null=
      hibernate.default_schema=bdcschema
      database.drop=n
      project.name=helloseamgen
      hibernate.connection.username=postgres
      glassfish.home=C\:/Program Files/glassfish-v2.1
      hibernate.connection.driver_class=org.postgresql.Driver
      hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
      jboss.domain=default
      project.type=ear
      icefaces.home=
      database.exists=y
      jboss.home=c\:/jboss-4.2.3.GA
      driver.license.jar=
      hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
      hibernate.connection.url=jdbc\:postgres\://127.0.0.1\:5432/bdcdb
      icefaces=n




      And this is the error I get in JBoss 4..2.3 GA :



      12:05:09,921 INFO  [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      12:05:09,921 INFO  [InjectedDataSourceConnectionProvider] Using provided datasource
      12:05:09,937 WARN  [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgres://127.0.0.1:5432/bdcdb)
              at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:190)
              at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
              at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
              at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:575)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347)
              at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
              at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
              at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
              at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
              at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
              at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
              at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
              at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
              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:592)
              at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
              at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
              at $Proxy0.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:417)
              at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy57.start(Unknown Source)
              at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)
              at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:627)
              at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:351)
              at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
              at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
              at $Proxy0.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:417)
              at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy33.start(Unknown Source)
              at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
              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:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
              at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
              at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
              at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
              at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
              at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy34.start(Unknown Source)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
              at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy9.deploy(Unknown Source)
              at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
              at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
              at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
              at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
              at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
              at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
              at $Proxy0.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:417)
              at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy4.start(Unknown Source)
              at org.jboss.deployment.SARDeployer.start(SARDeployer.java:304)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
              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:592)
              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
              at $Proxy5.deploy(Unknown Source)
              at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
              at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
              at org.jboss.Main.boot(Main.java:200)
              at org.jboss.Main$1.run(Main.java:508)
              at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgres://127.0.0.1:5432/bdcdb
              at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:301)
              at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
              ... 158 more




      I noticed that if I put true in use-java-context from the persistence.xml file, I'm not getting this error anymore but Jboss can't bound my Datasource.


      Does anybody know what is my problem here ?

        • 2. Re: Seam-gen and postgres 8.4 : Apparently wrong driver class specified
          shane lee Newbie

          I get the same problem datasource not bound via jboss.
          Environment:
          Seam 2.2.0.GA
          jdk 1.6
          jboss 5.1.0.GA
          posgres 8.4 -- driver postgresql-8.4-701.jdbc3.jar


          Added driver in server lib directory and deployed my war.


          Summary of stacktrace is:



          Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=open18Datasource' to JNDI name 'java:open18Datasource'
          Error installing to Start: name=persistence.unit:unitName=#open18 state=Create
          javax.naming.NameNotFoundException: open18Datasource not bound
          java.lang.NullPointerException
               at org.jboss.injection.PersistenceUnitHandler.getEntityManagerFactory(PersistenceUnitHandler.java:172)



          persistence.xml is:






          <persistence-unit name="open18" transaction-type="JTA">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <jta-data-source>open18Datasource</jta-data-source>
                <properties>
                   <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                   <property name="hibernate.default_schema" value="open18"/>
                   <property name="hibernate.hbm2ddl.auto" value="update"/>
                   <property name="hibernate.show_sql" value="true"/>
                   <property name="hibernate.format_sql" value="true"/>
                   <property name="hibernate.use_sql_comments" value="true"/>
                   <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
                </properties>
          </persistence-unit>





          ds.xml is:




           <local-tx-datasource>
                <jndi-name>open18Datasource</jndi-name>
                <connection-url>jdbc:postgresql://localhost/postgres</connection-url>
                <driver-class>org.postgresql.Driver</driver-class>
                <user-name>postgres</user-name>
                <password>Buckyboy12</password>
             </local-tx-datasource>



          Has anyone else come across this or know what the solution is?



            



          • 3. Re: Seam-gen and postgres 8.4 : Apparently wrong driver class specified
            Robert  Anderson Newbie

            I'm using postgresql 8.4 without problems.


            sys-ds.xml




            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE datasources
                PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
                "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
            <datasources>
               
               <local-tx-datasource>
                  <jndi-name>sysDatasource</jndi-name>
                  <use-java-context>false</use-java-context>
                  <connection-url>jdbc:postgresql://localhost:5432/sys</connection-url>
                  <driver-class>org.postgresql.Driver</driver-class>
                  <user-name>user</user-name>
                  <password>88888</password>
               </local-tx-datasource>
                
            </datasources>




            persistence.xml




            <?xml version="1.0" encoding="UTF-8"?>
            <!-- Persistence deployment descriptor for prod profile -->
            <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
                         version="1.0">
                         
               <persistence-unit name="sys" transaction-type="JTA">
                  <provider>org.hibernate.ejb.HibernatePersistence</provider>
                  <jta-data-source>sysDatasource</jta-data-source>
                  <properties>
                     <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                     <property name="hibernate.hbm2ddl.auto" value="validate"/>
                     <property name="hibernate.jdbc.batch_size" value="20"/>
                     <!-- Only relevant if Seam is loading the persistence unit (Java SE bootstrap) -->
                     <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
                  </properties>
               </persistence-unit>
                
            </persistence>




            components.xml



            ...
               <persistence:managed-persistence-context name="entityManager" auto-create="true"
                                  persistence-unit-jndi-name="@puJndiName@"/>
            ...




            Regards,


            Robert

            • 4. Re: Seam-gen and postgres 8.4 : Apparently wrong driver class specified
              Benjamin Janssens Newbie

              Hm maybe in your ds.xml you forgot to write the port.
              By default postgres use the port 5432.




              <local-tx-datasource>
                    <jndi-name>open18Datasource</jndi-name>
                    <connection-url>jdbc:postgresql://localhost:5432/postgres</connection-url>
                    <driver-class>org.postgresql.Driver</driver-class>
                    <user-name>postgres</user-name>
                    <password>Buckyboy12</password>
                 </local-tx-datasource>



              • 5. Re: Seam-gen and postgres 8.4 : Apparently wrong driver class specified
                shane lee Newbie

                Thanks for the reply Benjamin.


                But connection url can be in three different formats:


                   


                     


                jdbc:postgresql:database
                
                      jdbc:postgresql://host/database
                
                      jdbc:postgresql://host:port/database



                This is more of a jndi issue and my datasource not binding for some reason but from checking my persistence.xml and ds.xml it should work.


                Regards,
                Shane.