aspose file tools
The moose likes BEA/Weblogic and the fly likes Cluster configuration with managed servers on a single machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Cluster configuration with managed servers on a single machine " Watch "Cluster configuration with managed servers on a single machine " New topic

Cluster configuration with managed servers on a single machine

A Wolfe

Joined: Sep 08, 2003
Posts: 23
I've been trying to configure a cluster with two managed servers and an admin server for a domain name clmydomain. I've successfully created the cluster and can run and stop both managed servers. Below is my configuration information:
admin server address: localhost
port: 7001
cluster name: my_cluster_1
cluster address: localhost
multicast port : 7020
multicast address:
my_managed_server_1 (first managed server) port: 7005
address: localhost
my_managed_server_2 (second managed server) port: 7010
address: localhost
I've app.jar file that includes EJBs with a session bean acting as session facade. I then use a servicelocator class to get a handle to sessiona facade object using following code:
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "weblogic");
env.put(Context.SECURITY_CREDENTIALS, "weblogic");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
I'm successfully able to deploy and test the JNDI names for the underlying datasource and all the EJBs plus session facade on managed servers.
If I deploy app.jar only to cluster (both managed servers) then I cannot succussfully get a handle to session facade and get the NameNotFoundException. If I changed the port number to 7005 in the above code (t3://localhost:7005) and my managed server 1 is running (on port 7005 obviously) then I'm able to get the session object and the data fetched from datasource successfully. If shut down managed server 1 and start managed server 2 then again I get the NameNotFoundException.
In order to get the t3://localhost:7001 part of the code to work, I have to deploy app.jar on admin server as well as the cluster but my understanding is that I don't have to deploy the app.jar to admin server itself.
I can start a managed server successfully using the startManagedServer.bat using the http://localhost:7001 url (while the admin server is running).
What am I doing wrong? Am I missing some sort of configuration somewhere that I cannot specify 7001 port in the url without deploying app.jar on admin server? I'd greatly appreciate any help. Thanks.

Joined: Apr 18, 2001
Posts: 22
Have a look here

Nizan Horsefield<br />Weblogic Support<br />BMW
A Wolfe

Joined: Sep 08, 2003
Posts: 23
Nizan, thanks. But not much of any help. I did change my weblogic-ejb-jar.xml to include cluster related configuration information (although the default values for related elements are already "True" so not much difference there). But I still can't test failover.
Here is the situation now: I run a java class in console to test running both managed servers. I notice that even if I'm using 7005 port to test (managed server 1 listening port), after the first test run, the second run test shows the test messages in managed server 2 (port 7010) console window instead of server 1. This means that both servers are synchronized and multicast port configuration is working and probably due to load balancing algorithm server 2 is handling the request instead of server 1. But when I shut down server 1 (mimicing as system failure) then I expect the server 2 to still handle the request but at that point I get the "CommunicationException" "Destination unreachable" error. So failover is failing.
Any ideas?
Misnad Haque

Joined: Oct 07, 2003
Posts: 2
Well if the server is in the middle of a process and you shut it down do not expect it to failover to the other server with your current configuration. You need to use session replication. I am also working on clustering for a client of ours using weblogic81 and I encountered the same problem you were facing. To perform session replication, you will have to build your application after adding a weblogic.xml file to be placed in the application's WEB-INF directory. The purpose of this is to pass a parameter so as to indicate that in memory session replication is to take place. Also you will have to specify a replication group for the managed servers. A replication group is simply a common name that you give to the appropriate field for each managed server you want in the group. You should go through this link and read up about session replication first:
It applies to all versions of weblogic even though its meant for weblogic6.0
Hope this helps!

Virtusa Corp.
A Wolfe

Joined: Sep 08, 2003
Posts: 23
Misnad, thanks for reply. I did see the documents but it doesn't apply to my test case. I'm not using any sort of web components (JSP, servlets) to test my deployed EJBs. I'm simply testing it using a simple java class running on dos prompt. The only thing I can see relevant to my test case scenario is Replication group. I'll give that a try. Thanks again.
I agree. Here's the link:
subject: Cluster configuration with managed servers on a single machine