tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oxley, David" <David.Ox...@workplace-systems.plc.uk>
Subject RE: Tomcat - RMI client
Date Tue, 15 Apr 2003 14:33:28 GMT
Servlets and RMI are not happy at coexisting! If I were you I would switch
to using SOAP. But if you insist on using RMI, then you can't use
java.rmi.server.codebase. You need to add a codebase to the Classloader
(WebappClassLoader). Really, when you've loaded the classes you need, the
code base should be removed from the Classloader, but I haven't found a way
to do this. Here is the code I use:
	// This stuff is for Tomcat 4.1.10 and above. (RMI doesn't work with
TC4 before this version).
	Method m = null;
	try {
		ClassLoader cl = StaffPlannerServer.class.getClassLoader();
		Class clc = cl.getClass();
		if
(clc.getName().equals("org.apache.catalina.loader.WebappClassLoader")) {
			Class[] classes = new Class[1];
			Object[] parms = new Object[1];
			classes[0] = String.class;
			parms[0] = codeAddr;

			// Set debug
			/*Class[] classes2 = new Class[1];
			Object[] parms2 = new Object[1];
			classes2[0] = Integer.TYPE;
			parms2[0] = new Integer(4);

			Method m2 = clc.getMethod("setDebug", classes2);
			m2.invoke(cl, parms2);*/
				
			m = clc.getMethod("addRepository", classes);
			m.invoke(cl, parms);
		}
	}
	catch (Exception e) {}
		
	// And if we're running Tomcat 3.x or a different AppServer
completely. Do it the old way.
	if (m == null) {
		Properties p = System.getProperties();
		p.remove("java.rmi.server.codebase");
		p.put("java.rmi.server.codebase", codeAddr);
		System.setProperties(p);
	}

	// Now load all classes needed to be accessible remotely.

Dave.


> -----Original Message-----
> From: Jaber C. Mourad [mailto:mjaber@centralpay.net]
> Sent: 15 April 2003 15:05
> To: Tomcat Users List
> Subject: Tomcat - RMI client
> 
> Hi,
> I was reading the mailling list archieve and I haven't found info about
> that.
> I'm trying to use servlet as RMI client and I can't understand how the
> security manager works into tomcat ( 4.1.24 rpm version ).
> I'm very newbies into tomcat configuration.
> Where can I define environement variables as java.security.policy or
> java.rmi.server.codebase ?
> My rmi server work with a standalone client...
> Thanks a lot fro your help
> 
> --
> Jaber C. Mourad <mjaber@centralpay.net>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message