5 Replies Latest reply on Oct 10, 2005 9:12 AM by akula.pratap

    Configuring jBPM to PostgreSQL database

    akula.pratap


      Hi all

      I am new to jBPM. In the process of evaluation I am trying to connect the jBPM to my Postgresql database. I had followed the steps specified in the readme.html of jbpm-dp package.
      While running the command "ant postgres.scripts" I am getting the following exception:




      [delete] Deleting directory C:\JOA\jBPM\jbpm-starters-kit-3.0.1\jbpm-db\build
      \postgresql\scripts
      [mkdir] Created dir: C:\JOA\jBPM\jbpm-starters-kit-3.0.1\jbpm-db\build\postg
      resql\scripts
      [java] java.lang.UnsupportedClassVersionError: org/jbpm/db/JbpmSchema (Unsu
      pported major.minor version 49.0)
      [java] at java.lang.ClassLoader.defineClass0(Native Method)
      [java] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
      [java] at java.security.SecureClassLoader.defineClass(SecureClassLoader
      .java:123)
      [java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
      [java] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
      [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
      [java] at java.security.AccessController.doPrivileged(Native Method)
      [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

      [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

      [java] Exception in thread "main"
      [java] Java Result: 1



      Please help me in configuring jBPM to another database.

      Thanks in advance
      Pratap

        • 1. Re: Configuring jBPM to PostgreSQL database
          lretief

          What version of Java are you running on? I get a simular error when running on JDK 1.4.x, and it disappears when I use JDK 1.5.

          There is mention of jBPM 3.0.1 (compiled version) incompatability at http://jira.jboss.com/jira/browse/JBPM-336.

          • 2. Re: Configuring jBPM to PostgreSQL database
            kukeltje

            Indeed.. Only the compiled version does not run on jdk 1.4. Next versions will. Compiling it yourself will make it run on jdk 1.4

            • 3. Re: Configuring jBPM to PostgreSQL database
              akula.pratap


              Thanks Iretief & Ronald. I had changed my jdk from 1.4 to 1.5
              Now I am able to generate the scripts for postgresql & oracle.



              Now, when I am executing the command "ant postgresql.test" I am getting the following trace.



              Buildfile: build.xml

              postgresql.test:

              prepare:

              compile.jbpm:

              compile.jbpm.test:

              compile.identity:

              compile.webapp:

              compile.identity.test:

              compile.examples:

              compile:

              db.test:
              [mkdir] Created dir: C:\jBPM\jbpm-starters-kit-3.0.1\jbpm-db\build\postgresq
              l\testresults\xml

              BUILD FAILED
              C:\jBPM\jbpm-starters-kit-3.0.1\jbpm-db\build.xml:313: The following error occur
              red while executing this line:
              C:\jBPM\jbpm-starters-kit-3.0.1\jbpm-db\build.xml:86: Could not create task or t
              ype of type: junit.

              Ant could not find the task or a class this task relies upon.

              This is common and has a number of causes; the usual
              solutions are to read the manual pages then download and
              install needed JAR files, or fix the build file:
              - You have misspelt 'junit'.
              Fix: check your spelling.
              - The task needs an external JAR file to execute
              and this is not found at the right place in the classpath.
              Fix: check the documentation for dependencies.
              Fix: declare the task.
              - The task is an Ant optional task and the JAR file and/or libraries
              implementing the functionality were not found at the time you
              yourself built your installation of Ant from the Ant sources.
              Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
              task and make sure it contains more than merely a META-INF/MANIFEST.MF.
              If all it contains is the manifest, then rebuild Ant with the needed
              libraries present in ${ant.home}/lib/optional/ , or alternatively,
              download a pre-built release version from apache.org
              - The build file was written for a later version of Ant
              Fix: upgrade to at least the latest release version of Ant
              - The task is not an Ant core or optional task
              and needs to be declared using .
              - You are attempting to use a task defined using
              or but have spelt wrong or not
              defined it at the point of use

              Remember that for JAR files to be visible to Ant tasks implemented
              in ANT_HOME/lib, the files must be in the same directory or on the
              classpath

              Please neither file bug reports on this problem, nor email the

              Is there anything I am missing... One more thing I tried to execute HelloWorldDbTest.java from eclipse. It had successfully loaded hibernate dialect for Postgresql. But while loading the Driver Class, I got an SQLException saying that "No sutiable Driver". I had tried executing this example by loading Postgresql's postgresql-8.0-310.jdbc3.jar.

              Please Resolve.

              Thanks in advance

              • 4. Re: Configuring jBPM to PostgreSQL database
                aguizar

                Well, the error message that Ant returns gives the answer:

                The task needs an external JAR file to execute and this is not found at the right place in the classpath

                From the Ant manual, section Ant Tasks->Optional Tasks->JUnit:
                You must have junit.jar and the class files for the <junit> task in the same classpath. You can do one of:
                1. Put both junit.jar and the optional tasks jar file in ANT_HOME/lib.
                2. Do not put either in ANT_HOME/lib, and instead include their locations in your CLASSPATH environment variable.
                3. Do neither of the above, and instead, specify their locations using a <classpath> element in the build file. See the FAQ for details.

                Any of these solutions will work. Let's try (1): copy file JBPM_STARTERS_KIT_HOME\jbpm\lib\junit\junit-3.8.1.jar to ANT_HOME\lib.

                Please post the stack trace of your SQLException.

                • 5. Re: Configuring jBPM to PostgreSQL database
                  akula.pratap

                  Hi

                  Thanks alex... I had copied the junit.jar into $ANT/lib and am able to run the different test cases. But unfortunately all my test cases have been failed, I am getting the following exception:


                  [junit] 16:38:01,750 INFO NamingHelper : JNDI InitialContext properties:{}
                  [junit] 16:38:01,750 FATAL DatasourceConnectionProvider : Could not find dat
                  asource: java:/DefaultDS
                  [junit] javax.naming.NoInitialContextException: Need to specify class name i
                  n environment or system property, or as an applet parameter, or in an applicatio
                  n resource file: java.naming.factory.initial
                  [junit] at javax.naming.spi.NamingManager.getInitialContext(NamingManage
                  r.java:645)
                  [junit] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.
                  java:247)
                  [junit] at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialCon
                  text.java:284)
                  [junit] at javax.naming.InitialContext.lookup(InitialContext.java:351)
                  [junit] at org.hibernate.connection.DatasourceConnectionProvider.configu
                  re(DatasourceConnectionProvider.java:44)
                  [junit] at org.hibernate.connection.ConnectionProviderFactory.newConnect
                  ionProvider(ConnectionProviderFactory.java:80)
                  [junit] at org.jbpm.db.JbpmSchema.createConnection(JbpmSchema.java:258)
                  [junit] at org.jbpm.db.JbpmSchema.execute(JbpmSchema.java:223)
                  [junit] at org.jbpm.db.JbpmSchema.dropSchema(JbpmSchema.java:145)
                  [junit] at org.jbpm.context.exe.HibernateCustomizationTest.dropDatabase(
                  HibernateCustomizationTest.java:220)
                  [junit] at org.jbpm.context.exe.HibernateCustomizationTest.testCustomVar
                  iableClassWithStringId(HibernateCustomizationTest.java:64)
                  [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
                  sorImpl.java:39)
                  [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
                  hodAccessorImpl.java:25)
                  [junit] at java.lang.reflect.Method.invoke(Method.java:585)
                  [junit] at junit.framework.TestCase.runTest(TestCase.java:154)
                  [junit] at junit.framework.TestCase.runBare(TestCase.java:127)
                  [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
                  [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
                  [junit] at junit.framework.TestResult.run(TestResult.java:109)
                  [junit] at junit.framework.TestCase.run(TestCase.java:118)
                  [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
                  [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
                  [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
                  run(JUnitTestRunner.java:297)
                  [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
                  launch(JUnitTestRunner.java:672)
                  [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
                  main(JUnitTestRunner.java:567)
                  [junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 32.313 sec
                  [junit] Test org.jbpm.context.exe.HibernateCustomizationTest FAILED
                  [junitreport] Transform time: 2187ms


                  I am running the ant tests outside the appserver. Probably that might be the reason for this exception.

                  Next thing I am worried abt is I had ran a DB Test process with HSQLDB & Postgresql. I am getting different exceptions for these databases which are as follows:
                  For HSQLDB:

                  java.sql.SQLException: Connection is broken: Transfer corrupted
                  at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
                  at org.hsqldb.jdbc.jdbcConnection.getAutoCommit(Unknown Source)
                  at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:112)
                  at org.jbpm.db.JbpmSchema.createConnection(JbpmSchema.java:259)
                  at org.jbpm.db.JbpmSchema.execute(JbpmSchema.java:223)
                  at org.jbpm.db.JbpmSchema.createSchema(JbpmSchema.java:149)
                  at org.jbpm.tutorial.db.HelloWorldDbTest.<clinit>(HelloWorldDbTest.java:27)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                  at java.lang.reflect.Constructor.newInstance(Unknown Source)
                  at junit.framework.TestSuite.createTest(TestSuite.java:131)
                  at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
                  at junit.framework.TestSuite.<init>(TestSuite.java:75)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:366)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:404)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


                  For Postgresql:

                  java.sql.SQLException: No suitable driver
                  at java.sql.DriverManager.getConnection(Unknown Source)
                  at java.sql.DriverManager.getConnection(Unknown Source)
                  at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
                  at org.jbpm.db.JbpmSchema.createConnection(JbpmSchema.java:259)
                  at org.jbpm.db.JbpmSchema.execute(JbpmSchema.java:223)
                  at org.jbpm.db.JbpmSchema.createSchema(JbpmSchema.java:149)
                  at org.jbpm.tutorial.db.HelloWorldDbTest.<clinit>(HelloWorldDbTest.java:27)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                  at java.lang.reflect.Constructor.newInstance(Unknown Source)
                  at junit.framework.TestSuite.createTest(TestSuite.java:131)
                  at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
                  at junit.framework.TestSuite.<init>(TestSuite.java:75)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:366)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:404)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


                  Please help me resolving the issues.

                  Thanks in advance
                  Pratap.