[jboss-user] [JBoss jBPM] - Integration problem of jBPM 4, Spring and Hibernate
KeithWong123
do-not-reply at jboss.com
Mon Aug 3 07:57:32 EDT 2009
I would like to integrate Spring and jBPM 4 (with Hibernate) but find the following problems. Can anybody help to indicate what is wrong? Or are there any working example which demonstrate how to do the integration?
The problem is:
Program:
*******************************************
import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.pvm.internal.env.PvmEnvironment;
import org.jbpm.pvm.internal.env.SpringContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import Service.ProductManager;
public class Test{
private static ProductManager pm;
public static void main(String args[]){
ApplicationContext ac = new ClassPathXmlApplicationContext(new String[] {"applicationContext-test.xml"});
EnvironmentFactory environmentFactory = (EnvironmentFactory) new PvmEnvironment(new JbpmConfiguration());
Environment environment = environmentFactory.openEnvironment();
environment.setContext(new SpringContext(ac));
}
}
Console output:
*******************************************
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.jbpm.spring.cfg.SpringConfigurationFactoryBean] for bean with name 'jbpmConfiguration' defined in class path resource [applicationContext-test.xml]; nested exception is java.lang.ClassNotFoundException: org.jbpm.spring.cfg.SpringConfigurationFactoryBean
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1174)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:754)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
at Test.main(Test.java:17)
Caused by: java.lang.ClassNotFoundException: org.jbpm.spring.cfg.SpringConfigurationFactoryBean
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:249)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:381)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1135)
... 9 more
This is my applicationContent.xml:
*******************************************
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
classpath:hibernate.cfg.xml
<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
*******************************************
Looking forward for your reply.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247570#4247570
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247570
More information about the jboss-user
mailing list