Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Getting cache coordination working with rmi and glassfish(settings in persistence.xml for coordinated caching under (non-clustered) glassfish)
Getting cache coordination working with rmi and glassfish [message #660997] Tue, 22 March 2011 15:56 Go to next message
J F is currently offline J FFriend
Messages: 242
Registered: July 2009
Senior Member
I am using Eclipse Persistence Services - 2.2.0.v20110202-r8913 under glassfish 3.1

I have read http://wiki.eclipse.org/EclipseLink/Examples/JPA/CacheCoordi nation and created a persistence.xml ( see below ).
I have started an rmiregistry on the default port 1099 on the same machine as my initiating ear, using the jdk rmiregistry command.
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ExperimentjndiPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>ExperimentDB</jta-data-source>
<properties>
<property name="eclipselink.cache.coordination.protocol" value="rmi" />
<property name="eclipselink.cache.coordination.rmi.url" value="rmi://lil:1099" />
</properties>
</persistence-unit>
</persistence>


When I run the EJB and connect across to remote host I see the following;

SEVERE: enterprise_naming.excep_in_copymutableobj
java.io.NotSerializableException: org.eclipse.persistence.sessions.coordination.RemoteCommandM anager
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.j ava:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputSt ream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStrea m.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputS tream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.j ava:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.ja va:330)
at com.sun.enterprise.naming.util.NamingUtilsImpl.makeCopyOfObj ect(NamingUtilsImpl.java:104)
at com.sun.enterprise.naming.impl.LocalSerialContextProviderImp l.rebind(LocalSerialContextProviderImpl.java:113)
at com.sun.enterprise.naming.impl.SerialContext.rebind(SerialCo ntext.java:707)
at javax.naming.InitialContext.rebind(InitialContext.java:408)
at javax.naming.InitialContext.rebind(InitialContext.java:408)
at org.eclipse.persistence.sessions.coordination.rmi.RMITranspo rtManager.createLocalConnectionInJNDI(RMITransportManager.ja va:150)
at org.eclipse.persistence.sessions.coordination.rmi.RMITranspo rtManager.createLocalConnection(RMITransportManager.java:128 )
at org.eclipse.persistence.sessions.coordination.DiscoveryManag er.run(DiscoveryManager.java:197)
at java.lang.Thread.run(Thread.java:662)

WARNING: Local Exception Stack:
Exception [EclipseLink-22102] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.RemoteCommandManagerExcep tion
Exception Description: Could not post connection in local naming service under name Service[EclipseLinkCommandChannel, 70a8b941-486e-444c-ac2e-74093ac59f5c, rmi://lil:1099]
Internal Exception: java.lang.RuntimeException: Cant copy Serializable object:
at org.eclipse.persistence.exceptions.RemoteCommandManagerExcep tion.errorBindingConnection(RemoteCommandManagerException.ja va:90)
at org.eclipse.persistence.sessions.coordination.rmi.RMITranspo rtManager.createLocalConnectionInJNDI(RMITransportManager.ja va:153)
at org.eclipse.persistence.sessions.coordination.rmi.RMITranspo rtManager.createLocalConnection(RMITransportManager.java:128 )
at org.eclipse.persistence.sessions.coordination.DiscoveryManag er.run(DiscoveryManager.java:197)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Cant copy Serializable object:
at com.sun.enterprise.naming.util.NamingUtilsImpl.makeCopyOfObj ect(NamingUtilsImpl.java:124)
at com.sun.enterprise.naming.impl.LocalSerialContextProviderImp l.rebind(LocalSerialContextProviderImpl.java:113)
at com.sun.enterprise.naming.impl.SerialContext.rebind(SerialCo ntext.java:707)
at javax.naming.InitialContext.rebind(InitialContext.java:408)
at javax.naming.InitialContext.rebind(InitialContext.java:408)
at org.eclipse.persistence.sessions.coordination.rmi.RMITranspo rtManager.createLocalConnectionInJNDI(RMITransportManager.ja va:150)
... 3 more
Caused by: java.io.NotSerializableException: org.eclipse.persistence.sessions.coordination.RemoteCommandM anager
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.j ava:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputSt ream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStrea m.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputS tream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.j ava:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.ja va:330)
at com.sun.enterprise.naming.util.NamingUtilsImpl.makeCopyOfObj ect(NamingUtilsImpl.java:104)
... 8 more

What am I doing wrong?

I have possibly got this working using the following persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ExperimentjndiPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>ExperimentDB</jta-data-source>
<properties>
<property name="eclipselink.cache.coordination.protocol" value="rmi" />
<property name="eclipselink.cache.coordination.naming-service" value="rmi" />
<property name="eclipselink.cache.coordination.rmi.url" value="rmi://lil:8686" /> <!-- has to be the host name of the box on which the ear is deployed -->
</properties>
</persistence-unit>
</persistence>


The eclipselink.cache.coordination.naming-service property is necessary otherwise RMITransportManager will try and create a RMIRemoteCommandConnectionImpl using glassfish's default InitialContext() which does not work ( see above )
Secondly we may as well make use of the glassfish's RM Registry running on 8686.
I have not as yet got rmi-iiop working as the default InitialContext in glassfish seems not to be be bindable to a different node, see http://java.net/jira/browse/GLASSFISH-3888

So I now have two NON clustered vanilla glassfish deployments on two separate boxes. ( I did not use caching as I wanted to force some explicit cross node communication to explore caching and locking issues )

For clustering see http://old.nabble.com/Cache-Coordination-in-Glassfish-tt2096 3395.html#a21485846 - - port is 38686








[Updated on: Wed, 23 March 2011 16:27]

Report message to a moderator

Re: Getting cache coordination working with rmi and glassfish [message #661929 is a reply to message #660997] Mon, 28 March 2011 14:33 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The URL is given must be local to the local machine.

You could also just try not setting the URL, this works on WebLogic so may on Glassfish. It depends if JNDI is replicated or not.


James : Wiki : Book : Blog : Twitter
Previous Topic:How To modify Eclipselink JPA 2.0 connection retry behaviour
Next Topic:Cache coordination
Goto Forum:
  


Current Time: Sat Nov 22 08:54:53 GMT 2014

Powered by FUDForum. Page generated in 0.01741 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software