[rules-users] Problems setting MySQL for the human task process server....

Cristiano Gavião cvgaviao at gmail.com
Sat Jan 31 18:36:03 EST 2009


Hi,

I was trying to change the persistence settings for human task process  
server for using MySQL instead of H2DB.

I was following the Drools Flows Documentation on chapter 5.1.3.:  
Configuring Persistence.(https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html_single/index.html 
#d0e1157)

I read on docs that I should override the persistence.xml of the  
drools-process-enterprise.jar, create the drools.session.conf with  
some contents (i don`t undestand` what it is...) and put them on my  
project META-INF directory... ok?

I created the files as stated on docs but it didn't work...  My  
example runned ok, but using the H2DB and not my MYSQL.

		// Use persistence.xml configuration
		emf =  
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
		taskService = new TaskService(emf);
		taskSession = taskService.createSession();
		server = new MinaTaskServer(taskService);
		Thread thread = new Thread(server);
		thread.start();
		Thread.sleep(500);
		System.out.println("Server started ...");

		<properties>
			<property name="hibernate.dialect"  
value="org.hibernate.dialect.MySQL5Dialect" />
			<property name="hibernate.connection.driver_class"  
value="com.mysql.jdbc.Driver" />
			<property name="hibernate.connection.url" value="jdbc:mysql:// 
localhost/drools" />
			<property name="hibernate.connection.username" value="root" />
			<property name="hibernate.connection.password" value="" />
			<property name="hibernate.connection.autocommit" value="false" />
			<property name="hibernate.max_fetch_depth" value="3" />
			<property name="hibernate.hbm2ddl.auto" value="create-drop" />
			<property name="hibernate.show_sql" value="true" />
		</properties>


After some investigation I could see that the example recommended by  
Mark Proctor (TaskLifeCycleTest.java, and others that use  
MinaTaskServer) use <persistence-unit name = "org.drools.task"> that  
is setting on drools-process-task.jar and not the  
"org.drools.persistence.jpa" on drools-process-enterprise.jar as  
stated on documentation...

First question, which one should I use for use the Drools Flows Server  
and Client?

         emf =  
Persistence.createEntityManagerFactory( "org.drools.task" );

	emf =  
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");


I test the first option. I changed the persistence.xml file and use  
the code below:

		// Use persistence.xml configuration
		emf = Persistence.createEntityManagerFactory("org.drools.task");
		taskService = new TaskService(emf);
		taskSession = taskService.createSession();
		server = new MinaTaskServer(taskService);
		Thread thread = new Thread(server);
		thread.start();
		Thread.sleep(500);
		System.out.println("Server started ...");



Hummm.... It runs and connect well to my MySQL. but now it brings me a  
error...


java.lang.IllegalArgumentException: Named query not found:  
UnescalatedDeadlines
	at  
org 
.hibernate 
.ejb 
.AbstractEntityManagerImpl 
.createNamedQuery(AbstractEntityManagerImpl.java:108)
	at org.drools.task.service.TaskService.<init>(TaskService.java:84)
	at org.drools.task.service.TaskService.<init>(TaskService.java:68)



It sounds like it was not possible to find orm.xml that is on META-INF  
of drools-process-task.jar.

But when I copy the orm.xml file to my project META-INF it works ok....


Could someone give some ideas how can I solve this problem..

Thanks a lot


Cristiano


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090131/0f77ee30/attachment.html 


More information about the rules-users mailing list