a beanFactoryReference already exists for key jbpmConfiguration
I see a few people are having this problem, but it is not pointing me in any direction. I have set up Jbpm per the docs and have a workflowDAO object that takes the JbpmTemplate via a DI method. This DAO is then used by a service level object which is injected into various Spring MVC controllers. Unfortunately when the application context is almost done starting up in my tomcat server, I get the error:
"a beanFactoryReference already exists for key jbpmConfiguration"
I have been running jBPM 3.0 for a while and now am migrating to 3.1, but this is keeping me from running my local dev server properly. Any pointers are greatly appreciated. Below are snippets from my springapp-*.xml files.
Thanks for any input,
Julian
Spring 2.0.2
Jbpm 3.1.4
Spring-modules 0.7
Java 5
Tomcat 5.5.x
Root springapp file (has import statements to other springapp-* files for other beans:
Code:
...
<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="workflowDataSource"/>
</property>
<property name="mappingLocations">
<value>classpath*:/org/jbpm/**/*.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
</props>
</property>
<property name="schemaUpdate" value="true"/>
</bean>
<!-- jBPM configuration -->
<bean id="jbpmConfiguration"
class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
<property name="sessionFactory" ref="hibernateSessionFactory"/>
<property name="configuration" value="classpath:jbpm.cfg.xml"/>
<property name="createSchema" value="true"/>
</bean>
<!-- jBPM template -->
<bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
<constructor-arg index="0" ref="jbpmConfiguration"/>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="hibernateSessionFactory"/>
</bean>
<bean id="manager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target" ref="jbpmTemplate"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED, ISOLATION_READ_COMMITTED</prop>
</props>
</property>
</bean>
...
springapp-data-access.xml
Code:
...
<bean id="workflowDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/workflow"/>
</bean>
<bean id="workflowDAO" class="com.ethidium.wEMR.dao.WorkflowDAO">
<property name="jbpmTemplate" ref="jbpmTemplate"/>
</bean>
...
And again various service level beans and MVC controller's use the workflowDAO via DI methods.
1 Attachment(s)
Same problem - a beanFactoryReference already exists for key jbpmConfiguration
Hi Julian,
I am getting the same error. Can you please elaborate this "I reconfigured my use of the import statements in the spring*.xml files and my web.xml" ?
FYI, I have not written any classes for Workflow so far, I am just loading a Simple workflow at this point in time.
Please find attached my web.xml and Spring xml.
Thanks in Advance
Shashank
similar but not same problem
Hi there,
i am getting the same errormessage and from what i have read, the problem is that the applicationContext is getting loaded several times. But because i'm running several JUnit tests, this is actually what i want.
In my Project, each TestCase-Class has its own applicationContext:
MyFirstTest.java [JUnit Test]
MyFirstTest-Context.xml [Spring App.Context]
MySecondTest.java [JUnit Test]
MySecondTest-Context.xml [Spring App.Context]
...aso.
If I run the tests in isolation, everything works fine, but when i build a TestSuite including and executing all Test-Classes in a row i get the above Error:
Quote:
a beanFactoryReference already exists for key jbpmConfiguration
Actually the error only occurs if i have two (or more) TestClasses in my Suite that include a jbpmConfiguration in their applicationContext.
So i guess the jbpmConfiguration "survives" the loading of a new Test-Context. Why is this? Is there a workaround, allowing me to run all tests in a TestSuite, with different applicationContexts for each TestClass?
The Issue is also mentioned in the jBPM-Forums:
Quote:
jboss.com/index.html?module=bb&op=viewtopic&p=4145969#414596 9
There is no solution, but they suggest bringing it up here, so i did.
Best Regards,
Fredde