4 Replies Latest reply on Jan 21, 2013 1:10 PM by Ezequiel Santana

    JDBC Driver class not found

    Jonathan Albornoz Newbie

      Hi, i have a problem, i have jbpm 5.4 with oracle and jboss 7.1.1.

      When i want run my project (example with persistence) i have the next error.

      I put the ojdbc6.jar in db folder, and lib folder.

      I was made all the test that i imagine...any help please...thanks!!!

       

       

      console log.

       

      Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] 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:52)

                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

                at com.sample.fefefefefe.main(fefefefefe.java:26)

      Caused by: org.hibernate.HibernateException: JDBC Driver class not found: oracle.jdbc.driver.OracleDriver

                at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:89)

                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)

                ... 4 more

      Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at java.lang.Class.forName0(Native Method)

                at java.lang.Class.forName(Unknown Source)

                at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)

                at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)

                ... 12 more

      0    06/01 19:48:39,121[main] ERROR hibernate.connection.DriverManagerConnectionProvider.configure  - JDBC Driver class not found: oracle.jdbc.driver.OracleDriver

      java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at java.lang.Class.forName0(Native Method)

                at java.lang.Class.forName(Unknown Source)

                at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)

                at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)

                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:52)

                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

                at com.sample.fefefefefe.main(fefefefefe.java:26)

       

      My java code:

       

      package com.sample;

      import javax.persistence.EntityManagerFactory;

      import javax.persistence.Persistence;

      import org.drools.KnowledgeBase;

      import org.drools.KnowledgeBaseFactory;

      import org.drools.builder.KnowledgeBuilder;

      import org.drools.builder.KnowledgeBuilderFactory;

      import org.drools.builder.ResourceType;

      import org.drools.io.ResourceFactory;

      import org.drools.persistence.jpa.JPAKnowledgeService;

      import org.drools.runtime.Environment;

      import org.drools.runtime.EnvironmentName;

      import org.drools.runtime.StatefulKnowledgeSession;

       

      public class fefefefefe {

       

                  /**

                 * @param args

                 */

                public static void main(String[] args) {

                          // TODO Auto-generated method stub

       

                          KnowledgeBase kbase = readKnowledgeBase();

                          EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );

                          Environment env = KnowledgeBaseFactory.newEnvironment();

                          env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );

                          // create a new knowledge session that uses JPA to store the runtime state

                          StatefulKnowledgeSession ksession =JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );

                          int sessionId = ksession.getId();

                          // invoke methods on your method here

                          ksession.startProcess( "com.sample.bpmn.hello" );

                          ksession.dispose();

                }

                private static KnowledgeBase readKnowledgeBase() {

                          KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

                          kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);

                          return kbuilder.newKnowledgeBase();

                }

      }

       

       

      My persistence file inside my project. Resource/Meta-Inf

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <persistence version="1.0" xsi:schemaLocation=

          "http://java.sun.com/xml/ns/persistence

           http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd

           http://java.sun.com/xml/ns/persistence/orm

           http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"

        xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xmlns="http://java.sun.com/xml/ns/persistence">

        <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">

          <provider>org.hibernate.ejb.HibernatePersistence</provider>

         

          <mapping-file>META-INF/JBPMorm.xml</mapping-file>

          <class>org.drools.persistence.info.SessionInfo</class>

          <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

          <class>org.drools.persistence.info.WorkItemInfo</class>

          <properties>

         

          <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>

            <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>

            <property name="hibernate.connection.url" value="jdbc:oracle:thin:@192.168.20.200:1521:orcl2" />

            <property name="hibernate.connection.username" value="jbpm5"/>

            <property name="hibernate.connection.password" value="ryc"/>

            <property name="hibernate.connection.autocommit" value="false" />

            <property name="hibernate.max_fetch_depth" value="3"/>

            <property name="hibernate.hbm2ddl.auto" value="create" />

            <property name="hibernate.show_sql" value="false" />

            <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>

       

       

           

          </properties>

        </persistence-unit>

      </persistence>

       

       

      //********************************************************************************************

        • 1. Re: JDBC Driver class not found
          Jonathan Albornoz Newbie

          UPDATE:

          I resolve this problem, i add the oracle driver to my lib project but now i have the next error. Any idea!

           

          Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] 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:52)

                    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)

                    at com.sample.fefefefefe.main(fefefefefe.java:26)

          Caused by: org.hibernate.HibernateException: Could not locate TransactionManager

                    at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:60)

                    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:367)

                    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)

                    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

                    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

                    ... 4 more

          Caused by: javax.naming.NameNotFoundException: unable to find a bound object at name 'java:/TransactionManager'

                    at bitronix.tm.jndi.BitronixContext.lookup(BitronixContext.java:83)

                    at javax.naming.InitialContext.lookup(Unknown Source)

                    at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:57)

                    ... 8 more

          • 2. Re: JDBC Driver class not found
            Ezequiel Santana Newbie

            Hello,

             

            Albornoz, did you solve that problem?

             

            Thanks in advance,

            Ezequiel

            • 3. Re: JDBC Driver class not found
              Jonathan Albornoz Newbie

              Yes! i add the driver in my web project like a lib...

              if you need more help send your email....after two long months i finally have jbpm 5.3 jboss 7.0.2 and oracle working with the api from my java aplication.

              Bye!

              • 4. Re: JDBC Driver class not found
                Ezequiel Santana Newbie

                Thanks, I will really appreciate if you can help.

                I'm also trying to configure jbpm 5.3 with jboss 7.0.2 and oracle 11g.

                My email: esantana at mp.rs.gov.br

                 

                Thanks,