1 Reply Latest reply on May 23, 2014 1:37 AM by swiderski.maciej

    How to configure jBPM 6.0 standalone to use Oracle DB

    hugues.bernard

      I made a simple Java program that uses jBPM to start a workflow. So, I am not running in any container, just a Java class with a main().

      I need to use an Oracle database. I have created the jBPM tables in a dedicated schema (using file oracle-jbpm-schema.sql).

      I have created a persistence.xml file to set the properties of persistence-unit "org.jbpm.domain", in particular the dialect "org.hibernate.dialect.OracleDialect". The persistence.xml is in the META-INF folder on the classpath.

      I also create a data-source in the main(), named "jdbc/jbpm-ds" and that has the right DB URL, user, password and driver class name.

      Still, when I launch my simple app, I get the following error:

       

      2014-05-22 12:01:48,779 [main] ERROR HHH000299: Could not complete schema update

      java.lang.NullPointerException: null

      at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:156) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:70) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:63) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:196) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:505) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1762) ~[hibernate-core-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) ~[hibernate-entitymanager-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) [hibernate-entitymanager-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.2.0.SP1.jar:4.2.0.SP1]

      at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:72) [hibernate-entitymanager-4.2.0.SP1.jar:4.2.0.SP1]

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

      at org.jbpm.runtime.manager.impl.DefaultRuntimeEnvironment.init(DefaultRuntimeEnvironment.java:72) [jbpm-runtime-manager-6.0.1.Final.jar:6.0.1.Final]

      at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.get(RuntimeEnvironmentBuilder.java:314) [jbpm-runtime-manager-6.0.1.Final.jar:6.0.1.Final]

      at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.get(RuntimeEnvironmentBuilder.java:56) [jbpm-runtime-manager-6.0.1.Final.jar:6.0.1.Final]

      at jbpm.Experiment3.main(Experiment3.java:58) [bin/:na]

      2014-05-22 12:01:51,308 [main] ERROR ORA-00904: "TASKIMPL0_"."ID": invalid identifier

       

      I think that my persistence.xml is not used at all, hence the dialect is wrong (just a wild guess) ?

      Which comes down to: how should I configure persistency when using Oracle AND not running in a container ?

      Thanks for your help.

      Hugues

       

       

        • 1. Re: How to configure jBPM 6.0 standalone to use Oracle DB
          swiderski.maciej

          please use this script to create db schema as one that you used might contain a bug that creates incorrect identifiers for some of the tables - see the last error in your log. Since you create schema manually you can disable hibernate.ddl.auto property in persistence.xml to not attempt to change it, to do so set it to validate.

           

          All other steps you described should be enough to run towards Oracle. Please note that Oracle10Dialect might be better choice depending on what Oracle version you run on.

           

          HTH