Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Experiments with Glassfish and coordinated caching

Hi List,

has anyone succeeded in setting up cache coordination in Glassfish? Elllen?

I'm using a session customizer and experimented a bit with RMI and JMS coordination. Here's what I did and the results I got.

1. JMS

I see two approaches, but I'm not sure if both of them are sane.

First approach: Use a single JMS topic, perhaps on the DAS, and connect all cluster instances to this topic. I tried this:

RemoteCommandManager rcm = new RemoteCommandManager((CommandProcessor) session);
Hashtable properties = new Hashtable(2);
properties.put (Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory" );

This didn't work out at all. For some reason, looking up the remote connection factory failed. Took me some time to figure out what was going on: Apparently, when Glassfish JARs are on the classpath , Context.PROVIDER_URL is ignored. At least in my case, the lookup always went to localhost:3700, no matter what I supplied as Context.PROVIDER_URL. So, no luck.

Second approach: Use factories and topics deployed to the cluster and do local lookups on the cluster instances, hoping that GF clustering will somehow figure out the details of passing messages around in the background. So I cluster-deployed the connection factory and the topic and replaced DAS.devel:3700 with and set the topic host to localhost:37676.

Lookup worked , but trying to use the same (clustered) application as a client for JMS seems to be a bad idea:

Exception Description: Could not create local JMS connection with Topic jms/cachecoordination, Topic Factory jms/connectionFactory, and Context properties {java.naming.factory.initial=com.sun.appserv.naming.S1ASCtxFactory, java.naming.provider.url=iiop://,,} Internal Exception: com.sun.messaging.jms.JMSException: [ADD_CONSUMER_REPLY(15)] [C4036]: A broker error occurred. :[412] [B4135]: Cannot add durable consumer null. No ClientID was set on connection. user=guest, broker=localhost:37676(36560)

Got it: Same client ID for all cluster instances, different IDs needed for durability. Unfortunately, I have no idea how to either turn off durability or set client IDs.

2. RMI

Let's try RMI then, I thought, and, using code fragments posted to this list, came up with this code:

RemoteCommandManager rcm = new RemoteCommandManager((CommandProcessor) session);
rcm.getTransportManager().setNamingServiceType (TransportManager.REGISTRY_NAMING_SERVICE);

The session customizer terminates orderly, but after some time, I get the following exception:

Exception Description: Could not post connection in local naming service under name rmi:// Internal Exception: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
at org.eclipse.persistence.exceptions.RemoteCommandManagerException.errorBi ndingConnection( at eateLocalConnectionInRegistry( at eateLocalConnection( at (
Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
at sun.rmi.transport.tcp.TCPChannel.createConnection ( at sun.rmi.transport.tcp.TCPChannel.newConnection (
        at sun.rmi.server.UnicastRef.newCall(
        at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
        at java.rmi.Naming.rebind(
at eateLocalConnectionInRegistry(
        ... 3 more
Caused by:
at sun.rmi.transport.tcp.TCPChannel.createConnection (
        ... 8 more

I'm totally lost here. EOF? Uh? Probably RMI isn't at 3700 at all?

Perhaps somebody has already had more success and could help me out. I'd prefer the JMS solution in the long term, but for now, RMI would also do. If not, maybe I have at least documented the current state of things in the cache-coordination-with-GF case.

Kind regards from Berlin,


Back to the top