06-09-2011 07:15 AM
<!– lookup the JTA-Transaction manager –>
<bean id="transactionManager" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/TransactionManager"></property>
<property name="resourceRef" value="true" />
</bean>
<!– process engine configuration –>
<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration">
<property name="dataSourceJndiName" value="java:ActivitiDS" />
<property name="transactionManager" ref="transactionManager" />
<property name="transactionsExternallyManaged" value="true" />
<property name="databaseSchemaUpdate" value="drop-create" />
<property name="mailServerHost" value="localhost" />
<property name="mailServerPort" value="2525" />
</bean>
I get this output in the Websphere console:[06.06.11 13:06:35:858 CEST] 00000020 RemoteExcepti E CNTR0019E: EJB threw an unexpected (non-declared) exception during invocation of method "startProcessInstanceByKey". Exception data: com.ibm.ejs.container.CreateFailureException: ; nested exception is:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in class path resource [activiti.cfg.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [activiti.cfg.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name not found in context "java:".
…
Caused by: javax.naming.NameNotFoundException: Name not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:394)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154)
at javax.naming.InitialContext.lookup(InitialContext.java:455)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
<bean id="transactionManager"
class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
<!– process engine configuration –>
<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration">
<property name="dataSourceJndiName" value="jdbc/activitiDSH2" />
<property name="transactionManager" ref="transactionManager" />
<property name="transactionsExternallyManaged" value="true" />
<property name="databaseSchemaUpdate" value="false" />
<property name="mailServerHost" value="localhost" />
<property name="mailServerPort" value="2525" />
</bean>
And I get this output:[06.06.11 13:12:20:699 CEST] 00000020 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from class path resource [activiti.cfg.xml]
[06.06.11 13:12:20:840 CEST] 00000020 ProcessEngine I Activiti service failed to initialize, see above.
[06.06.11 13:12:20:840 CEST] 00000020 RemoteExcepti E CNTR0019E: EJB threw an unexpected (non-declared) exception during invocation of method "startProcessInstanceByKey". Exception data: com.ibm.ejs.container.CreateFailureException: ; nested exception is:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in class path resource [activiti.cfg.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.transaction.jta.WebSphereUowTransactionManager' to required type 'javax.transaction.TransactionManager' for property 'transactionManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.transaction.jta.WebSphereUowTransactionManager] to required type [javax.transaction.TransactionManager] for property 'transactionManager': no matching editors or conversion strategy found
at com.ibm.ejs.container.StatelessBeanO.initialize(StatelessBeanO.java:404)
…
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.transaction.jta.WebSphereUowTransactionManager] to required type [javax.transaction.TransactionManager] for property 'transactionManager': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:289)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:154)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:452)
… 69 more
06-09-2011 07:35 AM
06-14-2011 12:23 PM
11-17-2011 08:30 AM
11-22-2011 07:37 AM
<bean id="transactionManager"
class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
<!– process engine configuration –>
<bean id="processEngineConfiguration"
class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSourceJndiName" value="jdbc/activitiDSH2" />
<property name="transactionManager" ref="transactionManager" />
<property name="transactionsExternallyManaged" value="true" />
<property name="databaseSchemaUpdate" value="false" />
<property name="mailServerHost" value="localhost" />
<property name="mailServerPort" value="2525" />
</bean>
<bean id="wsTransactionManager"
class="de.ingo.spring.WebSphereJtaTransactionManager" >
<property name="autodetectTransactionManager" value="false"/>
</bean>
<bean id="transactionManager"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="wsTransactionManager"/>
<property name="targetMethod" value="getTransactionManager"/>
</bean>
<!– process engine configuration –>
<bean id="processEngineConfiguration"
class="de.ingo.activiti.engine.impl.cfg.MySubclassFromProcessEngineConfiguration">
<property name="dataSourceJndiName" value="jdbc/activitiDSH2" />
<property name="transactionManager" ref="transactionManager" />
<property name="transactionsExternallyManaged" value="true" />
<property name="databaseSchemaUpdate" value="false" />
<property name="mailServerHost" value="localhost" />
<property name="mailServerPort" value="2525" />
</bean>
package de.ingo.spring;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.transaction.TransactionManager;
import org.springframework.transaction.TransactionSystemException;
import org.springframework.transaction.jta.JtaTransactionManager;
public class WebSphereJtaTransactionManager extends JtaTransactionManager {
private static final String FACTORY_CLASS_5_1 = "com.ibm.ws.Transaction.TransactionManagerFactory";
private static final String FACTORY_CLASS_5_0 = "com.ibm.ejs.jts.jta.TransactionManagerFactory";
private static final String FACTORY_CLASS_4 = "com.ibm.ejs.jts.jta.JTSXA";
private static final long serialVersionUID = 1L;
@Override
protected TransactionManager retrieveTransactionManager()
throws TransactionSystemException {
Class<?> clazz;
try {
logger.debug("Trying WebSphere 5.1+: " + FACTORY_CLASS_5_1);
clazz = Class.forName(FACTORY_CLASS_5_1);
logger.info("Found WebSphere 5.1+: " + FACTORY_CLASS_5_1);
}
catch (ClassNotFoundException ex) {
logger.debug("Could not find WebSphere 5.1/6.0 TransactionManager factory class", ex);
try {
logger.debug("Trying WebSphere 5.0: " + FACTORY_CLASS_5_0);
clazz = Class.forName(FACTORY_CLASS_5_0);
logger.info("Found WebSphere 5.0: " + FACTORY_CLASS_5_0);
}
catch (ClassNotFoundException ex2) {
logger.debug("Could not find WebSphere 5.0 TransactionManager factory class", ex2);
try {
logger.debug("Trying WebSphere 4: " + FACTORY_CLASS_4);
clazz = Class.forName(FACTORY_CLASS_4);
logger.info("Found WebSphere 4: " + FACTORY_CLASS_4);
}
catch (ClassNotFoundException ex3) {
logger.debug("Could not find WebSphere 4 TransactionManager factory class", ex3);
throw new TransactionSystemException(
"Could not find any WebSphere TransactionManager factory class, " +
"neither for WebSphere version 5.1+ nor 5.0 nor 4");
}
}
}
try {
Method method = clazz.getMethod("getTransactionManager", (Class []) null);
return (TransactionManager) method.invoke(null, (Object []) null);
}
catch (InvocationTargetException ex) {
throw new TransactionSystemException(
"WebSphere's TransactionManagerFactory.getTransactionManager method failed", ex.getTargetException());
}
catch (Exception ex) {
throw new TransactionSystemException(
"Could not access WebSphere's TransactionManagerFactory.getTransactionManager method", ex);
}
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.