Issue with including BPMN file in RuntimeEnvironment - spring

Im new to JBPM Im trying to configure Junit with spring and JBPM. The Problem Im facing is while running the test case when it loads application context xml. I get the below exception.
java.lang.IllegalStateException: Failed to load ApplicationContext
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runtimeEnvironment': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Cannot add asset: Process Compilation error Type mismatch: cannot convert from boolean to Object
Type mismatch: cannot convert from boolean to Object,
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:127)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1600)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 44 more
Caused by: java.lang.IllegalArgumentException: Cannot add asset: Process Compilation error Type mismatch: cannot convert from boolean to Object
Type mismatch: cannot convert from boolean to Object,
at org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment.addAsset(SimpleRuntimeEnvironment.java:171)
at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.addAsset(RuntimeEnvironmentBuilder.java:341)
at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.addAsset(RuntimeEnvironmentBuilder.java:74)
at com.citi.common.workflow.factory.RuntimeEnvironmentFactoryBean.getObject(RuntimeEnvironmentFactoryBean.java:135)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 49 more
find below the configuration it fails adding the assest
<bean id="xxx" factory-method="newClassPathResource"
class="org.kie.internal.io.ResourceFactory">
<constructor-arg>
<value>config/local/jbpm/processes/yyy.bpmn2</value>
</constructor-arg>
</bean>
<bean id="runtimeEnvironment"
class="com.citi.common.workflow.factory.RuntimeEnvironmentFactoryBean">
<property name="type" value="DEFAULT" />
<property name="assets">
<map>
<entry key-ref="xxx">
<util:constant static-field="org.kie.api.io.ResourceType.BPMN2" />
</entry>
</map>
</property>
<property name="userInfo" ref="jbpmUserInfo" />
<property name="taskService" ref="taskService" />
<property name="entityManagerFactory" ref="xxxEntityManagerFactoryBean" />
<property name="transactionManager" ref="xxxTransactionManager"/>
</bean>
I am using JBPM-6.5.0 I also tried compiling the class files to JAVA 1.7 but still getting same error any help will be appreciated.

Including the below dependency in my pom resolved the issue.
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-test</artifactId>
<version>${jbpm.version}</version>
<scope>test</scope>
</dependency>

Related

Spring Social applicationURL setup exception

For Spring Social version 1.1.0.RELEASE, I need to set up the applicationUrl for the ProviderSignInController, as my application (a Tomcat app) is hosted behind a proxy (Apache web server). According the Spring Social document, I set it up as below:
<bean id="providerSignInController"
class="org.springframework.social.connect.web.ProviderSignInController">
<property name="signInUrl" value="/accounts/login" />
<property name="signUpUrl" value="/accounts/signup" />
<property name="postSignInUrl" value="/accounts/profile" />
<property name="applicationUrl" value="${applicationUrl}" />
</bean>
However, when deploying the application, I get an exception in Tomcat catalina.out saying:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'applicationUrl' threw exception; nested exception is
java.lang.NullPointerException>org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0'
defined in ServletContext resource [/WEB-INF/spring-servlet.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'providerSignInController' defined in ServletContext
resource [/WEB-INF/spring-servlet.xml]: Error setting property values;
nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'applicationUrl' threw exception; nested exception is
java.lang.NullPointerException
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
Any suggestions please? Thanks.
It should be a bug with class ProviderSignInController in Spring Social version 1.1.0.RELEASE. In class ProviderSignInController, connectSupport is created after properties being set:
public void afterPropertiesSet() throws Exception {
this.connectSupport = new ConnectSupport(sessionStrategy);
this.connectSupport.setUseAuthenticateUrl(true);
};
Therefore when method setApplicationUrl is invoked, connectSupport is still null.
Now when I configure it in the way shown below, it works. Or if I revert to version 1.0.3.RELEASE, it works fine too.
<bean id="providerSignInController"
class="org.springframework.social.connect.web.ProviderSignInController">
<property name="signInUrl" value="/accounts/login" />
<property name="signUpUrl" value="/accounts/signup" />
<property name="postSignInUrl" value="/accounts/profile" />
</bean>
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="providerSignInController" />
<property name="targetMethod" value="setApplicationUrl" />
<property name="arguments">
<list>
<bean class="java.lang.String">
<constructor-arg value="${applicationUrl}" />
</bean>
</list>
</property>
</bean>
Follow-up
This problem has been resolved in Spring Social version 1.1.3.RELEASE. In class ProviderSignInController, method afterPropertiesSet has been updated to:
public void afterPropertiesSet() throws Exception {
this.connectSupport = new ConnectSupport(sessionStrategy);
this.connectSupport.setUseAuthenticateUrl(true);
if (this.applicationUrl != null) {
this.connectSupport.setApplicationUrl(applicationUrl);
}
};
As a result, the workaround of configuration given above (by the way, would not work with Spring Social version 1.1.3.RELEASE any more) can now be simplified to:
<bean id="providerSignInController"
class="org.springframework.social.connect.web.ProviderSignInController">
<property name="signInUrl" value="/accounts/login" />
<property name="signUpUrl" value="/accounts/signup" />
<property name="postSignInUrl" value="/accounts/profile" />
<property name="applicationUrl" value="${applicationUrl}" />
</bean>

Datasource issue on liberty in Spring hibernate Application

I have a spring and hibernate application that we are trying to port from Jboss to WAS Liberty profile. When the spring factory gets initialized I am getting below error
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myDatasource': Post-processing of the FactoryBean's object failed; nested exception is org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine superclass of missing type com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource [Xlint:cantFindType]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:165)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1441)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) ... 87 more Caused by: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine superclass of missing type com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource [Xlint:cantFindType]
at org.aspectj.weaver.reflect.ReflectionWorld$ExceptionBasedMessageHandler.handleMessage(ReflectionWorld.java:129)
at org.aspectj.weaver.Lint$Kind.signal(Lint.java:325)
at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.raiseCantFindType(MissingResolvedTypeWithKnownSignature.java:232)
at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.getSuperclass(MissingResolvedTypeWithKnownSignature.java:98)
at org.aspectj.weaver.patterns.KindedPointcut.fastMatch(KindedPointcut.java:144)
at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.couldMatchJoinPointsInType(PointcutExpressionImpl.java:82)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:236)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:198)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:252)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:284)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1598)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) ... 92 more
My Server has following datasource config
<dataSource id="MyDS" jdbcDriverRef="Oracle" jndiName="jdbc/myDS">
The datasource bean on application context is defined as below
<bean id="myDatasource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/myDS" />
</bean>
I would appreciate help. It seems something to do with classloading but I am not able to figure out.
try to specify the following properties to your datasource bean definition:
<bean id="myDatasource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/myDS"/>
<property name="lookupOnStartup" value="false"/>
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.sql.DataSource" />
</bean>
The proxyInterface solution worked for me on WAS 8.5.5 Liberty Profile.
On WAS 7, this also works as an alternate solution:
<jee:jndi-lookup id="WASdataSource" jndi-name="java:comp/env/jdbc/admt" />
<bean id="dataSource" class="org.springframework.jdbc.datasource.WebSphereDataSourceAdapter">
<property name="targetDataSource" ref="WASdataSource"/>
</bean>

custom thymeleaf dialect registration causing exception

in applicationContext.xml
<bean id="templateEngine"
class="org.thymeleaf.spring3.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
<property name="additionalDialects">
<set>
<bean class="org.test.custom.CustomDialact" />
</set>
</property>
</bean>
Stacktrace:
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'additionalDialects' of bean class [org.thymeleaf.spring3.SpringTemplateEngine]: Bean property 'additionalDialects' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1424)
... 50 more
i don't know but it was fixed after restarting machine. but mean while i find another solution
by extend a custom class with HashSet and in constructor add custom dialect in it and declare it in xml. provide it reference to additionalDialects . thats it .it will start running . it think it is problem related to generics as spring sometimes supply empty type
like HashSet<V> .

#Resource dataSource mappedName - overriding to test in non JNDI env

I have an existing service bean which we deployed in Jboss. Unfortunatly it's dataSource reference is configured to inject the datasource reference via the "mappedName" lookup of the JNDI Service.
#Resource(name = "dataSource", mappedName = "java:/OracleDS")
private DataSource dataSource = null;
I want to test the bean in a non JNDI env. I expected to get this exception when i run in a non JNDI env.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'myService': Injection of resource fields failed; nested exception
is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean
definition with name 'java:/OracleDS' defined in JNDI environment: JNDI lookup
failed; nested exception is javax.naming.NoInitialContextException: Need to
specify class name in environment or system property, or as an applet parameter,
or in an application resource file: java.naming.factory.initial
I realise the quickest way to fix this is to dropped the mappedName restriction, since then the production or test spring context can define the datasource. But in the case that i can't do this. Is there a way to define an InitialContext via a test spring context to avoid the exception above.
I did some more reading on SimpleNamingContextBuilder and came up with this context setup for my test case. The trick being to use the MethodInvokingFactoryBean to ensure the bind() method is called.
<bean id="jndiContext" class="org.springframework.mock.jndi.SimpleNamingContextBuilder" factory-method="emptyActivatedContextBuilder"/>
<bean id="invokingFactoryBean"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject">
<ref local="jndiContext" />
</property>
<property name="targetMethod">
<value>bind</value>
</property>
<property name="arguments">
<list>
<value>java:/OracleDS</value>
<ref bean="dataSource" />
</list>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${datasource.driverClassName}" />
<property name="url" value="${datasource.url}" />
<property name="username" value="${datasource.username}" />
<property name="password" value="${datasource.password}" />
</bean>

Spring, Atomikos, Tibco EMS 5.1 integration issue

I am trying to configure Atomikos in my Spring application. I am using:
Atomikos 3.7.1 (TransactionsEssentials)
Spring 3.0.2
Tibco EMS 5.1
Can some one give me the configuration details for the connection factory using JNDI for JMS and also details regarding Tibco EMS configuration?
I had tried the following:
<bean id="jmsTemplate2" class="org.springframework.jms.core.JmsTemplate" >
<property name="connectionFactory" ref="amqConnectionFactory" />
<property name="defaultDestination" ref="queue" />
<property name="sessionTransacted" value="true"/>
<property name="messageConverter" ref="messageConverter"></property>
</bean>
<bean id="amqConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init">
<property name="uniqueResourceName" value="XAEMS" />
<property name="xaConnectionFactory" ref="connectionFactory" />
<property name="poolSize" value="10" />
</bean>
<jee:jndi-lookup id="connectionFactory" jndi-name="emsConnectionFactory">
<jee:environment>
java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
java.naming.provider.url=tibjmsnaming://localhost:7222
</jee:environment>
</jee:jndi-lookup>
<jee:jndi-lookup id="queue" jndi-name="emsQueue">
<jee:environment>
java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
java.naming.provider.url=tibjmsnaming://localhost:7222
</jee:environment>
</jee:jndi-lookup>
But get this error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amqConnectionFactory' defined in file [C:\springsource\vfabric-tc-server-developer-2.6.4.RELEASE\spring-insight-instance\wtpwebapps\iRebal-Backend-Poc-Web-Integration-Final-xa\WEB-INF\classes\META-INF\spring\batch\jobs\priority-queue.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory' to required type 'javax.jms.XAConnectionFactory' for property 'xaConnectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory] to required type [javax.jms.XAConnectionFactory] for property 'xaConnectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 39 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory' to required type 'javax.jms.XAConnectionFactory' for property 'xaConnectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory] to required type [javax.jms.XAConnectionFactory] for property 'xaConnectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl
This answer is too late for the OP, but for the sake of posterity:
The class you want is com.tibco.tibjms.TibjmsXAConnectionFactory.
It seems that in class com.atomikos.jms.AtomikosConnectionFactoryBean you have a field named xaConnectionFactory that its type (or its getter return type) is javax.jms.XAConnectionFactory. However, in Spring configuration file, you configured that field to be set with an instance of which type is com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory.
Apparently com.tibco.tibjms.naming.TibjmsFederatedQueueConnectionFactory is not convertible to javax.jms.XAConnectionFactory.

Resources