Pasted is the code to enabling persistence .Was using the Order Sample .
Appreciate your help.
Thanks
Sanjay
/*----------------------------------------------*/
private void createWorkingMemoryTest() {
try {
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS1");
ds.setClassName("org.h2.jdbcx.JdbcDataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "sa");
ds.getDriverProperties().put("password", "sasa");
ds.getDriverProperties().put("URL",
"jdbc:h2:file:/dev/CaseNoteBookRewirite/data/process-instance-db");
ds.init();
//new
EntityManagerFactory emf =
Persistence.createEntityManagerFactory( "org.drools.persistence.jpa"
);
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
kbase = createKnowledgeBase();
try {
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(
33, kbase, null, env);
System.out.println("Loading session data ...");
} catch (RuntimeException e) {
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(
kbase, null, env);
System.out.println("Creating new session data ...");
}
int sessionId = ksession.getId();
WorkingMemoryDbLogger JPAlogger = new WorkingMemoryDbLogger(ksession);
CustomerService customerService = new DefaultCustomerService();
Customer c = new Customer("A-12345");
Calendar birthday = Calendar.getInstance();
birthday.set(1982, 1, 1);
c.setBirthday(birthday.getTime());
c.setFirstName("John");
c.setLastName("Doe");
customerService.addCustomer(c);
ksession.setGlobal("customerService", customerService);
ItemCatalog itemCatalog = new DefaultItemCatalog();
Item i = new Item("I-9876");
i.setName("PC game");
i.setMinimalAge(18);
itemCatalog.addItem(i);
i = new Item("I-5432");
i.setName("Laptop");
itemCatalog.addItem(i);
ksession.setGlobal("itemCatalog", itemCatalog);
/*WS Human Task Handler*/
WSHumanTaskHandler handler = new WSHumanTaskHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task",
handler);
//sanjay
} catch (Throwable t) {
t.printStackTrace();
}
}
/*----------------------------------------------*/
Mauricio Salatino wrote:
Can you paste the code used to "enabling the JPA persistence"?
On Sun, Aug 9, 2009 at 4:35 PM, SBalakrishnan
<Sanjay.Balakrishnan(a)fnis.com>wrote:
>
> Hi,
>
> I am new to drools flow and have the question below.
>
> After enabling persisentence (JPA) on the process side and
> using the out of the box WSHumanTaskHandler.
>
> Ran into a java.lang.NullPointerException on completing
> the Human Task (used the Eclipse Human Task view to do it)
>
> [2009:08:221 14:08:765:exception] Uncaught exception on client
> java.lang.NullPointerException
> at
>
>
org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:83)
> at
>
>
org.drools.process.workitem.wsht.WSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(WSHumanTaskHandler.java:282)
> at
>
> org.drools.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:67)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:752)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:832)
> at
>
>
org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:379)
> at
>
>
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:173)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:832)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.messageReceived(DefaultIoFilterChain.java:616)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)
> at
>
>
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:408)
> at
>
>
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:578)
> at
>
>
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:540)
> at
>
>
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:532)
> at
>
>
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:58)
> at
>
>
org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:857)
> at
>
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source)
> at java.lang.Thread.run(Unknown Source)
>
>
>
> Am I missing something or does the WSHumanTaskHander not support
> the above ?
>
>
> Note:-
> Was able to get these pieces working when process was
> not using JPA persistence.
>
> Thanks
> Sanjay
> --
> View this message in context:
>
http://www.nabble.com/Process-Persistence-%28JPA%29-and-the-WSHumanTaskHa...
> Sent from the drools - user mailing list archive at
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
--
-
http://salaboy.wordpress.com
-
http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
View this message in context:
http://www.nabble.com/Process-Persistence-%28JPA%29-and-the-WSHumanTaskHa...
Sent from the drools - user mailing list archive at
Nabble.com.