I am trying to use JBpm with JTA.
Here's what I have done so far (as highlighted by the documentation):
As part of the deployment procedure, jbpm-3.1.jar become jbpm.har with the
following jboss-service.xml:
<?xml version="1.0" encoding="UTF-8"?>
| <server>
| <mbean code="org.jboss.hibernate.jmx.Hibernate"
name="jboss.har:service=Hibernate">
| <attribute name="DatasourceName">java:/JbpmDS</attribute>
| <attribute
name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
| <attribute
name="Dialect">org.hibernate.dialect.Oracle9Dialect</attribute>
| <attribute
name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
| </mbean>
| </server>
Here's the datasource's descriptor:
| <?xml version="1.0" encoding="UTF-8"?>
| <datasources>
| <local-tx-datasource>
| <jndi-name>JbpmDS</jndi-name>
| <connection-property
name="SetBigStringTryClob">true</connection-property>
| <connection-url>jdbc:oracle:thin:@***:1521:***</connection-url>
| <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
| <user-name>***</user-name>
| <password>***</password>
| <min-pool-size>0</min-pool-size>
| <max-pool-size>100</max-pool-size>
| <blocking-timeout-millis>5000</blocking-timeout-millis>
| <idle-timeout-minutes>1</idle-timeout-minutes>
|
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
| <track-statements>true</track-statements>
| <prepared-statement-cache-size>1000</prepared-statement-cache-size>
| </local-tx-datasource>
| </datasources>
|
Now, my jbpm configuration:
| <jbpm-configuration>
|
| <jbpm-context>
| <service name="persistence">
| <factory>
| <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
| <field name="isTransactionEnabled"><false /></field>
| <field name="sessionFactoryJndiName">
| <string value="java:/hibernate/SessionFactory" />
| </field>
| <field name="dataSourceJndiName">
| <string value="java:/JbpmDS" />
| </field>
| </bean>
| </factory>
| </service>
| <service name="message"
factory="org.jbpm.msg.db.DbMessageServiceFactory" />
| <service name="scheduler"
factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
| <service name="logging"
factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
| <service name="authentication"
factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"
/>
| </jbpm-context>
|
| <!-- configuration resource files pointing to default configuration files
in jbpm-{version}.jar -->
| <!-- string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml"
/-->
| <!-- <string name="resource.hibernate.properties"
value="hibernate.properties" /> -->
| <string name="resource.business.calendar"
value="org/jbpm/calendar/jbpm.business.calendar.properties" />
| <string name="resource.default.modules"
value="org/jbpm/graph/def/jbpm.default.modules.properties" />
| <string name="resource.converter"
value="org/jbpm/db/hibernate/jbpm.converter.properties" />
| <string name="resource.action.types"
value="org/jbpm/graph/action/action.types.xml" />
| <string name="resource.node.types"
value="org/jbpm/graph/node/node.types.xml" />
| <string name="resource.parsers"
value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
| <string name="resource.varmapping"
value="org/jbpm/context/exe/jbpm.varmapping.xml" />
|
| <bean name="jbpm.task.instance.factory"
class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true"
/>
| <bean name="jbpm.variable.resolver"
class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
| <long name="jbpm.msg.wait.timout" value="5000" singleton="true" />
|
| </jbpm-configuration>
|
I also use a JbpmSchedulerServlet that handles scheduling:
| public void init() throws ServletException {
| // create a new scheduler
| scheduler = new Scheduler();
|
| // initialize it with the servlet init parameters
| int interval = Integer.parseInt(getInitParameter("interval", "5000"));
| scheduler.setInterval(interval);
| int historyMaxSize =
Integer.parseInt(getInitParameter("historyMaxSize", "50"));
| scheduler.setHistoryMaxSize(historyMaxSize);
|
| // put the scheduler in the web app context
| getServletContext().setAttribute("scheduler", scheduler);
|
| // start the scheduler
| scheduler.start();
| }
|
| public void destroy() {
| scheduler.stop();
| }
|
My problem is that when I check the jmx-console, the ManagedConnectionPool
associated with the datasource shows the InUseConnectionCount ramping up
quickly while the ConnectionDestroyedCount stays to 0.
Rather quicly, the max number of connections will have been reached.
Is there a version of the Scheduler than can use transactions? (a MBean maybe?)
What am I doing wrong otherwise?
On a different note, I have tried the following (in a Session bean called from
a MBean):
| StopWatch watch = new StopWatch();
| watch.start();
|
| if (log.isDebugEnabled())
| log.debug("perform: entering");
|
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| JbpmContext jbpmContext = null;
| try {
| jbpmContext = jbpmConfiguration.createJbpmContext();
| GraphSession graphSession = jbpmContext.getGraphSession();
|
| ProcessDefinition processDefinition =
|
graphSession.findLatestProcessDefinition("opennmsSynchronization");
|
| ProcessInstance processInstance = new
ProcessInstance(processDefinition);
| ContextInstance contextInstance =
processInstance.getContextInstance();
| contextInstance.setVariable("syncContext", syncContext);
|
| Token token = processInstance.getRootToken();
| token.signal(); // get started...
|
| //log.debug(token.getNode().getName());
|
| jbpmContext.save(processInstance);
| } finally {
| if(jbpmContext != null) jbpmContext.close();
| }
|
| watch.stop();
| if (log.isDebugEnabled()) {
| log.debug("perform: SynchronizeCpe initialized "
| + watch);
| }
|
It seems to work but subsequently fails with the following message annoucing me
that the connection should have been closed but wasn't.
| 13:24:15,972 INFO [CachedConnectionManager] Closing a connection for you.
Please close them yourself: [EMAIL PROTECTED]
| java.lang.Throwable: STACKTRACE
| at
org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:333)
| at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:482)
| at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
| at
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
| at
org.jbpm.persistence.db.DbPersistenceService.getConnection(DbPersistenceService.java:113)
| at
org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:81)
| at
org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:216)
| at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:427)
| at
com.newedgenetworks.phoenix.ejb.session.jmxsupport.OpenNMSSyncSupportBean.startSynchronizationWorkflow(OpenNMSSyncSupportBean.java:248)
| at
com.newedgenetworks.phoenix.ejb.session.jmxsupport.OpenNMSSyncSupportBean.forceSynchronizeCpe(OpenNMSSyncSupportBean.java:234)
| at
com.newedgenetworks.phoenix.ejb.session.jmxsupport.OpenNMSSyncSupportBean.forceSynchronizeCpe(OpenNMSSyncSupportBean.java:180)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
| at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
| at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
| at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
| at
org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
| at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
| at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
| at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
| at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
| at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
| at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
| at
org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
| at org.jboss.ejb.Container.invoke(Container.java:873)
| at
org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:415)
| at
org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:88)
| at $Proxy659.forceSynchronizeCpe(Unknown Source)
| at
com.newedgenetworks.phoenix.jmx.OpenNMSCpeSync.synchronizeCpeWithOpenNMS(OpenNMSCpeSync.java:83)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at
org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:243)
| at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:208)
| at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:247)
| at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:85)
| at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:67)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
| at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
| at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
| at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
| at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
| at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
| at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| 1
|
Can anyone help with these two issues (could be the same...)
- Anthony
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3935924#3935924
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3935924
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user