8 Replies Latest reply on Nov 8, 2005 10:12 AM by pedro costa

    JpdlXmlReader methods missing?

    Andrig Miller Newbie

      I am following the first simply example of how to create a process definition, and test it with JUnit. The example JUnit test is as follows:

       ProcessDefinition processDefinition =
       JpdlXmlReader.parseFromResource("hello.par/processdefinition.xml");
      
       assertNotNull("Definition should not be null", processDefinition);
      
       ProcessInstance processInstance =
       new ProcessInstance(processDefinition);
      
       assertEquals("Instance is in a start state"
       , processInstance.getRootToken().getNode().getName()
       , "auction");
      
       processInstance.signal();
      
       assertEquals("Instance in in end state"
       , processInstance.getRootToken().getNode().getName()
       , "end1");
      
       assertTrue("Instance has ended"
       , processInstance.hasEnded());
      


      The method parseFromResource is not a method on the JpdlXmlReader class. Was there some refactoring done that is not represented in the documentation? I tried looking around the other packages and classes but didn't find a match for this. Any help is appreciated.

      I am using the JBoss IDE M3 release with the jBPM plugin included, and using the 1.5 JVM from Sun (JDK 1.5.0_04)

      Thanks.

        • 1. Re: JpdlXmlReader methods missing?
          Michael Gillam Newbie

          Also ...
          The HelloWorld example in the Tutorial refers to a method to parse an xml string returning a ProcessDefinition, and that method doesn't exist either.

          ProcessDefinition def = JdplXmlReader.parse(...)

          • 2. Re: JpdlXmlReader methods missing?
            Michael Gillam Newbie

            Try this instead ...

            ... = ProcessDefinition.parseXmlResource(filename);

            • 3. Re: JpdlXmlReader methods missing?
              Andrig Miller Newbie

              Thanks, that did the trick.

              • 4. Re: JpdlXmlReader methods missing?
                sy62k Newbie

                I am using the same example and I encouter the following error:

                java.lang.UnsupportedClassVersionError: org/jbpm/graph/def/ProcessDefinition (Unsupported major.minor version 49.0)
                 at java.lang.ClassLoader.defineClass0(Native Method)
                 at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
                 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
                 at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
                 at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
                 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
                 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
                 at com.jbay.FirstTest.testProcess(FirstTest.java:19)
                 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:324)
                 at junit.framework.TestCase.runTest(TestCase.java:154)
                 at junit.framework.TestCase.runBare(TestCase.java:127)
                 at junit.framework.TestResult$1.protect(TestResult.java:106)
                 at junit.framework.TestResult.runProtected(TestResult.java:124)
                 at junit.framework.TestResult.run(TestResult.java:109)
                 at junit.framework.TestCase.run(TestCase.java:118)
                 at junit.framework.TestSuite.runTest(TestSuite.java:208)
                 at junit.framework.TestSuite.run(TestSuite.java:203)
                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                


                The line thats causing the problem is:
                ProcessDefinition definition = ProcessDefinition.parseXmlResource("hello.par/processdefinition.xml");

                I am currently using the latest version with Eclipse, the RC1 package.

                Thanks
                Hemanth

                • 5. Re: JpdlXmlReader methods missing?
                  sy62k Newbie

                  I solved it by using the latest JVM version 1.5. This thread http://www.jboss.org/?module=bb&op=viewtopic&t=70542 helped me.

                  Thanks
                  Hemanth

                  • 6. Re: JpdlXmlReader methods missing?
                    Koen Aers Master

                    Alternatively, you can build everything from source using the 1.4 JDK.

                    Regards,
                    Koen

                    • 7. Re: JpdlXmlReader methods missing?
                      Ronald van Kuijk Master

                      funny how many people post this issue first and then find the solution themselves.....in the forum

                      • 8. Re: JpdlXmlReader methods missing?
                        pedro costa Apprentice

                        The method

                        ProcessDefinition definition = ProcessDefinition.parseXmlResource("simple.par/processdefinition.xml");
                        


                        doesn't read correctly my processdefinition.xml file.

                        It only reads the first task. The next task doesn'st exist for him.
                        My program only works if i put my xml inside my java code and use parseXmlString.

                        Here is my processdefinition.xml ot see.


                        <?xml version="1.0"?>
                        
                        <process-definition name='simple'>
                         <start-state name='start'>
                         <transition to='registo_ocorrencia'/>
                         </start-state>
                        
                         <!-- Tarefa 1 -->
                         <task-node name='registo_ocorrencia'>
                         <task name='RegistoOcorrenciaTask'>
                         </task>
                         <transition to='lista_tarefas'/>
                         </task-node>
                        
                         <!-- Tarefa 2 -->
                         <task-node name='lista_tarefas'>
                         <task name='ListaTarefasTask'/>
                         <transition to='notificacoes'/>
                         </task-node>
                        
                         <!-- Tarefa 3 -->
                         <task-node name='notificacoes'>
                         <task name='NotificacoesTask'>
                         </task>
                         <transition to='end'/>
                         </task-node>
                         <end-state name='end'></end-state>
                        </process-definition>
                        


                        I repeat, when i use ProcessDefinition.parseXmlResource("simple.par/processdefinition.xml");, my java code only reads the first task. The others tasks are forgotten.
                        If i put the xml file inside the java, it works perfectly.

                        Is there any other command that substitutes parseXmlResource and works correctly

                        Thanks
                        Pedro