Skip to main content

JDBC configuration in glassfish cluster

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
beon2013
Offline
Joined: 2014-02-24

I have three instances in Amazon EC2. And I'm configuring an environment load balancing using Glassfish and mod_jk.

The steps I've done are: Created two nodes, remote1_node1 and remote2_node1 managed centrally (via SSH) from my DAS server:

create-node-ssh --nodehost 54.229.252.1 remote1_node1
create-node-ssh --nodehost 54.229.252.2 remote2_node1

Created a cluster cluster1:

create-cluster --properties 'GMS_DISCOVERY_URI_LIST=generate:GMS_LISTENER_PORT=9090' cluster1

Created an instance for remote1_node1 and remote2_node1 respectively:

create-instance --cluster=cluster1 --node=remote1_node1 remote1_instance1
create-instance --cluster=cluster1 --node=remote2_node1 remote2_instance1

I have configure Apache to run as the load balancer using mod_jk module.

Base on the tutorial, for running a persistence application, I just need to execute the JDBC configuration in cluster1. But when I deploy my application in cluster1:

deploy --target cluster1 --availabilityenabled=true --retrieve /home/ubuntu/ order-7.0.1.war

My two remote machines say a error like this:

> Exception during lifecycle processing
java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/sample' in SerialContext[myEnv={com.sun.enterprise.connectors.jndisuffix=__pm, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: sample not found]

They can't find the JDBC Connection Pool "jdbc/sample". If I execute the same JDBC configuration in these two remote instances, it could works. But in this case, these two remote instances become independent. And the data are not synchronization. Obviously, it's not correct.

Can you help me? Thanks in advance.