Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] Configuring a Coordinated cache via RMIin Java

Ok...well how we plan to deploy is on no clustered tomcat, and we're
accessing the DB through webservices.  So Should I assign a tomcat
instance to be a central repository, or if, for example, I had four
boxees (say server1, server2, server3, server4) I would have server1 be
the RMI repo for 1 and 3, and server 2 be the repo for 2 and 4?  Do I
have to set up some other RMI mechanism/service/server to get this to
work?



I followed your example (using local host) but now I am getting an
exception.

the ports are open so I am not sure why...is there another reason I
could be getting this error?:


[EPS Warning]: 2007.11.29
04:21:02.174--ServerSession(9628550)--Thread(Thread[Finalizer,8,system])
--Local Exception Stack: 
Exception [EclipseLink-22107] (Eclipse Persistence Services - 1.0M1
(Build 20071105)):
org.eclipse.persistence.exceptions.RemoteCommandManagerException
Exception Description: Could not remove local connection in local naming
service under name rmi://localhost:8881/8491834
Internal Exception: java.rmi.ConnectIOException: error during JRMP
connection establishment; nested exception is: 
        java.net.SocketTimeoutException: Read timed out
        at
org.eclipse.persistence.exceptions.RemoteCommandManagerException.errorUn
bindingLocalConnection(RemoteCommandManagerException.java:137)
        at
org.eclipse.persistence.sessions.coordination.rmi.RMITransportManager.re
moveLocalConnection(RMITransportManager.java:234)
        at
org.eclipse.persistence.sessions.coordination.TransportManager.discardCo
nnections(TransportManager.java:432)
        at
org.eclipse.persistence.sessions.coordination.RemoteCommandManager.shutd
own(RemoteCommandManager.java:179)
        at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.logout(Dat
abaseSessionImpl.java:718)
        at
org.eclipse.persistence.sessions.server.ServerSession.logout(ServerSessi
on.java:625)
        at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.removeSessio
nFromGlobalSessionManager(EntityManagerSetupImpl.java:138)
        at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.undeploy(Ent
ityManagerSetupImpl.java:1286)
        at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.close(Enti
tyManagerFactoryImpl.java:83)
        at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.finalize(E
ntityManagerFactoryImpl.java:137)
        at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
        at
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
Caused by: java.rmi.ConnectIOException: error during JRMP connection
establishment; nested exception is: 
        java.net.SocketTimeoutException: Read timed out
        at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:273)
        at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
        at sun.rmi.registry.RegistryImpl_Stub.unbind(Unknown Source)
        at java.rmi.Naming.unbind(Naming.java:135)
        at
org.eclipse.persistence.sessions.coordination.rmi.RMITransportManager.re
moveLocalConnection(RMITransportManager.java:226)
        ... 12 more
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
        at
java.io.BufferedInputStream.read(BufferedInputStream.java:235)
        at java.io.DataInputStream.readByte(DataInputStream.java:241)
        at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:215)
        ... 17 more

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Doug Clarke
Sent: Thursday, November 29, 2007 4:29 PM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java

Tony,

The URL will determine the RMI repository that will be used. Generally
this is a common repository for all severs so that the shared objects
can be found. The multicast message is to notify when a new participant
node has become available so that the existing nodes can register with
it through the shared RMI object(s).

In some containers where clustered RMI is offered with replicated
registries each node can point to its local version of the registry.

Doug

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Vespa,
Anthony J
Sent: Thursday, November 29, 2007 3:13 PM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java


Hrm, Ok I'll try to implement this and see what I get.

Another question...if I have it on two boxes (or N boxes) do I have to
make the this value:

cm.setUrl("rmi://localhost:1099");

be something that all boxes point to?  Is that how the multicase part
works?

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Doug Clarke
Sent: Thursday, November 29, 2007 2:00 PM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java

Tony,

The messages you are looking for are at the end of the start-up and are
logged at FINER. Here is what I have:

[EPS Config]:
Connection(33175995)--Thread(Thread[main,5,main])--Connected:
jdbc:oracle:thin:@localhost:1521:ORCL
	User: SCOTT
	Database: Oracle  Version: Oracle Database 10g Enterprise
Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
	Driver: Oracle JDBC driver  Version: 10.2.0.1.0
[EPS Config]:
Connection(14965598)--Thread(Thread[main,5,main])--connecting(DatabaseLo
gin(
	platform=>Oracle10Platform
	user name=> "scott"
	datasource URL=> "jdbc:oracle:thin:@localhost:1521:ORCL"
))
[EPS Config]:
Connection(2633821)--Thread(Thread[main,5,main])--Connected:
jdbc:oracle:thin:@localhost:1521:ORCL
	User: SCOTT
	Database: Oracle  Version: Oracle Database 10g Enterprise
Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
	Driver: Oracle JDBC driver  Version: 10.2.0.1.0
[EPS Info]:
Thread(Thread[main,5,main])--file:/C:/Eclipse/EclipseLink/trunk/examples
/jpa/eclipselink.examples.jpa.cache.rmi/classes/-eclipselink.examples.jp
a.cache.rmi login successful
[EPS Finer]: Thread(Thread[Thread-2,5,main])--RCM service announcement
sent out to cluster
[EPS Finer]: Thread(Thread[Thread-2,5,main])--RCM Discovery Manager
active

The last 2 are the indications that cache coordination has started up.

The sessions.xml approach I sent you will not work. If you use a
sessions.xml it will not look in the JPA annotated/xml entities. The
solution I got working uses a customizer to configure cache
coordination. Here is how I bootstratp my EMF:

		EntityManagerFactory emf = Persistence
	
.createEntityManagerFactory("eclipselink.examples.jpa.cache.rmi");
		
		new
RMICacheCoordinationConfig().customize(JpaHelper.getServerSession(emf));

The code in there looks like:

	public void customize(Session session) throws Exception {
		AbstractSession sessionImpl = (AbstractSession) session;

		RemoteCommandManager cm = new
RemoteCommandManager(sessionImpl);
		cm.setShouldPropagateAsynchronously(true);
		cm.getDiscoveryManager().setAnnouncementDelay(10);
		cm.getTransportManager().setNamingServiceType(
	
TransportManager.REGISTRY_NAMING_SERVICE);
		cm.setUrl("rmi://localhost:1099");
		cm.setServerPlatform(sessionImpl.getServerPlatform());
		sessionImpl.setCommandManager(cm);
		sessionImpl.setShouldPropagateChanges(true);
		cm.initialize();

		try {
			Thread.sleep(2000);
		} catch (Exception ignore) {
		}
	}

Sorry for the confusion. I have some bugs to file with respect to
simplified configuration and documentation.

Doug

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Vespa,
Anthony J
Sent: Thursday, November 29, 2007 10:08 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java


Hrm.... well I am not seeing any sort of messages about multicast or RMI
messages in my code, though I am not explicitly closing the EMF or EM
objects (I have always been of  the philisophy from DBAs past that
closing connections are expensive so I let the system recycle them) - is
this required for the cache coordination to work? 

If I try to make the same query twice, I get this error in my logs for
some reason:

internal error: ObjID already in use

I tried setting up a second server and configuring the session.xml to
point at the first server host but nothing seems to be happening (and I
changed the RMI address to be machine address vs local host) - also do I
need an different RMI registrry for each different Persistence Unit I
have?  I have four in my persistence.xml file.

Thanks for any further help!

Tony

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Doug Clarke
Sent: Wednesday, November 28, 2007 11:11 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java

Tony,

I believe I got the basics working using the attached persistence.xml
and sessions.xml (both placed in the META-INF folder. I still need to go
a little further in my testing to get a second node configured for
verification but the log messages are encouraging about the lookup of
the RMI registry and the discover multicast message being sent.

My test harness is just:

	public static void main(String[] args) throws Exception {
	
java.rmi.registry.LocateRegistry.createRegistry(Registry.REGISTRY_PORT);

		EntityManagerFactory emf = Persistence
	
.createEntityManagerFactory("eclipselink.examples.jpa.cache.rmi");
		EntityManager em = emf.createEntityManager();

		em.find(Employee.class, 1);

		em.close();
		emf.close();

	}

I hope this helps.

Doug

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Vespa,
Anthony J
Sent: Wednesday, November 28, 2007 10:22 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java


Hi Doug!  Thanks for the quick response!  I am eager to try out the
cache coordination - I will take a look through the extension documents.

Cheers,

Tony

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Doug Clarke
Sent: Wednesday, November 28, 2007 10:19 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] Configuring a Coordinated cache via
RMIin Java

Tony,

We are working on getting the full documentation up but even when that
is completed we'll still have work to do.

Here is the documentation on RMI Cache Coordination:
http://wiki.eclipse.org/Configuring_an_RMI_Coordinated_Cache_%28ELUG%29#
BABHEJHG. The bulk of this focuses on Workbench usage. 

I will assume since you are coming from TopLink Essentials that you are
looking for the JPA centric configuration approach using persistence.xml
properties and annotations.

The JPA documentation can be found at:

http://wiki.eclipse.org/EclipseLink/UserGuide/Developing_JPA_Projects_%2
8ELUG%29

But at present is not complete. I would recommend looking at the Oracle
TopLink JPA extensions doc and translating it for usage with
EclipseLink:

http://www.oracle.com/technology/products/ias/toplink/jpa/resources/topl
ink-jpa-extensions.html

You will need to use @Cache to configure the coordination type on each
entity. To configure the actual RMI coordination I would recommend using
a sessions.xml which the extensions document describes how to link in. 

I am working on a small example to illustrate the various pieces.

Doug

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Vespa,
Anthony J
Sent: Wednesday, November 28, 2007 9:29 AM
To: EclipseLink User Discussions
Subject: [eclipselink-users] Configuring a Coordinated cache via RMI in
Java


Hello,

So I am about to attempt setting up a coordinated cache with my entity
objects running on two server boxes via RMI.  As I am looking through
the documentation, I see most examples are for the workbench - are there
some straight java examples (as I am not using the workbench, I recently
migrated from Toplink essentials) - that offer a step by step guide to
setting it up in Java (annotations, where/how to config the JNDI
bindngs, etc)

Thanks for any help!

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

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

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

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


Back to the top