[Clustering/JBoss] - Load-balancing is not happening in cluster
by azheludkov
Does anybody know why stateless EJB is executed always on the node where client resides and is never load balanced?
I have successfully configured a two-node JBoss cluster, and deployed an EJB module to the cluster. When running the test client to invoke the EJB, all requests are always serviced by node 1 (where ejb client resides), never by node 2.
Here is another interesting detail. When client runs from outside of JBoss as stand-alone application and submits requests to JBoss cluster, the cluster routes requests to different nodes. I mean load-balancing works.
Another factor in my application is, client invokes the ejb from inside JBoss.
On the JBoss forum http://www.jboss.com/index.html?module=bb&op=viewtopic&t=112500
I found something similar to my problem, but I gess it only works for ejb 3.x, not ejb 2.x
Here are configuration details:
- JBoss 4.2.2-GA;
- EJB client runs inside of JBoss container;
- SLSB 2;
- JNDI properties:
java.naming.provider.url = jnp://localhost:1100
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
jnp.partitionName=DefaultPartition
- jboss.xml:
<enterprise-beans>
<ejb-name>SubmitterBean</ejb-name>
<jndi-name>Submitter</jndi-name>
true
<cluster-config>
<partition-name>DefaultPartition</partition-name>
<home-load-balance-policy>
org.jboss.ha.framework.interfaces.RoundRobin
</home-load-balance-policy>
<bean-load-balance-policy>
org.jboss.ha.framework.interfaces.RoundRobin
</bean-load-balance-policy>
</cluster-config>
</enterprise-beans>
My client creates home stub only once and caches it. For every ejb invocation a new remote interface stub is created.
In client class constructor I create home stab only once and cache it as a member variable:
Properties props = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory")
. . .
See all properties above.
. . .
Context ctx = new InitialContext(jndiProperties);
Object obj = ctx.lookup(lookupName);
m_home = (SubmitterHome) javax.rmi.PortableRemoteObject.narrow(obj, SubmitterHome.class);
But for every EJB invocation I create new remote interface stub, like here:
Submitter execute = null;
try {
execute = (Submitter) m_home.create();
execute.submitJob(m_jt);
} catch (Exception ex) {
ex.printStackTrace();
}
}
Any help would be much appreciated.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121920#4121920
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121920
18 years, 6 months
[JCA/JBoss] - Re: ManagedConnectionFactory.setLogger
by vickyk
"iit" wrote :
| Any hints?
| Thanks,
| Andreas Mueller
| (SwiftMQ)
I see this code setting the logger on the ManagedConnectionFactory
| // Give it somewhere to tell people things
| String categoryName = poolingStrategy.getManagedConnectionFactory().getClass().getName() + "." + jndiName;
| Logger log = Logger.getLogger(categoryName);
| PrintWriter logWriter = new LoggerPluginWriter(log.getLoggerPlugin());
| try
| {
| poolingStrategy.getManagedConnectionFactory().setLogWriter(logWriter);
| }
| catch (ResourceException re)
| {
| log.warn("Unable to set log writer '" + logWriter + "' on " + "managed connection factory", re);
| log.warn("Linked exception:", re.getLinkedException());
| }
|
It is from org.jboss.resource.connectionmanager.BaseConnectionManager2 .
http://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/main/org/jboss...
Looks to me that you will need to implement a org.jboss.logging.LoggerPlugin interface for this . The implementation class should have the naming as defined here
poolingStrategy.getManagedConnectionFactory().getClass().getName() + "." + jndiName
Where is the huge log information getting populated right now , the default should be going in the server log ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121914#4121914
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121914
18 years, 6 months
[Tomcat, HTTPD, Servlets & JSP] - How set request timeout?
by bunkenburg
Hello people
I am wondering how to set the request timeout for servlets in Apache+mod_jk+JBoss4.2.2.
We are using Apache (prefork) 2.2 with mod_jk 1.2.25 on RedHat5, with JBoss 4.2.2. Sometimes our servlets take a long time in replying. I would like to configure a timeout. If a servlet takes too long, I would like a new entry in some error log and I would like the browser to receive a nice error page. Is it somehow possible to make the JBoss thread that is executing the long request stop or interrupt it?
I have looked in the Apache 2.2 configuration, where I found TimeOut which limits the socket between the browser and Apache --- not what we want.
I have looked in the doc for mod_jk where I found reply_timeout. I set it to 25 seconds, and that at least closes the connection to the browser. The browser receives nothing, that is a blank page. But the thread in JBoss is still working, and I cannot find how to log this timeout. Our system admins will have no idea theses timeouts are happening. If we had a servlet with an infinite loop, more and more JBoss would be lost executing the infinite loop.
I have looked in the JBoss-Tomcat doc where I cannot find how to configure a request timeout.
How can a configure a request timeout, ideally with some logging and an error page?
Many thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121909#4121909
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121909
18 years, 6 months