[jboss-user] [jBPM] - Re: Error creating bean with name 'taskResourceFactory' defined in class path resource [META-INF/spring/applicationContext.xml]

Kris Verlaenen do-not-reply at jboss.com
Wed Sep 26 10:58:16 EDT 2012


Kris Verlaenen [https://community.jboss.org/people/KrisVerlaenen] created the discussion

"Re: Error creating bean with name 'taskResourceFactory' defined in class path resource [META-INF/spring/applicationContext.xml]"

To view the discussion, visit: https://community.jboss.org/message/761688#761688

--------------------------------------------------------------
Hi,

I wasn't able to reproduce the exact issue (due to some missing classes and not having the same context setup), but here's an example that successfully loads the human task service:

        ClassPathXmlApplicationContext context =
            new ClassPathXmlApplicationContext("spring-conf.xml");

        TaskSessionSpringFactoryImpl springFactory =
            (TaskSessionSpringFactoryImpl) context.getBean("springTaskSessionFactory");       
        springFactory.initialize();

        org.jbpm.task.service.TaskService internalTaskService = 
            (org.jbpm.task.service.TaskService) context.getBean("taskService");
        TaskService taskService = new LocalTaskService(internalTaskService);
        System.out.println("Done setting up " + taskService);

With the following spring configuration file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans"
       xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jbpm=" http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring"       
       xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                            http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.5.0.xsd">

  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.h2.Driver"/>
    <property name="url" value="jdbc:h2:tcp://localhost/~/jbpm-db"/>
    <property name="username" value="sa"/>
    <property name="password" value=""/>
  </bean>

  <bean id="jbpmEMF" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="persistenceUnitName" value="org.jbpm.persistence.jpa.local"/>
  </bean>

  <bean id="jbpmTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="jbpmEMF"/>
    <property name="nestedTransactionAllowed" value="false"/>
  </bean>

  <bean id="htTxMgr" class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager">
    <constructor-arg ref="jbpmTxManager" />
  </bean>

  <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory" factory-method="getSystemEventListener" /> 
  <bean id="taskService" class="org.jbpm.task.service.TaskService" >
    <property name="systemEventListener" ref="systemEventListener" />
  </bean>

  <bean id="springTaskSessionFactory" class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl" depends-on="taskService" >
    <property name="entityManagerFactory" ref="jbpmEMF" />
    <property name="transactionManager" ref="htTxMgr" />
    <property name="useJTA" value="true" />
    <property name="taskService" ref="taskService" />
  </bean> 

</beans>

Hope this helps.

Kris
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/761688#761688]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120926/d3bdc4b3/attachment-0001.html 


More information about the jboss-user mailing list