[JBoss AOP] - Problem to get custom interceptor stack up and running.
by Jonas Heineson
Jonas Heineson [http://community.jboss.org/people/heineson] created the discussion
"Problem to get custom interceptor stack up and running."
To view the discussion, visit: http://community.jboss.org/message/536906#536906
--------------------------------------------------------------
Hello,
I have a problem getting an interceptor stack up and running on my JBoss (4.2.3.GA). The jboss starts fine, without any error messages, but when I connect a client to the server I get a NullPointerException suggesting that my Interceptor is not loaded (since it is the first one on the stack):
...
Caused by: java.lang.NullPointerException
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessClusteredProxy.invoke(StatelessClusteredProxy.java:112)
...
The stack in question is a modified version of the default ClusteredStatelessSessionClientInterceptors stack defined in ejb3-interceptors-aop.xml:
jboss-aop.xml:
<interceptor scope="PER_VM"/>
<stack name="MtClusteredStatelessSessionClientInterceptors">
<!--interceptor-ref name="org.jboss.ejb3.remoting.ClusteredIsLocalInterceptor"/-->
<interceptor-ref name="com.computas.mt.jboss.clustering.FixedServerInterceptor"/>
<interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
<interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
<interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
<interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
</stack>
Annotations of SLSB class:
@Stateless(name="EJBSingletonInvoker")
@Clustered(loadBalancePolicy = FixedServerBalancer.class)
@RemoteBinding(interceptorStack = "MtClusteredStatelessSessionClientInterceptors")
public class MtEJBSingletonInvokerBean { ...}
Interceptor:
public class FixedServerInterceptor extends ClusteredIsLocalInterceptor {
@Override
public Object invoke(Invocation invocation) throws Throwable {
// doing some extra stuff
return super.invoke(invocation);
}
The jboss-aop.xml and the custom interceptor are both located in a module called mt-aop-<version>.aop which is in turn placed in an .ear together with the other modules of the application.
Have also turned on instrumentation in the jboss-aop-jdk50.deployer/META-INF/jboss-service.xml
What am I missing / doing wrong here?
Regards
Jonas Heineson
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/536906#536906]
Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
[jBPM Development] - How to provide my own transaction to jBPM?
by Guido Helmers
Guido Helmers [http://community.jboss.org/people/helmers] created the discussion
"How to provide my own transaction to jBPM?"
To view the discussion, visit: http://community.jboss.org/message/536887#536887
--------------------------------------------------------------
Hi,
we're using jBPM 4.3, the jBPM tables are part of a bigger database schema, also containing our own tables.
Our transactional service method looks like this:
@Transactional
public String create(Issue issue) {
// http://community.jboss.org/message/536887#536887/1 http://community.jboss.org/message/536887#536887/1 (own stuff)
issueDao.persist(issue);
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("ISSUE_ID", issue.getId());
// http://community.jboss.org/message/536887#536887/2 http://community.jboss.org/message/536887#536887/2 (jBPM stuff)
ProcessInstance processInstance = executionService.startProcessInstanceByKey("PROCESS_KEY", variables);
// http://community.jboss.org/message/536887#536887/3 http://community.jboss.org/message/536887#536887/3 (jBPM stuff)
List list = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
// ... etc
}
First we write some stuff to our own tables, then we tell jBPM to start a process. This is all done within one transactional method (I was hoping...).
*jbpm.cfg.xml:*
*tx.hibernate.cfg.xml:*
*The problem...*
The problem is that jBPM creates its own transaction, and does not take part in the transaction started by our own application (as you can see by writing an integration test that succeeds on steps [1] and [2], but uses a mockTaskService to throw an exception at [3] - what you see then is that our own tables are emptied (top-level transaction is rolled-back), but JBPM4_HIST_PROCINST is still filled, in other words [2] is executed in its own transaction and is not rolled back).
I tried to remove the "standard-transaction-interceptor" from tx.hibernate.cfg.xml hoping that jBPM would magically participate in my own transaction, but that doesn't make jBPM very happy.
Does anyone have an idea how I can tell jBPM to use my transaction, instead of starting its own?
I read in the jBPM 4 developer's guide:
http://docs.jboss.org/jbpm/v4/devguide/html_single/#d0e2216 http://docs.jboss.org/jbpm/v4/devguide/html_single/#d0e2216
that +"User provided transasctional resources such as JDBC connections or hibernate connections"+ is not yet available in jBPM4. I guess this feature is what I need... is it already implemented or in the pipeline? Does anyone know when this feature will be available, or if there is a workaround for it?
This post is related to my earlier post on the fact that jbpm4 does not use the hibernate SessionFactory injected into it:
https://community.jboss.org/thread/150549?tstart=0 https://community.jboss.org/thread/150549?tstart=0
In the test project attached to that issue, you can also see how transaction management in our application works... Perhaps the problem is solved as soon as the SessionFactory injection issue is solved?
Cheers,
Guido
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/536887#536887]
Start a new discussion in jBPM Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years