aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to acces specific resource in a server in clustering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to acces specific resource in a server in clustering" Watch "How to acces specific resource in a server in clustering" New topic
Author

How to acces specific resource in a server in clustering

Marco Santinon
Greenhorn

Joined: Jan 03, 2007
Posts: 17
Hi all,
I have this environment:
-WebSphere 5.1
- 1.4.2 IBM jvm

We have 2 server in clustering with 2 nodes with load balancing, so -->

cell/nodes/myNode1/servers/myWSServer1
cell/nodes/myNode2/servers/myWSServer2

I need to lookup a resource from both servers, so I tried to lookup the JNDI name using the "full path" -->

context.lookup("cell/nodes/myNode1/servers/myWSServer1/ejb/myEjb");
context.lookup("cell/nodes/myNode2/servers/myWSServer2/ejb/myEjb");

but what I get is not what I expected, becouse the resource that is given to me is independet from the "path" I use, and it comes from one server or the other, dependig on the load balancing...

There's a way to do what I'm trying to do?


Thaks in advance

Marco Santinon
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I don't think so. It kind of defeats the purpose of clustering if you try to lookup an ejb deployed on one specific server. Why are you trying to this?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Marco Santinon
Greenhorn

Joined: Jan 03, 2007
Posts: 17
Hi Paul,
my boss decided to introduce logging using log4j...

The problem is to change log level at runtime in both the servers...

How can I do that?


Marco
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Log4j with WAS? Doesn't it have its own logging framework? And its own per-server admin console that allows you to configure logging at runtime?

That aside, have you seen LogWeb? This is a GUI for configuring log4j at runtime.
Marco Santinon
Greenhorn

Joined: Jan 03, 2007
Posts: 17
Hi Paul,
we decided to use log4j becouse there's the possibility to pass to JBoss AS sometimes in the future, and we don't want to have code that depends too much from WebSphere.
And it is also a study test...

LogWeb seems useful in a single server environment, but we have 2 servers in two nodes, so if I access a web application like WebLog to configure log4j, I can change the log level only in one server, not in both...

Marco
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


we decided to use log4j becouse there's the possibility to pass to JBoss AS sometimes in the future, and we don't want to have code that depends too much from WebSphere.

If this is the reason, wouldn't Commons Logging be a better fit?


LogWeb seems useful in a single server environment, but we have 2 servers in two nodes, so if I access a web application like WebLog to configure log4j, I can change the log level only in one server, not in both...

Unless you configure log4j from a shared resource this is always going to be a propblem I think. You could configure it from JNDI, but you would need to have some event that signals a change. So you could add something like a Timer that is deployed to every server in the cluster and polls JNDI watching for changes to a particular value. Then your update GUI would just have to update a single resource.
Marco Santinon
Greenhorn

Joined: Jan 03, 2007
Posts: 17
Originally posted by Paul Sturrock:

If this is the reason, wouldn't Commons Logging be a better fit?


We use log4j in the client side of the appication, so we didn't thought to change the kind of loggig.
But I think that, if passing to Commons Loggin, we will get the same problem of changing level in two different jvm...


Originally posted by Paul Sturrock:

Unless you configure log4j from a shared resource this is always going to be a propblem I think. You could configure it from JNDI, but you would need to have some event that signals a change. So you could add something like a Timer that is deployed to every server in the cluster and polls JNDI watching for changes to a particular value. Then your update GUI would just have to update a single resource.


This can be a solution...

But what I want to understand is why I cannot get the resource I want by making a lookup with the "complete" JNDI name (cell/nodes/myNode1/servers/myServer1)...?

I make two lookups with two different "paths", but I get the resources in the same server...


I tried also to use Persistent Namespace Binding -->
I set two different Persistent binding for two EJBs (the "same" EJB in two servers), but when I make the lookups I get the EJBs in the same server...

So... I don't understand the use of Persistent Namespace Binding...


Marco
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'm afraid I can't help. You might try asking in the WebSphere forum, someone could perhaps help. My gut feeling is in a clustered environment you shouldn't be able to lookup a server-specific resource because that undermines the cluster's behaviour. That being said it is perhaps possibly in WebSphere.
Marco Santinon
Greenhorn

Joined: Jan 03, 2007
Posts: 17
Ok,
thanks for the time you spent for my problem, Paul.


Marco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to acces specific resource in a server in clustering