我正在使用Seam,JBoss Jbpm和Resteasy。我有一个非常简单的流程定义:
<start-state name="create">
<transition name="send" to="inbox" />
</start-state>
<node name="inbox">
<action expression="#{test.sayHello}" />
<transition name="acknowledge" to="acknowledged" />
</node>
<end-state name="acknowledged" />
这是应该开始这个过程的类
@Name("webservice")
@Path("/webservice")
@AutoCreate
public class WebService
{
@GET
@CreateProcess(definition="Blah")
@Transactional
public String getSomething() throws Exception
{
...
}
}
流程定义也很简单: http://docs.jboss.org/jbpm/xsd/jpdl-3.2.xsd” NAME = “等等” &GT;
<start-state name="create">
<transition name="send" to="inbox" />
</start-state>
<node name="inbox">
<action expression="#{test.sayHello}" />
<transition name="acknowledge" to="acknowledged" />
</node>
<end-state name="acknowledged" />
然后,当我尝试调用WebService时,我得到以下Stack Trace:
10:38:41,443 ERROR [STDERR] Caused by: org.jbpm.JbpmException: couldn't find process definition 'Blah'
10:38:41,443 ERROR [STDERR] at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:158)
10:38:41,443 ERROR [STDERR] at org.jbpm.JbpmContext.newProcessInstanceForUpdate(JbpmContext.java:417)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.bpm.BusinessProcess.createProcess(BusinessProcess.java:134)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.bpm.BusinessProcess.createProcess(BusinessProcess.java:123)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.bpm.BusinessProcessInterceptor.afterInvocation(BusinessProcessInterceptor.java:108)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
10:38:41,444 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
10:38:41,445 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
10:38:41,445 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
10:38:41,445 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
10:38:41,445 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
10:38:41,445 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
10:38:41,445 ERROR [STDERR] at com.locaweb.infra.gridserver.resources.ServerResource_$$_javassist_5.getServerResource(ServerResource_$$_javassist_5.java)
10:38:41,445 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:38:41,445 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
10:38:41,447 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
10:38:41,447 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
10:38:41,447 ERROR [STDERR] at org.resteasy.MethodInjectorImpl.invoke(MethodInjectorImpl.java:72)
10:38:41,447 ERROR [STDERR] ... 28 more
10:38:41,448 ERROR [STDERR] Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
10:38:41,449 ERROR [STDERR] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
10:38:41,449 ERROR [STDERR] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
10:38:41,449 ERROR [STDERR] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
10:38:41,449 ERROR [STDERR] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
10:38:41,449 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
10:38:41,449 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
10:38:41,449 ERROR [STDERR] at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.Loader.doQuery(Loader.java:673)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.Loader.doList(Loader.java:2220)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.Loader.list(Loader.java:2099)
10:38:41,450 ERROR [STDERR] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
10:38:41,451 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
10:38:41,451 ERROR [STDERR] at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
10:38:41,451 ERROR [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
10:38:41,451 ERROR [STDERR] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
10:38:41,451 ERROR [STDERR] at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
10:38:41,451 ERROR [STDERR] at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:154)
10:38:41,451 ERROR [STDERR] ... 49 more
10:38:41,452 ERROR [STDERR] Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000101:d2f8:4a1fe246:4e status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000101:d2f8:4a1fe246:4e status: ActionStatus.ABORT_ONLY >))
10:38:41,453 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
10:38:41,453 ERROR [STDERR] at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
10:38:41,453 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
10:38:41,453 ERROR [STDERR] ... 64 more
10:38:41,455 ERROR [STDERR] Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000101:d2f8:4a1fe246:4e status: ActionStatus.ABORT_ONLY >)
10:38:41,459 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:358)
10:38:41,460 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:524)
10:38:41,460 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:405)
10:38:41,460 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
10:38:41,460 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
10:38:41,460 ERROR [STDERR] ... 66 more
10:38:41,461 ERROR [STDERR] Caused by: javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000101:d2f8:4a1fe246:4e status: ActionStatus.ABORT_ONLY >
10:38:41,462 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.checkEnlisted(TxConnectionManager.java:759)
10:38:41,462 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:592)
10:38:41,462 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:352)
10:38:41,462 ERROR [STDERR] ... 70 more
我正在使用带有两个xa-datasource的SQLServer数据库(一个用于我的数据库,一个用于Jbpm的数据库),驱动程序为net.sourceforge.jtds.jdbcx.JtdsDataSource。 Web服务确实使用非jbpm数据库。
当我尝试不使用getSomething()方法访问非jbpm数据库的hibernate会话时,它正常工作。但是,如果我注入会话并尝试相同的事情,那么大部分时间都不起作用。
有谁知道发生了什么事?