5 Replies Latest reply on Jan 30, 2012 8:02 AM by divyadec.18

    Exception Using port 9123

    2sharma.vishal

      Hello,

       

      I am trying to deploy a human task but it ends up with this error.I know that there is another task running from the the inbuilt script.But how shall I stop the other task.I can view the result in Console but I cannot go through the processes tab.I hope I will find the solution soon.

       

      Thanks in Advance

       

       

      Exception in thread "Thread-3" java.lang.RuntimeException: Server Exception with class class org.jbpm.task.service.mina.MinaTaskServer using port 9123

                at org.jbpm.task.service.mina.BaseMinaTaskServer.run(BaseMinaTaskServer.java:53)

                at java.lang.Thread.run(Unknown Source)

      Caused by: java.net.BindException: Address already in use: bind

                at sun.nio.ch.Net.bind(Native Method)

                at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)

                at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)

                at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:251)

                at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:48)

                at org.apache.mina.core.polling.AbstractPollingIoAcceptor.registerHandles(AbstractPollingIoAcceptor.java:523)

                at org.apache.mina.core.polling.AbstractPollingIoAcceptor.access$200(AbstractPollingIoAcceptor.java:65)

                at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:407)

                at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        • 1. Re: Exception Using port 9123
          alexis_lalas

          Hello Vishal.

          Could you show  your code? and so in that way we can help you!!

           

          Cheers!!


          • 2. Re: Exception Using port 9123
            2sharma.vishal

            I have removed the human task from the build.xm and now its not showing the error with the port 9123, But now I have some other problems, so I am not sure from where the problem begins I cannot export my package to the guvnor frontend fromt the eclipse side and I also cannot view the process in the jbpm console.I am not sure which code you are talking about but I am attaching my java code, bpmn2.0 and the .ftll files and all the configuration files as well, so that you can have a look.

             

            Thanks

             

             

             

            #########main class###########

            package com.sample;

             

             

            import java.util.Properties;

             

             

            import javax.persistence.EntityManagerFactory;

            import javax.persistence.Persistence;

             

             

            import org.drools.KnowledgeBase;

            import org.drools.KnowledgeBaseFactory;

            import org.drools.SystemEventListenerFactory;

            import org.drools.builder.KnowledgeBuilder;

            import org.drools.builder.KnowledgeBuilderFactory;

            import org.drools.builder.ResourceType;

            import org.drools.compiler.BPMN2ProcessFactory;

            import org.drools.compiler.ProcessBuilderFactory;

            import org.drools.impl.EnvironmentFactory;

            import org.drools.io.ResourceFactory;

            import org.drools.logger.KnowledgeRuntimeLogger;

            import org.drools.logger.KnowledgeRuntimeLoggerFactory;

            import org.drools.marshalling.impl.ProcessMarshallerFactory;

            import org.drools.runtime.KnowledgeSessionConfiguration;

            import org.drools.runtime.StatefulKnowledgeSession;

            import org.drools.runtime.process.ProcessRuntimeFactory;

            import org.jbpm.bpmn2.BPMN2ProcessProviderImpl;

            import org.jbpm.marshalling.impl.ProcessMarshallerFactoryServiceImpl;

            import org.jbpm.process.builder.ProcessBuilderFactoryServiceImpl;

            import org.jbpm.process.instance.ProcessRuntimeFactoryServiceImpl;

            import org.jbpm.process.workitem.wsht.WSHumanTaskHandler;

            import org.jbpm.task.User;

            import org.jbpm.task.service.TaskService;

            import org.jbpm.task.service.TaskServiceSession;

            import org.jbpm.task.service.mina.MinaTaskServer;

             

             

            /**

            * This is a sample file to launch a process.

            */

            public class ProcessTest {

             

             

                      public static final void main(String[] args) {

            try {

             

             

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

                              TaskService taskService  = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());

                             

                              /*

                               * Add the required users

                               */

                              TaskServiceSession taskSession = taskService.createSession();  

                              taskSession.addUser(new User("Administrator"));

                              taskSession.addUser(new User("krisv"));

                             

                              /* Start Mina server for HT*/

                              MinaTaskServer server = new MinaTaskServer(taskService);

                              Thread thread = new Thread(server);

                              thread.start();

                              System.out.println("Server started ...");

                            

                              /*Create the knowledge base for HelloProcss.bpmn */

                              KnowledgeBase kbase = readKnowledgeBase();

                                          StatefulKnowledgeSession ksession = createSession(kbase);

                                          KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "testlog", 1000);

             

                                          ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());

                                          //ProcessTest pt = new ProcessTest();

                                          //ksession.insert(pt);

             

                                          System.out.println(" started the humantask");

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

             

             

                             

                              logger.close();

             

                                } catch (Throwable t) {

                                          t.printStackTrace();

                                }

                      }

             

             

                      private static KnowledgeBase readKnowledgeBase() throws Exception {

                                ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());

                                ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());

                                ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());

                                BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());

                                KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

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

                                return kbuilder.newKnowledgeBase();

                      }

             

             

                      private static StatefulKnowledgeSession createSession(KnowledgeBase kbase) {

                                Properties properties = new Properties();

                                properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");

                                properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");

                                KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);

                                return kbase.newStatefulKnowledgeSession(config, EnvironmentFactory.newEnvironment());

                      }

             

            }

             

            #########hello.ftl##########

             

            <html>

            <body>

             

             

            <h2>Hello</h2>

            <hr>

            This will start the Hello process !

            <form action="complete" method="POST" enctype="multipart/form-data">

            <input type="submit" value="Complete">

            </form>

            </body>

            </html>

             

             

             

            ######HelloTask.ftl########

            <html>

            <body>

             

             

            <h2>Hello</h2>

            <hr>

            Hello World !

            <form action="complete" method="POST" enctype="multipart/form-data">

            <input type="submit" value="Complete">

            </form>

            </body>

            </html>

             

             

            ###########sample.bpmn###########

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

            <definitions id="Definition"

                         targetNamespace="http://www.jboss.org/drools"

                         typeLanguage="http://www.java.com/javaTypes"

                         expressionLanguage="http://www.mvel.org/2.0"

                         xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

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

                         xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"

                         xmlns:g="http://www.jboss.org/drools/flow/gpd"

                         xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"

                         xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"

                         xmlns:di="http://www.omg.org/spec/DD/20100524/DI"

                         xmlns:tns="http://www.jboss.org/drools">

             

             

              <process processType="Private" isExecutable="true" id="com.sample.bpmn.hello" name="Hello World" >

             

             

                <!-- nodes -->

                <startEvent id="_1" name="StartProcess" />

                <userTask id="_2" name="User Task" >

                  <ioSpecification>

                    <dataInput id="_2_CommentInput" name="Comment" />

                    <dataInput id="_2_SkippableInput" name="Skippable" />

                    <dataInput id="_2_ContentInput" name="Content" />

                    <dataInput id="_2_TaskNameInput" name="TaskName" />

                    <dataInput id="_2_PriorityInput" name="Priority" />

                    <inputSet>

                      <dataInputRefs>_2_CommentInput</dataInputRefs>

                      <dataInputRefs>_2_SkippableInput</dataInputRefs>

                      <dataInputRefs>_2_ContentInput</dataInputRefs>

                      <dataInputRefs>_2_TaskNameInput</dataInputRefs>

                      <dataInputRefs>_2_PriorityInput</dataInputRefs>

                    </inputSet>

                    <outputSet>

                    </outputSet>

                  </ioSpecification>

                  <dataInputAssociation>

                    <targetRef>_2_CommentInput</targetRef>

                    <assignment>

                      <from xs:type="tFormalExpression">hello!!!!!!!</from>

                      <to xs:type="tFormalExpression">_2_CommentInput</to>

                    </assignment>

                  </dataInputAssociation>

                  <dataInputAssociation>

                    <targetRef>_2_SkippableInput</targetRef>

                    <assignment>

                      <from xs:type="tFormalExpression">false</from>

                      <to xs:type="tFormalExpression">_2_SkippableInput</to>

                    </assignment>

                  </dataInputAssociation>

                  <dataInputAssociation>

                    <targetRef>_2_ContentInput</targetRef>

                    <assignment>

                      <from xs:type="tFormalExpression"></from>

                      <to xs:type="tFormalExpression">_2_ContentInput</to>

                    </assignment>

                  </dataInputAssociation>

                  <dataInputAssociation>

                    <targetRef>_2_TaskNameInput</targetRef>

                    <assignment>

                      <from xs:type="tFormalExpression">HelloTask</from>

                      <to xs:type="tFormalExpression">_2_TaskNameInput</to>

                    </assignment>

                  </dataInputAssociation>

                  <dataInputAssociation>

                    <targetRef>_2_PriorityInput</targetRef>

                    <assignment>

                      <from xs:type="tFormalExpression"></from>

                      <to xs:type="tFormalExpression">_2_PriorityInput</to>

                    </assignment>

                  </dataInputAssociation>

                  <potentialOwner>

                    <resourceAssignmentExpression>

                      <formalExpression>krisv</formalExpression>

                    </resourceAssignmentExpression>

                  </potentialOwner>

                </userTask>

                <endEvent id="_3" name="End" >

                    <terminateEventDefinition/>

                </endEvent>

             

             

                <!-- connections -->

                <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />

                <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />

             

             

              </process>

             

             

              <bpmndi:BPMNDiagram>

                <bpmndi:BPMNPlane bpmnElement="com.sample.bpmn.hello" >

                  <bpmndi:BPMNShape bpmnElement="_1" >

                    <dc:Bounds x="37" y="135" width="48" height="48" />

                  </bpmndi:BPMNShape>

                  <bpmndi:BPMNShape bpmnElement="_2" >

                    <dc:Bounds x="189" y="140" width="100" height="48" />

                  </bpmndi:BPMNShape>

                  <bpmndi:BPMNShape bpmnElement="_3" >

                    <dc:Bounds x="475" y="145" width="48" height="48" />

                  </bpmndi:BPMNShape>

                  <bpmndi:BPMNEdge bpmnElement="_1-_2" >

                    <di:waypoint x="61" y="159" />

                    <di:waypoint x="239" y="164" />

                  </bpmndi:BPMNEdge>

                  <bpmndi:BPMNEdge bpmnElement="_2-_3" >

                    <di:waypoint x="239" y="164" />

                    <di:waypoint x="499" y="169" />

                  </bpmndi:BPMNEdge>

                </bpmndi:BPMNPlane>

              </bpmndi:BPMNDiagram>

             

             

            </definitions>

            • 3. Re: Exception Using port 9123
              alexis_lalas

              Hello Vishal,

              You have to set the package name of the process, and that package name should be the same as in guvnor.

              You have to set the package name in properties (try clicking on the white space of the eclipse process canvas) as defaultPackage.

               

              Unfortunately JBPM console uses hardcoded packageName string when getting processes from guvnor. Therefore you have to put your process, freemarker forms and png image into defaultPackage.(also make sure that your process declares defaultPackage as its package).

               

              Please check your process contains the name of the package.

               

                <process processType="Private" isExecutable="true" id="AuthorizationProcessSGG" name="Authorization_Process_SGG" tns:packageName="defaultPackage" >

               

               

              At the end your jbpm console should now list your process as well.

               

              Greetings .-

              alexis_lalas

              • 4. Re: Exception Using port 9123
                2sharma.vishal

                But I cannot import or export anything from the Eclipse to the guvnor. I have tried to upload my ftl, bpmn and image file through but I cannot see the option to add to guvnor existing repository, as it is highlighted.I hope it will make you to understand the situation.

                 

                Greetings

                Vishal

                • 5. Re: Exception Using port 9123
                  divyadec.18

                  Hello  Alexis,

                   

                    Can you give me an example to launch a process using MinaTaskServer in eclipse 5.2 version??????