Spring 3 + jbpm 4.4 + hibernate 3.3 + JPA + JTA integration error.
ayusman_dikshit Jul 4, 2011 10:57 AMAll,
I have been able to make some progress in terms of integrating my current project with jbpm, based on the link below:
http://captaincaveman.posterous.com/jbpm-43-spring-3-jboss-jpa-jta-configuration
With minor modifications, the set up was pretty much close. However, after all the configuration changes are done, I do face this error during server start-up.
[7/4/11 19:38:05:491 IST] 00000011 FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\Program Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_57ff57ff_11.07.04_19.38.05.3343817305385213655618.txt com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated 1341
[7/4/11 19:38:05:506 IST] 00000011 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.NoClassDefFoundError: org.jbpm.api.ProcessEngine
at java.lang.Class.getDeclaredFieldsImpl(Native Method)
at java.lang.Class.getDeclaredFields(Class.java:550)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:372)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:320)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:798)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:493)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1707)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:380)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:299)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:731)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:616)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:668)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1122)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1319)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:610)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:944)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:725)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$1.run(ApplicationMgrImpl.java:1266)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:4582)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:4760)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1271)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2043)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:439)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:382)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:653)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:615)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1085)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:966)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:773)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1332)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1225)
at com.ibm.ws.management.remote.AdminServiceForwarder.invoke(AdminServiceForwarder.java:334)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1438)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:83)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1276)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1371)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:799)
at javax.management.remote.rmi._RMIConnectionImpl_Tie.invoke(_RMIConnectionImpl_Tie.java:750)
at javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:158)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:623)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:476)
at com.ibm.rmi.iiop.ORB.process(ORB.java:513)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1574)
at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2845)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2718)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: java.lang.ClassNotFoundException: org.jbpm.api.ProcessEngine
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:90)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:541)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
... 77 more[7/4/11 19:38:05:538 IST] 00000011 webcontainer I com.ibm.ws.wswebcontainer.VirtualHost addWebApplication SRVE0250I: Web Module NAPSWeb has been bound to default_host[*:9081,*:80,*:9444,*:5063,*:5062,*:443].
[7/4/11 19:38:05:553 IST] 00000011 ApplicationMg A WSVR0221I: Application started: NAPS
[7/4/11 19:38:05:553 IST] 00000011 CompositionUn A WSVR0191I: Composition unit WebSphere:cuname=NAPS in BLA WebSphere:blaname=NAPS started.
[7/4/11 19:38:06:147 IST] 0000001f FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\Program Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_19071907_11.07.04_19.38.06.1471603185250462490371.txt com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet 208
[7/4/11 19:38:06:163 IST] 0000001f servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper run [Servlet Error]-[class java.lang.ClassNotFoundException: com.ibm.etools.utc.servlet.InitializeServlet]: java.lang.ClassNotFoundException: class java.lang.ClassNotFoundException: com.ibm.etools.utc.servlet.InitializeServlet
at java.beans.Beans.instantiate(Beans.java:190)
at java.beans.Beans.instantiate(Beans.java:75)
at com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run(ServletWrapper.java:1909)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadServlet(ServletWrapper.java:1900)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:730)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
I do have the jbpm.jar file in the classpath (it's in the WEB-INF\lib folder.)
This is bit of a suprise to me. Has anybody faced similar problem?
System configuration:
RAD 7.5 and WAS 7.0.0.15 Test Environment on Windows XP SP3.
DB server: SQL Server.
I added the following to my already working spring applicationContext.xml file:
<!-- Added for JBPM START --> <!-- Activates a load-time weaver for the context. Any bean within the context that implements LoadTimeWeaverAware (such as LocalContainerEntityManagerFactoryBean) will receive a reference to the auto-detected load-time weaver. --> <!-- <context:load-time-weaver aspectj-weaving="on" />--> <!-- Turn on AspectJ @Configurable support. As a result, any time you instantiate an object, Spring will attempt to perform dependency injection on that object. This occurs for instantiation via the "new" keyword, as well as via reflection. This is possible because AspectJ is used to "weave" Roo-based applications at compile time. In effect this feature allows dependency injection of any object at all in your system, which is a very useful feature (without @Configurable you'd only be able to dependency inject objects acquired from Spring or subsequently presented to a specific Spring dependency injection method). Roo applications use this useful feature in a number of areas, such as @PersistenceContext injection into entities. --> <context:spring-configured /> <!-- This declaration will cause Spring to locate every @Component, @Repository and @Service in your application. In practical terms this allows you to write a POJO and then simply annotate the new POJO as an @Service and Spring will automatically detect, instantiate and dependency inject your service at startup time. Importantly, you can then also have your new service injected into any other class that requires it simply by declaring a field for your service inside the relying class and Spring will inject it. Furthermore, this turns on @Autowired, @PostConstruct etc support. These annotations allow you to use common Spring and Java Enterprise Edition annotations in your classes without needing to do any special configuration. The most commonly used annotation is @Autowired, which instructs Spring to dependency inject an object into your class. --> <context:component-scan base-package="com.test" /> <!-- enables interpretation of the @Required annotation to ensure that dependency injection actually occurs --> <bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/> <!-- Activates various annotations to be detected in bean classes: Spring's @Required and @Autowired, as well as JSR 250's @PostConstruct, @PreDestroy and @Resource (if available) and JPA's @PersistenceContext and @PersistenceUnit (if available). --> <context:annotation-config transaction-manager="transactionManager" /> <!-- Instruct Spring to retrieve and apply @AspectJ aspects which are defined as beans in this context. --> <!-- <aop:aspectj-autoproxy proxy-target-class="true" />--> <!-- The JNDI Hibernate session factory will not work for jBPM 4.4 as jBPM is expecting a Spring LocalSessionFactoryBean. So we specify our mappings here. This will only be used by jBPM. Spring will still inject the container managed persistence unit anywhere you use @PersistenceContext. --> <!-- <jee:jndi-lookup id="sessionFactory" jndi-name="java:/SquareOneHibernateSessionFactory" /> --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- <property name="configLocation" value="classpath:/jbpm/jbpm.hibernate.cfg.xml" /> --> <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>jbpm.repository.hbm.xml</value> <value>jbpm.execution.hbm.xml</value> <value>jbpm.history.hbm.xml</value> <value>jbpm.task.hbm.xml</value> <value>jbpm.identity.hbm.xml</value> </list> </property> <!-- Hibernate properties needed to configure the session factory to use JTA. This will ensure that jBPM can participate in the application's JTA transactions. --> <property name="hibernateProperties"> <props> <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</prop> <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereTransactionManagerLookup</prop> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop> <prop key="hibernate.connection.datasource">java:jdbc/my_dataSource</prop> <prop key="jta.UserTransaction">java:comp/UserTransaction</prop> <prop key="hibernate.hbm2ddl.auto">false</prop> <!-- <prop key="hibernate.default_schema">dbo</prop>--> </props> </property> </bean> <!-- jBPM beans. Based on the jBPM provided way of creating a Spring process engine set up. This can also be done by calling the Process engine methods with parameters directly. However this is the most appropriate way of initializing jBPM. --> <!-- <util:properties id="my_jbpm_config" location="classpath:/resources/my.jbpm.cfg.xml"/>--> <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper"> <property name="jbpmCfg" value="/WEB-INF/resources/my.jbpm.cfg.xml"/> </bean> <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" scope="singleton"/> <!-- Added for JBPM END --> Any pointers will be of great help. Thanks, Ayusman Also... I just wanted to do the following with in the web-application.. to verify that I atleast have the handle to jbpm from with in spring... @Autowired private static ProcessEngine processEngine; . . . . . public void foo() { log.debug("START jbpm processing..."); if (null != processEngine ) { RepositoryService rs = processEngine.getRepositoryService(); ExecutionService es = processEngine.getExecutionService(); TaskService taskService = processEngine.getTaskService(); DeploymentQuery dq = rs.createDeploymentQuery(); log.debug("Deployment count: "+dq.count()); ProcessInstanceQuery piq = es.createProcessInstanceQuery(); log.debug("Total number of process instances is: "+ piq.count()); } else { log.error("Process engine object is null"); } log.debug("END jbpm processing..."); } just incase it matters