-
1. Re: Exception Using port 9123
alexis_lalas Jun 3, 2011 4:33 PM (in response to 2sharma.vishal)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 Jun 6, 2011 4:08 AM (in response to alexis_lalas)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 Jun 6, 2011 1:28 PM (in response to 2sharma.vishal)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 Jun 7, 2011 10:03 AM (in response to alexis_lalas)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 Jan 30, 2012 8:02 AM (in response to 2sharma.vishal)Hello Alexis,
Can you give me an example to launch a process using MinaTaskServer in eclipse 5.2 version??????