Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Cache Coordination in Glassfish

Can you please describe the structure of archive that you deploy in more details. Specially how is the jar that contains entities and the enum placed? Also can you please post full exception stack trace for the exceptions below.

Thanks,
Mitesh

wintermute@xxxxxxxxxxxxxxxxxx wrote:
Hi list,

it's been quite a while -- some of you may remember I was trying to get EclipseLink cache coordination to work in Glassfish.

The good news is: When I got back to this, I did it. I'll attach the piece of code that does the trick.
The bad news: There's one more issue.

Most of my changes propagate to the cluster, but as soon as a particular entity is involved, I see exceptions in the log. The only thing special about the entity is that it uses an enum constant defined in an Interface elswhere, but certainly in the reach of the application classloader. Here's the exception:

MergeChangeSetCommand command failed due to: Local Exception Stack:
Exception [EclipseLink-12002] (Eclipse Persistence Services - 1.0.2 (Build 20081024)): org.eclipse.persistence.exceptions.CommunicationException Exception Description: Unable to propagate changes to Service[BookpacCacheCoordination, 8f4d39c0-d1bb-4530-8c54-a5b3542d68ff, rmi://192.168.23.21:38686]. Internal Exception: java.lang.ClassNotFoundException: com.bookpac.archive.core.IDocumentList$ListType at org.eclipse.persistence.exceptions.CommunicationException.unableToPropagateChanges(CommunicationException.java:68) at org.eclipse.persistence.sessions.coordination.MergeChangeSetCommand.getChangeSet(MergeChangeSetCommand.java:47)
[...]
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.bookpac.archive.core.IDocumentList$ListType at com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:129)
[...]


ListType is an enum, defined in IDocumentList. It's there, and the class is in a jar known to persistence.xml, in fact, in the same jar as the other entities that do get propagated.


Is there a general problem with enums? Or do they need to be defined in the JPA entity that uses them?

Maybe someone knows something about this Classloading thing with Enums?

Thanks in advance,

rv


----

This is the code I'm using:

    public void customize(Session session) throws Exception {
RemoteCommandManager rcm = new RemoteCommandManager((CommandProcessor)session);

rcm.getDiscoveryManager().setMulticastGroupAddress("226.1.2.3"); //$NON-NLS-1$
        rcm.getDiscoveryManager().setMulticastPort(3122);
        rcm.getDiscoveryManager().setAnnouncementDelay(1000*5);

        rcm.setChannel("CacheCoordination"); //$NON-NLS-1$
        rcm.setShouldPropagateAsynchronously(true);

rcm.getTransportManager().setNamingServiceType(TransportManager.REGISTRY_NAMING_SERVICE);
        rcm.getTransportManager().setUserName("admin"); //$NON-NLS-1$
rcm.getTransportManager().setPassword("adminadmin"); //$NON-NLS-1$
        rcm.setUrl("rmi://$HOST:38686"); //$NON-NLS-1$

        rcm.setServerPlatform(session.getServerPlatform());
        ((DatabaseSession)session).setCommandManager(rcm);
        ((DatabaseSession)session).setShouldPropagateChanges(true);
        rcm.initialize();
    }

This is the customize Method of an EclipseLink session customizer, obviously. The important bit is the rcm.setUrl(...) line -- 38686 is the port you want to be using for RMI in Glassfish clusters.

One thing that hat confused me was the announcement delay: I thougt announcement would be done periodically, but it's not. Nodes announce excactly once by default, when they start up. So there's a chance of nodes missing each other if one of them is starting up slowly and doesn't hear the other's announcements. The announcement delay should be larger than the maximum difference between startup times of the nodes -- unfortunately, there's no way of knowing this. To make sure I don't end up with a slow node that doesn't have its cache updated without me noticing in production, I added some more announcements.



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top