Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate Connection using C3P0 and Postgresql
    primarykey
    data
    text
    <p>I am trying to get an application(jadasite) up and running using postgresql and glassfish. The app designers recommend tomcat and mysql. I can not really use tomcat and mysql for this app atm. The application uses JPA so postgresql should be no problem. The designers do mention that postgresql/many other db's should work.</p> <p>So here is what I have done Using the following two pages as a reference:</p> <p><a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html" rel="nofollow">Hibernate Docs</a></p> <p><a href="http://www.jadasite.com/forum/viewtopic.php?f=5&amp;t=75" rel="nofollow">Jadasite forums</a></p> <pre><code>jada.properties log4j.directory=/tmp hibernate.connection.password=password working.directory=/tmp encryption.key=fVOew3eAhr+hdZ9eQLeEtw\=\= hibernate.connection.url=jdbc\:postgresql:dev-rdbms.example.com:5432/jada"/&gt; hibernate.connection.driver_class=org.postgresql.drivers persistence.xml(parital) &lt;property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/&gt; &lt;property name="hibernate.connection.username" value="jada"/&gt; &lt;property name="hibernate.connection.password" value="password"/&gt; &lt;property name="hibernate.connection.url" value="jdbc:postgresql://dev-rdbms.example.com:5432/jada&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/&gt; &lt;property name="hibernate.current_session_context_class" value="thread"/&gt; &lt;property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/ </code></pre> <p>I then used mysql2psql to make a postgresql compatible db dump, loaded all data and created appropriate users with appropriate permissions and acces.(tested via psql from server glassfish runs on as well)</p> <p>So after making the changes I put the lastest postgresql jdbc 4 driver into the applications WEB-INF/lib directory. Made a new war file and deployed it to my glassfish v3.01 server.</p> <p>I get the following errors. Which appear to me to say C3P0 can not find the JDBC drivers(located in apps WEB-INF/lib directory and also in the glassfish domains lib directory)</p> <p>[#|2011-04-28T11:34:58.508-0500|SEVERE|glassfish3.0.1|</p> <pre><code>javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=11;_ThreadName=FelixStartLevel;|WebModule[/jada]JadaSite: Unable to initialize JPA connection javax.persistence.PersistenceException: [PersistenceUnit: jadaSite] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78) at com.jada.jpa.connection.JpaConnection.init(JpaConnection.java:79) at com.jada.system.Initializer.init(Initializer.java:162) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1230) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5007) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5280) at com.sun.enterprise.web.WebModule.start(WebModule.java:499) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339) at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:362) at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:185) at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174) at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87) at java.security.AccessController.doPrivileged(Native Method) at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84) at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77) at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58) at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107) at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60) at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236) at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128) at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457) at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401) at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700) at org.apache.felix.framework.Felix.startBundle(Felix.java:1622) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915) at org.jvnet.hk2.osgimain.Main.start(Main.java:140) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700) at org.apache.felix.framework.Felix.startBundle(Felix.java:1622) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) at java.lang.Thread.run(Thread.java:619) Caused by: org.hibernate.HibernateException: JDBC Driver class not found: at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:123) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137) at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) ... 45 more Caused by: java.lang.ClassNotFoundException: at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192) at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:118) ... 53 more |#] </code></pre> <p>Does anyone see anything wrong with my connection paramaters or have any idea how C3P0 could be missing these drivers?</p> <p><strong>Edit</strong></p> <p>I did see some issues that looked like they were caused by C3P0 not finding the drivers so I did try throwing the C3P0 jar into the glassfish lib as well but still got the same errors. Here is the error from the comment below in a little nicer fasion and more info.</p> <pre><code>[#|2011-04-28T12:37:49.964-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:49,964 INFO [FelixStartLevel] (JCLLoggerAdapter.java:265) - Mapping collection: com.jada.jpa.entity.ShippingType.shippingMethodRegionTypes -&gt; shipping_method_region_type |#] [#|2011-04-28T12:37:50.009-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,008 INFO [FelixStartLevel] (JCLLoggerAdapter.java:265) - Hibernate Validator not found: ignoring |#] [#|2011-04-28T12:37:50.405-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,404 INFO [FelixStartLevel] (JCLLoggerAdapter.java:286) - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. |#] [#|2011-04-28T12:37:50.491-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,490 INFO [FelixStartLevel] (JCLLoggerAdapter.java:265) - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider |#] [#|2011-04-28T12:37:50.504-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,504 INFO [FelixStartLevel] (JCLLoggerAdapter.java:265) - C3P0 using driver: at URL: |#] [#|2011-04-28T12:37:50.506-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,505 INFO [FelixStartLevel] (JCLLoggerAdapter.java:265) - Connection properties: {user=, password=****, autocommit=true, release_mode=auto} |#] [#|2011-04-28T12:37:50.507-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,506 INFO [FelixStartLevel] (JCLLoggerAdapter.java:265) - autocommit mode: true |#] [#|2011-04-28T12:37:50.543-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|2011-04-28 12:37:50,531 ERROR [FelixStartLevel] (JCLLoggerAdapter.java:535) - JDBC Driver class not found: java.lang.ClassNotFoundException: at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192) at org.hibernate.connection.C3P0ConnectionProvider.configure(C3P0ConnectionProvider.java:118) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137) at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78) at com.jada.jpa.connection.JpaConnection.init(JpaConnection.java:79) at com.jada.system.Initializer.init(Initializer.java:162) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1230) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5007) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5280) at com.sun.enterprise.web.WebModule.start(WebModule.java:499) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339) at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:362) at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:185) at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174) at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87) at java.security.AccessController.doPrivileged(Native Method) at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84) at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77) at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58) at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107) at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60) at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236) at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128) at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457) at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401) at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700) at org.apache.felix.framework.Felix.startBundle(Felix.java:1622) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915) at org.jvnet.hk2.osgimain.Main.start(Main.java:140) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640) at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700) at org.apache.felix.framework.Felix.startBundle(Felix.java:1622) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) at java.lang.Thread.run(Thread.java:619) |#] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload