Hi everybody,
I already published this question in previous topic
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=128146 but did not
received any responses.
Does anybody have any idea why it happens?
According to FAQ
http://wiki.jboss.org/wiki/Wiki.jsp?page=ClusteringFAQ in order to get
load balancing I created my custom InvokerInterceptor and modified standardjboss.xml to
replace JBoss's invoker by my custom one.
Load balancing works almost fine, but sometimes when my client makes ejb calls via threads
I'm getting exceptions like this.
java.lang.NullPointerException
at
org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.invoke(UnifiedInvokerHAProxy.java:186)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.ejb.RetryInterceptor.invoke(RetryInterceptor.java:176)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy74.submitJob(Unknown Source)
at
com.framework.system.cluster.ClusterJobSubmitter$RunInThread.run(ClusterJobSubmitter.java:111)
at java.lang.Thread.run(Thread.java:595)
It looks like client fails to get through a chain of interceptors.
Here is a code:
1. Custom Invoker (Jar with compiled invoker was placed in jboss-4.2.2.GA\server\all\lib).
package com.framework.jboss;
import org.jboss.invocation.*;
public class CustomInvokerInterceptor extends InvokerInterceptor {
public boolean hasLocalTarget(Invocation invocation) {
return false;
}
}
2. Modified piece of standardjboss.xml
<invoker-proxy-binding>
clustered-stateless-unified-invoker
<invoker-mbean>jboss:service=invoker,type=unifiedha</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
<proxy-factory-config>
<client-interceptors>
org.jboss.proxy.ejb.HomeInterceptor
org.jboss.proxy.SecurityInterceptor
org.jboss.proxy.TransactionInterceptor
org.jboss.proxy.ejb.SingleRetryInterceptor
<interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor
<interceptor
call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor
org.jboss.proxy.ejb.StatelessSessionInterceptor
org.jboss.proxy.SecurityInterceptor
org.jboss.proxy.TransactionInterceptor
org.jboss.proxy.ejb.SingleRetryInterceptor
<interceptor call-by-value="false">
com.framework.jboss.CustomInvokerInterceptor
<interceptor
call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor
</client-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
3. Client's code snippet:
public class ClusterJobSubmitter {
private JobSubmitterHome m_home = null; // ejb home
. . . . . .
public void runJob(Ticket jt) throws Exception {
synchronized (this){
if (m_home==null) {
createEjbHome();
}
}
RunInThread runner = new RunInThread(jt);
Thread thread = new Thread(runner);
thread.start();
}
class RunInThread implements Runnable {
Ticket m_jt=null;
public RunInThread(Ticket jt) {
m_jt= jt;
}
public void run() {
JobSubmitter execute = null; \\ ejb remote stab
try {
synchronized (m_home){
execute = (JobSubmitter) m_home.create();
}
execute.submitJob(m_jt);
} catch (Exception ex) {
ex.printstacktrace();
}
}
}
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124117#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...