[jboss-user] [Clustering/JBoss] - Re: Load-balancing is not happening in cluster
azheludkov
do-not-reply at jboss.com
Wed Jan 23 09:53:18 EST 2008
Thanks,
Now load balancing works, but some weird issue occurs from time to time.
According to FAQ I created my custom InvokerInterceptor and modified standardjboss.xml to replace JBoss's invoker by my custom one.
When my client makes ejb calls via threads and sometimes I get exceptions like this.
java.lang.NullPointerException
at org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy.invoke(UnifiedInvokerHAProxy.java:255)
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:118)
at java.lang.Thread.run(Thread.java:595)
It looks like ejb instance fail to connect client on return. Ejb instance did its work on remote sevrver.
Do you have any idea why?
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 snippet of code:
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=4122660#4122660
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4122660
More information about the jboss-user
mailing list