Я использую 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"
имя = "Ли">
<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, я получаю следующую трассировку стека:
<code></p>
<p>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</p>
<p>
Я использую базу данных SQLServer с двумя источниками данных xa (один для моей базы данных и один для базы данных Jbpm) с драйвером net.sourceforge.jtds.jdbcx.JtdsDataSource. Веб-сервис использует базу данных не-jbpm.
Когда я пытаюсь сделать это без метода getSomething (), обращающегося к сеансу hibernate базы данных не-jbpm, он работает нормально. Однако, если я ввожу сеанс и пытаюсь сделать то же самое, он в большинстве случаев не работает.
Кто-нибудь знает, что происходит?