Eclipse & Running my RMI Server
I have everything set up nicely to run my RMI Sever from eclipse and I keep getting this error message. Any help would be greatly appreciated:
Exception in MAIN java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.ibm.SvcCliSimulator.RMIRemoteMethod_Stub
The stub is in the same dir. as the RMIServer class. I know my code is fine b/c when I do it with JDK by hand it works just fine, but I'd like to keep it in my ECLIPSE development environment. HELP
OK, a bit more information. I know that Eclipse is FINDING the actual class file, because if I comment out everything in the stub then I get this different error:
Exception in MAIN java.rmi.StubNotFoundException: Stub class not found: com.ibm.SvcCliSimulator.RMIRemoteMethod_Stub; nested exception is:
java.lang.ClassNotFoundException: com.ibm.SvcCliSimulator.RMIRemoteMethod_Stub
Same sort of deal, but different none the less. I've searched everywhere, but I can't get any help:
public static void main(String[] args) {
try{
RMIRemoteMethod m = new RMIRemoteMethod();
Naming.rebind("test", m);
System.out.println("RMIServer READY");
catch(RemoteException re){
System.out.println("Exception in MAIN " + re);
catch(Exception e){
System.out.println("Exception: " + e);
The exception occures on the Naming line if my stub is set up correctly and on the line before if I camment out the entire stub.java file. Any help would be really really great. Thanks.
Similar Messages
-
How do I make a RMI client running in Bea find a remote, non Bea, RMI server?
On my stand alone test system I run a RMI server in one JVM,
registry.exe and a RMI client in its own JVM. The client uses
java.rmi.Naming.lookup() to find the RMI server, and this works fine.
If I run the same RMI client class within Bea the naming lookup fails! I
guess this is due to Bea using it own RMI registry rather than the
registry.exe I started separately(?)
QUESTION: How do I make a RMI client running in Bea find a remote,
non-Bea, RMI server?
Of course, in the final environment the server will run on a system
remote from Bea.
The RMI client calls are done from a servlet, not from a EJB.
The doumentation about using RMI with Bea is focused on running the RMI
server within Bea. This might be the "normal" thing to do, but in our
case Bea is the client, not the server. Do I still need to use
weblogic.rmi.*....? If so, where?
Grateful for any tip.
Göran HagnellOn my stand alone test system I run a RMI server in one JVM,
registry.exe and a RMI client in its own JVM. The client uses
java.rmi.Naming.lookup() to find the RMI server, and this works fine.
If I run the same RMI client class within Bea the naming lookup fails! I
guess this is due to Bea using it own RMI registry rather than the
registry.exe I started separately(?)
QUESTION: How do I make a RMI client running in Bea find a remote,
non-Bea, RMI server?
Of course, in the final environment the server will run on a system
remote from Bea.
The RMI client calls are done from a servlet, not from a EJB.
The doumentation about using RMI with Bea is focused on running the RMI
server within Bea. This might be the "normal" thing to do, but in our
case Bea is the client, not the server. Do I still need to use
weblogic.rmi.*....? If so, where?
Grateful for any tip.
Göran Hagnell -
RMI server behind firewall--must use host as name, not IP
Server is running behind a firewall, which runs such that any machine behind the firewall cannot use the external IP to get back to itself.
That is:
- outside IP = 192.171.20.5 (port forwards 1099 to 192.168.1.5:1099)
- inside IP = 192.168.1.5 (rmi server listens on 1099)
from the machine inside (192.168.1.5), it is IMPOSSIBLE to create a socket to [outside ip](192.171.20.5), port 1099, and expect it to get back to the machine inside--the firewall prohibits this.
I -can- use name-based lookups, such that I can edit the hosts file on the inside box to route (myhost.com to 192.168.1.5). So, if everyone's DNS resolves myhost.com -> 192.171.20.5, then clients anywhere can go to myhost.com:1099 and will be redirected to my internal machine (192.168.1.5:1099).
The problem with this is that the names get translated to IPs and sent back to the client.
Is there a way to keep the names as names, so that both client (using external real-world DNS entries) and server (using local hosts file) can both resolve to the proper IP addresses?
I'm starting server, as follows:
java -Djava.rmi.server.codebase=http://myhost.com/rmi/ -Djava.security.policy=/policypath/policy -Djava.rmi.server.hostname=myhost.com mypkg.myclass
The client connects and gets this message (from a connection exception):
java.rmi.ConnectException: Connection refused to host: 192.168.1.5;Server is running behind a firewall, which runs such
that any machine behind the firewall cannot use the
external IP to get back to itself.I dont really understand this statement.. Machines behind the firewall referring to the external ip would be going to the gateway, not themselves.. Or do you have an internal AND external ip on the machines behind the firewall? Or are we referring to the gateway machine as an internal machine as well as external?
That is:
- outside IP = 192.171.20.5 (port forwards 1099 to
192.168.1.5:1099)
- inside IP = 192.168.1.5 (rmi server listens on
1099)looks good, what kinda OS/firewall? If we're talking linux/ipchains (or iptables) with ip masquerading, I may be of some use to you...
from the machine inside (192.168.1.5), it is
IMPOSSIBLE to create a socket to [outside
ip](192.171.20.5), port 1099, and expect it to get
back to the machine inside--the firewall prohibits
this.If you're on the internal network, why can't you just go for the internal ip addr? If I'm understanding correctly, you want internal dns requests for myhost.com to resolve to 192.168.1.5, and external dns requests to resolve to 192.171.20.5? That should't be a problem...
I -can- use name-based lookups, such that I can edit
the hosts file on the inside box to route (myhost.com
to 192.168.1.5). So, if everyone's DNS resolves
myhost.com -> 192.171.20.5, then clients anywhere can
go to myhost.com:1099 and will be redirected to my
internal machine (192.168.1.5:1099).the hosts file has nothing to do with routing, it's simply a dns-type thing... If your dns is giving external users a 192.168 address as the ip for myhost.com, they will never get to it. 192.168 is not routable on the internet, i think most inet routes will drop packets from 192.168.x.x or 10.x.x.x.
Is there a way to keep the names as names, so that
both client (using external real-world DNS entries)
and server (using local hosts file) can both resolve
to the proper IP addresses?As long as your dns is working correctly, java doesn't care if you use ips or host names.. Hostnames are preferable, so when you change your network around, you wont affect your rmi server.
I'm starting server, as follows:
java -Djava.rmi.server.codebase=http://myhost.com/rmi/
-Djava.security.policy=/policypath/policy
-Djava.rmi.server.hostname=myhost.com mypkg.myclass
The client connects and gets this message (from a
connection exception):
java.rmi.ConnectException: Connection refused to host:
192.168.1.5;Is your server compiled with the 192.171 ip? That's not gonna work, you have to use the same IP the server is running on. I'm still not clear on your network layout, is 192.171.20.5 and 192.168.1.5 the 2 gateway ip's, or is 192.168.1.5 a physically different machine? I'd be willing to bet that your server is compiled with the external address, and if that's not the same machine, then there's no chance of that working....
There's more than port forwarding going on.. IIRC, java rmi keeps track of its own ip's.. A client request to an external ip will not connect to a server running on the internal ip, even if you forward the port, rmi itself doesn't recognize the internal as the ip it's trying to get to (even if it is true), so it bombs out.. This can happen if you run the rmi server on a gateway, and compile the server with the external ip, and try to connect to the internal ip.. If you want external machines to connect, you MUST run the server on an external ip.
Give a little more info, we'll getcha running... I'm also assuming you have full control of your network (ie, firewall/dns)
doug -
Strange unmarshalling exception when starting RMI server
I've run into a strange problem when running my RMI server. It worked fine yesterday, though I made a few changes since then, none of those changes should cause this to happen, as far as I know.
Here's the exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: pub.interfaces.ClientIface
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at priv.server.TCMaster.<init>(TCMaster.java:97)
at priv.server.TCMaster.main(TCMaster.java:71)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: pub.interfaces.ClientIface
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: pub.interfaces.ClientIface
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1494)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1457)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
... 9 more
pub.interfaces.ClientIface is in the SAME directory as the RMI server class! What could be causing this?
NOTE: I'm running this on Redhat Linux 9, jdk 1.5.0_04.Usually an unmarshalling exception is caused by the classes not matching up on the server & client end. The classes are there I think, because otherwise it would have thrown a classnotfound exception instead. Can you try actually copying and pasting the classes either from the server to the client or vice versa? I've had weird issues where sometimes the compiler compiles the same class differently in different locations, so your safest bet is to make sure the client & server classes (that you're passing as arguments & returning from the server) are identical.
Good luck! -
Java.rmi.server.hostname
Hi,
i am trying to figure out where this property comes into play. The docs say:
"The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. In 1.1.7 and later, the default value of this property is the IP address of the local host, in "dotted-quad" format."
So i reverse engineered the stub to see if the value is inside the stub, but it isnt. I am asking because i want to run my RMI server program as a service and i dont want to define a static hostname property, because the server can be installed on several machines. Perhaps i can leave out this property completey and rely on defaults.
So two questions remain to me:
- Can i leave out this without getting into trouble?
- Where is this propery used, obviously not in the stub.
Thanks.
marcHi Marc,
- Can i leave out this without getting into trouble?
Possibly, see answer to your second question.
- Where is this propery used, obviously not in the stub?
The property is used primarily for one of two reasons, otherwise it is generally not necessary.
1. If you have more than one network interface on a given machine, this property will specify which one to use.
2. If you are behind a NAT router, this property will specify the actual address to use, outside the NAT subnet.
Unspecified it will use the default network adapter address specified by your OS.
Hope that was interesting :-)
-John -
Not able to run a simple RMI server
I am running an RMI program like follwing
import java.rmi.* ;
import java.rmi.registry.* ;
import java.rmi.server.* ;
public class CallBeanServer extends UnicastRemoteObject implements ICallBeanServer
//main
public static void main(String args[]) throws Exception
int port = 1000 ;
Registry reg = null ;
if( args[0].equals("true"))
reg = LocateRegistry.createRegistry(port) ;
System.out.println("Successfully created registry") ;
else
reg = LocateRegistry.getRegistry(port) ;
System.out.println("Connected to existing registry") ;
CallBeanServer callBeanServer = new CallBeanServer(reg) ;
}//main
//constructor
public CallBeanServer(Registry reg) throws Exception, RemoteException
super() ;
reg.rebind("CallBeanServer",this) ;
System.out.println("CallBeanServer Object bound") ;
//my public method
public String callBeanServer() throws RemoteException
{ return "Success" ;
I have run the rmiregistry at port no 1000 like
rmiregistry 1000
I have compiled ICallBeanServer also and run rmic also over CallBeanServer like
rmic CallBeanServer
when I run this program using
java CallBeanServer false
it gives the follwoing errors
Connected to existing registry
Exception in thread "main" java.rmi.ServerException: Server RemoteException; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: CallBeanServer_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: CallBeanServer_Stub
java.lang.ClassNotFoundException: CallBeanServer_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at CallBeanServer.<init>(CallBeanServer.java:38)
at CallBeanServer.main(CallBeanServer.java:30)
Can you please tell me what is the error?
Thanks
Prashant GuptaAdd the classes (the stubs included) to the classpath when you start the registry.
-
Codebase run RMI server .NoClassDefFoundError:
If I run the folllowing from the solaris command line
java -cp /junk/jdev+/jdev/src -Djava.rmi.server.logCalls=true -Djava.rmi.server.codebase=file:////junk/jdev+/jdev/src/ -Djava.security.policy=/junk/jdev+/jdev/src/jdev/server/policy jdev.server.RMIServerDBAdapter
my RMIServerDBAdapter binds regardless of my current working directory. In other words the RMI server
runs and binds as expected.
If I remove the classpath clause of the java command (-cp /junk/jdev+/jdev/src) then the RMI server
will only run and bind if my current working directory is the "root" of the package.
In this case if my current working directory is /junk/jdev+/jdev/src the RMI server will run and bind as
it should. If my current working directory is at the root of the solaris file system ( / ) I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: jdev/server/RMIServerDBAdapter
My question is why doesn't the code base clause of the java command point to the root
directory of the package /junk/jdev+/jdev/src. It seems to me that the codebase clause
would point to the root directory of the package allowing the RMI server to run and bind as expected
regardless of the current working directory.
I cannot get this to work. I have tried 0-4 slashes (file:/, - file:////) that did not seem to help.
The package statement in the java source files is
package jdev.server
Thank you in advance for your help.
Michael
[email protected]Hi Ciaccio,
Your question is doesn't clear enogh to me to answer it straight... But I'll try... :)
First you must not mix the reason and usage of the codebase and classpath. Classpath is locally parsed and used, codebase is remotely parsed and used (at the registry and at the client side).
Your server program cannot start if you don't tell to the system where to find the needed classes. That's why you have to specify the root path of the jdev.server.RMIServerDBAdapter in the CLASSPATH (from that point will search the java system the jdev dir, the server dir and the RMIServerDBAdapter object) .
If the Java system is unable to locate any of a needed class it throws a nice exception during the startup of the server program.
The codebase property is used by the client and the registry to locate the stub objects (and return types and parameter types) if those cannot be found on their local classpath. This path (or it would be more accurate to call what it is: URL) must be an absolute address (path, URI, etc), because the clients and the registry can be started anywhere. This way you also have to set RMISecurityManager and polici files also to your client because of dynamic class downloading...
Last thing:
Note the line above: ...if those cannot be found on their local classpath... If the stubs and the param/return types are present in the registry's and the clients local classpath then you don't have to specify codebase property at the server side because it is not parsed at all.
I hope I could help,
Sanyi -
Lesson 8: RMI, Error in Run the RemoteServer Server Object
Hello guys,
Please Help!
I try to test and run the samples in
JavaTM Programming Language Basics, Part 1
Lesson 8: Remote Method Invocation
http://developer.java.sun.com/developer/onlineTraining/Programming/BasicJava1/rmi.html
I already compiled the samples, but when I testing to run the RemoteServer Object it gives me error.
Here's the following line command:
java -Djava.rmi.server.codebase=file:
g:\home\zelda\public_html\classes
-djava.rmi.server.hostname=kq6py.eng.sun.com
-Djava.security.policy=java.policy RemoteServer
The ERROR:
Exception in thread "main" java.security.AccessControlException: access denied (
java.net.SocketPermission kq6py.eng.sun.com resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at RemoteServer.main(remoteserver.java:38)
PLEASE HELP!!!
Thanks in advance,
RodelOooppssss, I got it.
uh huh!!!! -
I am trying to run a simple RMI Sample from Java tutorial. When i try to run my server class(binding). I get a connection refused exception.
Can anyone please suggest a solution towards it.!
Thanks.
My server class code is
public class RMIHelloImpl extends UnicastRemoteObject implements HelloIF {
public RMIHelloImpl() throws RemoteException {
super();
public String sayHello(String msg)
{return "Hello " + msg + " from RMI!!";
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
String name = "//localhost/Hello";
try {
RMIHelloImpl helloImp = new RMIHelloImpl();
Naming.rebind(name, helloImp);
System.out.println("Hello bound");
} catch (Exception e) {
System.err.println("Hello exception: " + e.getMessage());
e.printStackTrace();
}Exception.................................
C:\eclipse\workspace\RMI\bin>java -Djava.security.policy=jav
a.policy RMIHelloImpl
Hello exception: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
java.rmi.ConnectException: Connection refused to host: localhost; nested excepti
on is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at RMIHelloImpl.main(RMIHelloImpl.java:20)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.<init>(Socket.java:309)
at java.net.Socket.<init>(Socket.java:124)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirect
SocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMaster
SocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)> How do I start the RMI registry?
The Java� Tutorial - Trail: RMI -
Urgent Help Required For Starting RMI server from servlet.
I am currently working on rmi project.
I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
I am writing servlet and inside it i am binding object to registry for rmi server.
which will be deployed on remote server.
code ....
Registry reg;
reg=LocateRegistry.createRegistry(1099);
Server server=new Server("server");//class whose remote object to be accessed
//extends unicast remote object.Implement ServerInt interface which extends Remote.
reg.bind("server",server);
When i am trying to access this object i am getting following exception.
javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
on: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: ServerModule.ServerInt]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at RequstReplication.main(RequstReplication.java:27)
Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
tion is:
java.lang.ClassNotFoundException: ServerModule.ServerInt
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 4 more
Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 5 more
I can access naming enumeration of registry and object bound to it.
by following program.I shows corect objects.
Context namingContext=new InitialContext();
NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
while(e.hasMore())
System.out.println(e.next().getName());
While when i start RMI server from simple java program i can access these objects from registry.
I am not getting what is problem problem.Is there any other way to send request?
Plese give quick response.I am currently working on rmi project.
I want to send request to remote machine(Web host) where my application is from desktop client .For that we are using RMI.
I am writing servlet and inside it i am binding object to registry for rmi server.
which will be deployed on remote server.
code ....
Registry reg;
reg=LocateRegistry.createRegistry(1099);
Server server=new Server("server");//class whose remote object to be accessed
//extends unicast remote object.Implement ServerInt interface which extends Remote.
reg.bind("server",server);
When i am trying to access this object i am getting following exception.
javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalExcepti
on: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: ServerModule.ServerInt]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at RequstReplication.main(RequstReplication.java:27)
Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested excep
tion is:
java.lang.ClassNotFoundException: ServerModule.ServerInt
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 4 more
Caused by: java.lang.ClassNotFoundException: ServerModule.ServerInt
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 5 more
I can access naming enumeration of registry and object bound to it.
by following program.I shows corect objects.
Context namingContext=new InitialContext();
NamingEnumeration<NameClassPair> e=namingContext.list("rmi:");
while(e.hasMore())
System.out.println(e.next().getName());
While when i start RMI server from simple java program i can access these objects from registry.
I am not getting what is problem problem.Is there any other way to send request?
Plese give quick response. -
Attempting to use SSL over RMI from a web application to a RMI server
Hi,
I am attempting to use SSL over RMI to a server. The client is the web
application that is hosted on WebLogic and that attempts to connect to the
server. There is no client or server verification at either the client or
the server end. The code works outside of WebLogic 7/8 but has the following
issues when running the web application inside weblogic:
java.rmi.ConnectException: Connection refused to host: gkhanna1; nested
exception is:
java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
at java.net.Socket.<init>(Socket.java:268)
at java.net.Socket.<init>(Socket.java:95)
at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF
actory.java:20)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF
actory.java:115)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:79)
at
com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.initConnection(NTLMConne
ctionClient.java:59)
at
com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.getUsers(NTLMConnectionC
lient.java:197)
at com.hyperion.css.CSSAPIImpl.getUsers(Unknown Source)
at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
at jsp_servlet._jsp._app1.__app1signin._jspService(__app1signin.java:133)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:1058)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:401)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:445)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:306)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:5445)
at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:780)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3105)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2588)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
The code at the client that initiates the connection:
socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket) socketFactory.createSocket(host, port);
socket.setEnabledCipherSuites(CIPHERS);
socket.setEnableSessionCreation(true);
Any ideas?
ThanksI don't see anything that indicates SSL was directly a factor in the
failure.
From the exception stack it looks like a more basic connectivity issue,
maybe the URL for the
RMI server is incorrect for some reason or the server was down.
It looks like you are doing something like this:
SSL client -> WLS server with servletA, servletA RMI client
(com.hyperion.css) -> RMI server
The connection failure appears to be the connection from servletA RMI client
to the RMI server.
Is that a correct picture?
Tony
"Gaurav Khanna" <[email protected]> wrote in message
news:[email protected]...
Hi,
I am attempting to use SSL over RMI to a server. The client is the web
application that is hosted on WebLogic and that attempts to connect to the
server. There is no client or server verification at either the client or
the server end. The code works outside of WebLogic 7/8 but has thefollowing
issues when running the web application inside weblogic:
java.rmi.ConnectException: Connection refused to host: gkhanna1; nested
exception is:
java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
at java.net.Socket.<init>(Socket.java:268)
at java.net.Socket.<init>(Socket.java:95)
at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF
actory.java:20)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF
actory.java:115)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:79)
at
com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.initConnection(NTLMConne
ctionClient.java:59)
at
com.hyperion.css.spi.impl.ntlm.NTLMConnectionClient.getUsers(NTLMConnectionC
lient.java:197)
at com.hyperion.css.CSSAPIImpl.getUsers(Unknown Source)
at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
at com.hyperion.css.CSSAPIImpl.initialize(Unknown Source)
at jsp_servlet._jsp._app1.__app1signin._jspService(__app1signin.java:133)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:1058)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:401)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:445)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:306)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:5445)
at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:780)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3105)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2588)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
The code at the client that initiates the connection:
socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket) socketFactory.createSocket(host, port);
socket.setEnabledCipherSuites(CIPHERS);
socket.setEnableSessionCreation(true);
Any ideas?
Thanks -
PermGen space: out of memmory error comming while running the jboss server on ATG10.2
Hi Guys,
I am getting out of memmory error while running the jboss server on ATG10.2.
using jboss-eap.5.1 + atg 10.2 + jdk1_6_28 version + mysql.
edited the run.conf file with below given settings in atg10.2 documentation. But still getting the issue.
JAVA_OPTS="-server -Xms2048m -Xmx3072m -XX:MaxPermSize=768m
-XX:MaxNewSize=768m -Dsun.rmi.dgc.server.gcInterval=3600000 –
Dsun.rmi.client.gcInterval=3600000"
Pelase suggest if you have any ideas.
Thank you.Hi,
Please use recommended settings:
JAVA_OPTS="-server -Xms512m -Xmx1024m -XX:MaxPermSize=512m
-XX:MaxNewSize=512m -Dsun.rmi.dgc.server.gcInterval=3600000 –
Dsun.rmi.client.gcInterval=3600000"
This will work fine.
Regards,
RahulV -
Help needed in running the RMI application with multiple clients
Hi
I have my RMI application with one server and 6 clients. I keep all the server and client programs in the same directory. When i run the clients, the first 2 clients work properly but when the third or the fourth client starts, it works normally in getting the data and after a while it crashes. If teh third crashes the 4th works and if the 4th crashes the 3rd, 4th and 5th works ...randomly atleast one or 2 clients crash always.
following is the error message generated for a client named controller:
[ code ]
Exception in thread "main" java.lang.NullPointerException
at PostOfficeImpl.isinputAvail(PostOfficeImpl.Java:315)
at PostOfficeImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun,rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun,rmi.transport.Transport.serviceCall(Transport.java:149)
at sun,rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun,rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
at PostOfficeImpl_Stub.isinputAvail(Unknown Source)
at CONTROLLER.main(CONTROLLER.java:167)
my ser ver program is as follows:
class PostOfficeServer extends java.rmi.server.UnicastRemoteObject implements java.rmi.Remote {
// Instance of ourselves
public static String name;
private static PostOfficeServer rmi;
// public No-argument constructor
public PostOfficeServer() throws RemoteException {
super();
public static void main(String[] args){
if(System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
try {
new PostOfficeServer();
PostOffice postOfficeserver = new PostOfficeImpl();
try {
getIP ipAdd1 = new getIP();
String ip1 = ipAdd1.getIP();
name = "//" + ip1 + "/PostOffice";
catch (Exception e){
System.out.println();
Naming.rebind(name, postOfficeserver);
System.out.println("RemoteServer bound");
System.out.println("initialise Data Structure");
postOfficeserver.initDatastructure();
System.out.println("initilised");
catch (java.rmi.RemoteException e) {
System.out.println("Cannot create remote server object");
catch (java.net.MalformedURLException e) {
System.out.println("Cannot look up server object");
System.out.println("Server started.");
System.out.println("Enter <CR> to end.");
try {
int serve2end = System.in.read();
}catch (IOException ioException) {
System.exit(0);
//endoffilePlease advise as this is very urgentHi
the following is the code for PostOfficeImpl...its a long code but i include it so that I get your help please...
import java.io.*;
import java.net.*;
import java.lang.*;
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.*;
public class PostOfficeImpl extends java.rmi.server.UnicastRemoteObject implements PostOffice {
//Implementations must have an explicit constructor in order to declare the
//RemoteException exception
public PostOfficeImpl() throws java.rmi.RemoteException {
super();
public static LinkedListImpl list = new LinkedListImpl();
public static oListImpl ovarList = new oListImpl();
public static iListImpl ivarList =new iListImpl();
public static lipsList llfirst;
public static oList opchannel, ofirst, onext;
public static iList ipchannel, ichan, ifirst;
public static String[] variNumber= new String[100];
public static String[] inoutChan, inChan, outChan,inVAR, invarLIST,outVAR, outvarLIST ;
public static String[][] driveMat;
DriverMatrix_mthds drive = new DriverMatrix_mthds();
private static Boolean All_Vacant;
private static Boolean tAll_Vacant;
public void sendAll_Vacant(Boolean All_Vacant) throws RemoteException {
tAll_Vacant = All_Vacant;
public Boolean getAll_Vacant() throws RemoteException{
return tAll_Vacant;
public void initDatastructure() throws RemoteException{
ifirst = null;
ofirst=null;
int i=0, j=0, k=0, ind1=0, ind2=0;
try{/// initialise list
drive = new DriverMatrix_mthds();
drive.VarTypeArray();
drive.nodeHeadVarType();
String[] variablel = drive.Variablelist();
drive.lipsvariablist();
drive.NodeOrigin();
drive.nodeInput();
drive.numOfnodes();
drive.noOfVariables();
drive.Assignlist();
drive.novarType();
drive.varNameType();
drive.nodeNumName();
drive.driverMat();
String[][] lookupvar = drive.varNameType();
//tempdrive = drive.driverMat();
long leng1 = variablel.length;
int varlistlength = (int) leng1;
int counter;
String s1="";
String s2="";
String s3 = "";
String s4 = "";
String s6 = "";
int s5=0, c=0;
while(variablel[k] !=null){
k=k+1;
int i1, j1;
String varname, varnumber;
varnumber = "";
while(i<=variablel.length-1){
if(variablel!=null){
c=c+1;
i=i+1;
try{
ind1=0; ind2 = 0;i=0;
while(!(variablel[i].equals("end of file"))){
s1 = variablel[i];
i=i+1;
s2 = variablel[i];
i=i+1;
System.out.println(" " + s1+" "+s2);
while(!(variablel[i].equals("end of input variable"))){
s4 = variablel[i];
i1=0;
Brkwhile:while(i1<=lookupvar.length-1){
j1=1;
if(lookupvar[i1][j1] != null){
if(lookupvar[i1][j1].equals(s4)){
s3 = lookupvar[i1][0];
break Brkwhile;
i1=i1+1;
//ifirst.varNum = varnumber;
s5 = 0;
s6 = null;
ifirst= new iList(s3,s4, s5, s6);
ivarList.add(ifirst);
System.out.println(s3+" "+s4+" "+s5+" "+s6);
i=i+1;
i = i + 1;
System.out.println("input list finished ");
while(!(variablel[i].equals("end of output variable"))){
s4 = variablel[i];
i1=0;
j1=1;
Brkwhile:while(lookupvar[i1][j1] != null){
if(lookupvar[i1][j1].equals(s4)){
s3 = lookupvar[i1][0];
break Brkwhile;
i1=i1+1;
s5 = 0;
s6 = null;
ofirst= new oList(s3,s4, s5, s6);
ovarList.add(ofirst);
System.out.println(s3+" "+s4+" "+s5+" "+s6);
i=i+1;
llfirst = new lipsList(s1, s2, ivarList, ovarList);
list.add(llfirst);
System.out.println("output list finished ");
i=i+1;
catch (NullPointerException ne){
catch (Exception d){}
public int isitOK(reqPacket sndNodetail)
throws RemoteException{
String nodnum = sndNodetail.srcNum;
String varnum = sndNodetail.varNum;
int status = 0;
llfirst = list.getFirst();
try{mainbegin:while (llfirst != null){
if((llfirst.nodeNum).equals(nodnum)){
ofirst = ovarList.getFirst();
while(ofirst != null){
if((ofirst.varNum).equals(varnum)){
if(ofirst.varVal==null){
status = 1;
break mainbegin;
ofirst = ofirst.next;
llfirst = llfirst.next;
catch (NullPointerException nl){}
return status;
public int senData(dataPacket sendToRTS)
throws RemoteException{
dataPacket datDetail = sendToRTS;
String nnum, vnum,typename, dval;
String dtype = "";
nnum = datDetail.nodeNum;
vnum = datDetail.varNum;
typename = datDetail.dataType;
dval = String.valueOf(datDetail.dataVal);
String [][] tempdrive, varnametype;
int status =0;
System.out.println("data received is from node " nnum " is "+ dval+"var num " +vnum);
status =0;
try{
//DriverMatrix_mthds drive = new DriverMatrix_mthds();
drive.VarTypeArray();
drive.Variablelist();
drive.NodeOrigin();
drive.nodeInput();
drive.numOfnodes();
drive.noOfVariables();
String[][] lookupvar = drive.novarType();
drive.varNameType();
drive.nodeNumName();
drive.driverMat();
tempdrive = drive.driverMat();
String varname="";
int i,j;
//with the recived var name get the var num
for(i=0; i<=lookupvar.length-1; i++){
j=0;
if(lookupvar[i][j] != null){
if(lookupvar[i][j].equals(typename)){
dtype = lookupvar[i][1];
}//varname is moved to dtype n used for checking
for(i=0; i<=tempdrive.length-1; i++){j=0;
if (tempdrive[i][j] != null){
if (tempdrive[i][0].equals(vnum)){
if (tempdrive[i][1].equals(nnum)){
if(tempdrive[i][2].equals(dtype)){
status = 1;
}//System.out.println("received data " vnum " "+ nnum +" " + dtype +" "+dval);// after checking status if the status is 1 then set the counter n olist// to no of times the value has to be ditributed
int Ccount =0;
//opchannel = llfirst.olist;
try{
System.out.println("status"+status);
if (status == 1){
llfirst = list.getFirst();
mainWhile: while (llfirst != null){
if((llfirst.nodeNum).equals(nnum)){
ofirst = ovarList.getFirst();
while(ofirst != null){
if((ofirst.varNum).equals(vnum)){
ofirst.varVal =dval;
//setting the counter for the varname
//check driver matrix fr the no of occurances
for(i=0; i<=tempdrive.length-1; i++){
j=0;
if (tempdrive[i][j] != null){
if (tempdrive[i][0].equals(vnum)){
for(j= j+3;j<=tempdrive.length-1;j++){
if(tempdrive[i][j] != null){
if(tempdrive[i][j].equals("1")){
Ccount = Ccount + 1;
System.out.println("count"+Ccount);
ofirst.counter = Ccount;
ofirst.varNum = vnum;for(i=0; i<=lookupvar.length-1; i++){
for(j=0; j<=2; j++){
if(lookupvar[i][j] != null){
if(lookupvar[i][j].equals(vnum)){
varname = lookupvar[i][1];
ofirst.varName = varname;
Ccount=0;
break mainWhile;
ofirst = ofirst.next;
llfirst = llfirst.next;
catch(NullPointerException s){}
/*use the vnum in the driver matrix and find out the nodes to which this variable
*has been sent as input , i mean destination nodes..
*find the node numbers ..knowing the node numbers parse through data structure
and set the input values to value and status 1./
llfirst = list.getFirst();
while(llfirst != null){
ifirst = llfirst.ilist.getFirst();
while(ifirst != null){
if (ifirst.varNum.equals(vnum)){
ifirst.varStat = 1;
ifirst.varVal = dval;
// System.out.println("nodenum "+llfirst.nodeNum+" varval " + ifirst.varVal +" stat "+ifirst.varStat+" vnum " + ifirst.varNum);
ifirst=ifirst.next;
llfirst=llfirst.next;
catch (Exception e){};
return status;
public int isinputAvail(reqPacket inputReq)
throws RemoteException{
String srcnum = inputReq.srcNum;
String varnum = inputReq.varNum;
int availstatus =0;
llfirst = list.getFirst();
//System.out.println("llfirst.nodeNum "+ llfirst.nodeNum);
whileloop:while (llfirst != null){
if((llfirst.nodeNum).equals(srcnum)){
ifirst = llfirst.ilist.getFirst();
breakloop: while(ifirst != null){
//System.out.println("var num " + varnum + " " + "status outside" + ifirst.varStat);
if((ifirst.varNum).equals(varnum)){
if (ifirst.varStat == 1){
availstatus = 1;
ifirst.varStat = 0;
// System.out.println("var num " + varnum + " " + "status" + availstatus);
break whileloop;
ifirst = ifirst.next;
llfirst = llfirst.next;
//System.out.println("var num " + varnum + " " + "status" + availstatus);
return availstatus;
public dataPacket senDatatoNode(reqPacket sendFromRTS)
throws RemoteException {
String nnum, vnum, dtype, dval;
//nnum = "";
dtype="";
//opchannel = llfirst.olist;
// ipchannel = llfirst.ilist;
reqPacket sendfromrts = sendFromRTS;
nnum = sendfromrts.srcNum;
vnum = sendfromrts.varNum;
// dtype = sendFromRTS.dataType;
dval = "";
int ctrchk=0;
try{
//send data to process node n reduce the counter by 1
llfirst = list.getFirst();
mainWhile: while (llfirst != null){
if((llfirst.nodeNum).equals(nnum)){
ofirst = llfirst.olist.getFirst();
whileofirst: while(ofirst != null){
if((ofirst.varNum).equals(vnum)){
dval = ofirst.varVal;
ofirst.counter = ofirst.counter - 1;
// System.out.println(ofirst.counter);
ctrchk=ofirst.counter;
break whileofirst;
ofirst = ofirst.next;
//set the status of respective input channel to 0 as data has been sent
ifirst = llfirst.ilist.getFirst();
if(ctrchk == 0){
whileifirst: while(ifirst != null){
if((ifirst.varNum).equals(vnum)){
//ifirst.varVal = dval;
ifirst.varStat =0;
break whileifirst;
llfirst = llfirst.next;
//System.out.println(llfirst);
catch(NullPointerException s){}
//find type
try{
DriverMatrix_mthds driver = new DriverMatrix_mthds();
driver.VarTypeArray();
driver.Variablelist();
driver.NodeOrigin();
driver.nodeInput();
driver.numOfnodes();
driver.noOfVariables();
driver.novarType() ;
String[][] lookupvar = driver.varNameType();
int i, j;
String varNum = vnum;
for(i=0; i<=lookupvar.length-1; i++){
j=0;
if(lookupvar[i][j] != null){
if(lookupvar[i][j].equals(vnum)){
dtype = lookupvar[i][2];
catch (Exception d){}
dataPacket retpac = new dataPacket(nnum, vnum, dtype, dval);
System.out.println("msg sent "+ nnum +" " + vnum+" "+ dtype+" "+ dval);
return retpac;
public String findnodeName(String nodeNum)
throws RemoteException{
String nnum = nodeNum;
llfirst = list.getFirst();
while (llfirst != null){
if((llfirst.nodeNum).equals(nnum)){
return llfirst.nodeName;
llfirst = llfirst.next;
System.out.println("node Number does not match with the list of node numbers generated..try again");
return null;
//find the nodenum given the node name
public String findnodenum(String nodename)
throws RemoteException{
String nodenumber ="";
String nodname = nodename;
try{DriverMatrix_mthds driver = new DriverMatrix_mthds();
driver.VarTypeArray();
driver.Variablelist();
driver.NodeOrigin();
driver.nodeInput();
driver.numOfnodes();
driver.noOfVariables();
driver.novarType() ;
driver.varNameType();
String[][] lookupnode = driver.nodeNumName();
int i, j;
for(i=0; i<=lookupnode.length-1; i++){
for(j=0; j<=2; j++){
if(lookupnode[i][j] != null){
if(lookupnode[i][j].equals(nodname)){
nodenumber = lookupnode[i][2];
catch (Exception d){}
return nodenumber;
public String findvarnum(String variablename)
throws RemoteException{
String varnumber = "";
try{
DriverMatrix_mthds driver = new DriverMatrix_mthds();
driver.VarTypeArray();
driver.Variablelist();
driver.NodeOrigin();
driver.nodeInput();
driver.numOfnodes();
driver.noOfVariables();
driver.novarType() ;
String[][] lookupvar = driver.varNameType();
int i, j;
String varname = variablename;
for(i=0; i<=lookupvar.length-1; i++){
for(j=0; j<=2; j++){
if(lookupvar[i][j] != null){
if(lookupvar[i][j].equals(varname)){
varnumber = lookupvar[i][0];
catch (Exception d){}
return varnumber;
public String findvartype(String varname)
throws RemoteException{
String vartype = "";
try{
DriverMatrix_mthds driver = new DriverMatrix_mthds();
driver.VarTypeArray();
driver.Variablelist();
driver.NodeOrigin();
driver.nodeInput();
driver.numOfnodes();
driver.noOfVariables();
driver.novarType();
String[][] lookupvar = driver.varNameType();
int i, j;
String varName = varname;
for(i=0; i<=lookupvar.length-1; i++){
for(j=0; j<=2; j++){
if(lookupvar[i][j] != null){
if(lookupvar[i][j].equals(varName)){
vartype = lookupvar[i][2];
catch (Exception d){}
return vartype;
public String findtypenum(String vartype){
String varnum = "";int i;
try{
DriverMatrix_mthds driver = new DriverMatrix_mthds();
driver.VarTypeArray();
driver.Variablelist();
driver.NodeOrigin();
driver.nodeInput();
driver.numOfnodes();
driver.noOfVariables();
String varNum[][] = driver.novarType() ;
String varType = vartype;
for(i=0; i<=9-1; i++){
if(varNum[i][0] != null){
if(varNum[i][0].equals(varType)){
varnum = varNum[i][1];
catch (Exception d){}
return vartype;
//return input variable list
public String[] inoutchanlist(String nodenum, String nodenam)
throws RemoteException{
try{
DriverMatrix_mthds drive = new DriverMatrix_mthds();
String[] varLIST = drive.Variablelist();
int i=0;int j;
while(varLIST[i]!=null){
i=i+1;
int arrlength = i;
inoutChan = new String[arrlength];
i=0; j=0;
WHILELOOP:
while(!(varLIST[i].equals("end of file"))){
while(varLIST[i].equals(nodenum)){
i=i+1;
while(varLIST[i].equals(nodenam)){
i=i+1;
while(!(varLIST[i].equals("end of input variable"))){
inoutChan[j] = varLIST[i];
i=i+1;
j=j+1;
System.out.println("endofinput");
inoutChan[j]="endofinchan";
j=j+1;
i=i+1;
while(!(varLIST[i].equals("end of output variable"))){
inoutChan[j] = varLIST[i];
i=i+1;
j=j+1;
System.out.println("endofoutput");
inoutChan[j]="endofoutchan";
break WHILELOOP;
i=i+1;
arrlength =j;
for(j=0; j<=arrlength-1; j++){
System.out.println(inoutChan[j]);
catch (Exception e){}
return inoutChan;
public String[] inchannel(String[] inoutChan) throws RemoteException{
int count=0;int i=0, j=0;
System.out.println("entered");
while(inoutChan[count]!=null){
System.out.println(count + " " +inoutChan[count]);
count=count+1;
inChan = new String[count];
while(!(inoutChan[i].equals("endofinchan"))){
inChan[j] =inoutChan[i];
j=j+1; i=i+1;
return inChan;
public String[] outchannel(String[] inoutChan) throws RemoteException{
int count=0;int i=0, j=0;
System.out.println("entered");
while(inoutChan[count]!=null){
System.out.println(count + " " +inoutChan[count]);
count=count+1;
outChan = new String[count+1];
while(!(inoutChan[i].equals("endofinchan"))){
i=i+1;
i=i+1;
while(!(inoutChan[i].equals("endofoutchan"))){
outChan[j] =inoutChan[i];
j=j+1; i=i+1;
return outChan;
public String[] invarChan(String nodename, int guardno)throws RemoteException{
try{
DriverMatrix_mthds drive = new DriverMatrix_mthds();
invarLIST = drive.invarlist();
int i=0;int j;
while(invarLIST[i]!=null){
i=i+1;
int arrlength = i;
inVAR = new String[arrlength];
i=0; j=0;
WHILELOOP: while(!(invarLIST[i].equals("end of file"))){
if (invarLIST[i].equals(nodename)){
i=i+1;
while(!(invarLIST[i].equals(nodename+String.valueOf(guardno)))){
i=i+1;}
i=i+1;
while(!(invarLIST[i].equals("endofguard"))){
System.out.println(invarLIST[i]);inVAR[j]=invarLIST[i]; i=i+1; j=j+1;}
break WHILELOOP;}
i=i+1;}
}catch (Exception d){}
return inVAR;
public String[] outvarChan(String nodename, int guardcount)throws RemoteException{
try{
DriverMatrix_mthds drive = new DriverMatrix_mthds();
outvarLIST = drive.outvarlist();
int i=0;int j;
while(outvarLIST[i]!=null){
i=i+1;
int arrlength = i;
outVAR = new String[arrlength];
i=0; j=0;
WHILELOOP: while(!(outvarLIST[i].equals("end of file"))){
if (outvarLIST[i].equals(nodename)){
i=i+1;
while(!(outvarLIST[i].equals(nodename+String.valueOf(guardcount)+"guard"))){
i=i+1;}
i=i+1;
while(!(outvarLIST[i].equals("end guard"))){
System.out.println(outvarLIST[i]);outVAR[j]=outvarLIST[i]; i=i+1; j=j+1;}
break WHILELOOP;}
i=i+1;}
}catch (Exception d){}
return outVAR;
private static Boolean start;
private static Boolean tstart;
public void sendstart(Boolean start) throws RemoteException {
tstart = start;
public Boolean getstart() throws RemoteException{
return tstart;
private static Boolean done;
private static Boolean tdone;
public void senddone(Boolean done) throws RemoteException {
tdone = done;
public Boolean getdone() throws RemoteException{
return tdone;
private static Boolean vac_busy1;
private static Boolean tvac_busy1;
public void sendvac_busy1(Boolean vac_busy1) throws RemoteException {
tvac_busy1 = vac_busy1;
public Boolean getvac_busy1() throws RemoteException{
return tvac_busy1;
private static int cus1_rit1;
private static int tcus1_rit1;
public void sendcus1_rit1(int cus1_rit1) throws RemoteException {
tcus1_rit1 = cus1_rit1;
public int getcus1_rit1() throws RemoteException{
return tcus1_rit1;
private static int cus1_rit2;
private static int tcus1_rit2;
public void sendcus1_rit2(int cus1_rit2) throws RemoteException {
tcus1_rit2 = cus1_rit2;
public int getcus1_rit2() throws RemoteException{
return tcus1_rit2;
private static int cus1_rit3;
private static int tcus1_rit3;
public void sendcus1_rit3(int cus1_rit3) throws RemoteException {
tcus1_rit3 = cus1_rit3;
public int getcus1_rit3() throws RemoteException{
return tcus1_rit3;
private static int cus1_it1;
private static int tcus1_it1;
public void sendcus1_it1(int cus1_it1) throws RemoteException {
tcus1_it1 = cus1_it1;
public int getcus1_it1() throws RemoteException{
return tcus1_it1;
private static int cus1_it2;
private static int tcus1_it2;
public void sendcus1_it2(int cus1_it2) throws RemoteException {
tcus1_it2 = cus1_it2;
public int getcus1_it2() throws RemoteException{
return tcus1_it2;
private static int cus1_it3;
private static int tcus1_it3;
public void sendcus1_it3(int cus1_it3) throws RemoteException {
tcus1_it3 = cus1_it3;
public int getcus1_it3() throws RemoteException{
return tcus1_it3;
private static int stkit_11;
private static int tstkit_11;
public void sendstkit_11(int stkit_11) throws RemoteException {
tstkit_11 = stkit_11;
public int getstkit_11() throws RemoteException{
return tstkit_11;
private static int stkit_12;
private static int tstkit_12;
public void sendstkit_12(int stkit_12) throws RemoteException {
tstkit_12 = stkit_12;
public int getstkit_12() throws RemoteException{
return tstkit_12;
private static int stkit_13;
private static int tstkit_13;
public void sendstkit_13(int stkit_13) throws RemoteException {
tstkit_13 = stkit_13;
public int getstkit_13() throws RemoteException{
return tstkit_13;
private static int c1_it1;
private static int tc1_it1;
public void sendc1_it1(int c1_it1) throws RemoteException {
tc1_it1 = c1_it1;
public int getc1_it1() throws RemoteException{
return tc1_it1;
private static int c1_it2;
private static int tc1_it2;
public void sendc1_it2(int c1_it2) throws RemoteException {
tc1_it2 = c1_it2;
public int getc1_it2() throws RemoteException{
return tc1_it2;
private static int c1_it3;
private static int tc1_it3;
public void sendc1_it3(int c1_it3) throws RemoteException {
tc1_it3 = c1_it3;
public int getc1_it3() throws RemoteException{
return tc1_it3;
//endoffile -
Hello all, I am e newbie in the world of RMI programming. I have developed an application that can control two devices over the internet. The code files are given below :
Parallel.java
import java.rmi.*;
public interface Parallel extends Remote
void relayDriver(byte k) throws RemoteException;
byte currentStatus() throws RemoteException;
ParallelImpl.java
import parport.ParallelPort;
import java.rmi.*;
import java.rmi.server.*;
public class ParallelImpl extends UnicastRemoteObject implements Parallel
private Byte ctrlValue;
ParallelPort lpt1 = new ParallelPort(0x378); // 0x378 is normally the base address for the LPT1 port
public ParallelImpl(byte a) throws RemoteException
ctrlValue = a;
lpt1.write(ctrlValue);
System.out.println("Device Actuation Code "+ctrlValue);
public void relayDriver(byte k) throws RemoteException
ctrlValue = k;
System.out.println("Device Actuation Code "+ctrlValue);
lpt1.write(ctrlValue);
public byte currentStatus() throws RemoteException
return ctrlValue;
ParallelClient.Java
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ParallelClient extends JApplet implements ActionListener
Byte g;
String url = "rmi://169.254.196.149/";
private Container container;
private javax.swing.JTextArea resultArea;
public void init()
container = getContentPane();
container.setLayout( new BorderLayout() );
resultArea = new javax.swing.JTextArea();
JRadioButton buttonZero = new JRadioButton("No Device
On");
buttonZero.setMnemonic(KeyEvent.VK_A);
buttonZero.setActionCommand("0");
buttonZero.setSelected(true);
JRadioButton buttonOne = new JRadioButton("Device 1 On
Only");
buttonOne.setMnemonic(KeyEvent.VK_B);
buttonOne.setActionCommand("1");
JRadioButton buttonTwo = new JRadioButton("Device 2 On
Only");
buttonTwo.setMnemonic(KeyEvent.VK_C);
buttonTwo.setActionCommand("2");
JRadioButton buttonThree = new JRadioButton("Device 1
and 2 Both On");
buttonThree.setMnemonic(KeyEvent.VK_D);
buttonThree.setActionCommand("3");
//Group the radio buttons.
ButtonGroup group = new ButtonGroup();
group.add(buttonZero);
group.add(buttonOne);
group.add(buttonTwo);
group.add(buttonThree);
//Register a listener for the radio buttons.
buttonZero.addActionListener(this);
buttonOne.addActionListener(this);
buttonTwo.addActionListener(this);
buttonThree.addActionListener(this);
JPanel radioPanel = new JPanel(new GridLayout(0, 1));
radioPanel.add(buttonZero);
radioPanel.add(buttonOne);
radioPanel.add(buttonTwo);
radioPanel.add(buttonThree);
container.add(radioPanel, BorderLayout.LINE_START);
container.add(resultArea, BorderLayout.SOUTH);
public void actionPerformed(ActionEvent e)
try
Parallel r1 = (Parallel)Naming.lookup(url +
"inival");
if(r1.currentStatus()==0)
resultArea.setText("Previous
Status: No Devices Online....");
else if(r1.currentStatus()==1)
resultArea.setText("Previous
Status: Device 1 Online. Device 2 Offline.");
else if(r1.currentStatus()==2)
resultArea.setText("Previous
Status: Device 2 Online. Device 1 Offline.");
else
resultArea.setText("Previous
Status: Device 1 & 2 both are Online.");
g = Byte.parseByte(e.getActionCommand());
r1.relayDriver(g);
if(r1.currentStatus()==0)
resultArea.setText("Current
Status: No Devices Online....");
else if(r1.currentStatus()==1)
resultArea.setText("Current
Status: Device 1 Online. Device 2 Offline.");
else if(r1.currentStatus()==2)
resultArea.setText("Current
Status: Device 2 Online. Device 1 Offline.");
else
resultArea.setText("Current
Status: Device 1 & 2 both are Online.");
catch(Exception et)
resultArea.setText("Server OffLine");
ParallelServer.java
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
public class ParallelServer
public static void main(String args[])
try
System.out.println("Constructing Server Implementations ....");
ParallelImpl p1 = new ParallelImpl((byte)0);
System.out.println("Binding Server Implementation to registry ....");
Naming.rebind("inival",p1);
System.out.println("Waiting for invocations from Client ....");
catch(Exception e)
System.out.println("Server is Offline or Line has broken. Error : "+ e);
The corresponding stub files, class files have been loaded on the internet. http://rcviproject.110mb.com/
On the server machine the rmi registry is on and the ParallelServer program is also running. But when the applet at the URL is actuated then it shows 'server offline'. Why is this happening? Please help.That did not print anything. The server when started by the following commands :
start rmiregistry
start java ParallelServer
continues to run at Waiting for invocation from client ...... no error msg is shown.
do i need tomcat on the server machine in addition to this ? -
RMI server object lookup in a session bean
Hi all,
I am getting MarshalException when I call java.rmi.Naming.lookup() in a session
bean. Following is the code and exception. Please note that I am using java.rmi
package instead of weblogic.rmi and that both the session bean and RMI server
object (a startup class) is deployed on the same machine.
Thanks for your help in advance.
// a simple, replica-aware session bean method
// some code here
try {
MediatorInterface mediator = (MediatorInterface) java.rmi.Naming.lookup("rmi://localhost:7001/TestMediator);
catch (Exception e) {
// log the exception
The exception:
java.rmi.MarshalException: Error marshaling transport header; nested exception
i
s:
java.io.EOFException
java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:224)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:206
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at test.mgmtop.CreateNetworkOpHandler.execute(CreateNetworkOpHandler.jav
a:88)
at test.mgmtop.CreateNetworkOpHandler.perform(CreateNetworkOpHandler.jav
a:28)
at test.ejb.MgmtServiceBean.create(MgmtServiceBean.java:57)
at test.ejb.MgmtServiceSession_idi8yo_EOImpl.create(MgmtServiceSession_i
di8yo_EOImpl.java:46)
at test.ejb.MgmtServiceSession_idi8yo_EOImpl_WLSkel.invoke(Unknown Sourc
e)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:762)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:295)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)Hi Pyung,
How about trying this instead:
InitialContext ctx = new InitialContext();
MediatorInterface mediator = (MediatorInterface) ctx.lookup("TestMediator");
This assumes your startup class binds the Mediator to the JNDI name "TestMediator".
- Matt
Pyung Yoon wrote:
Hi all,
I am getting MarshalException when I call java.rmi.Naming.lookup() in a session
bean. Following is the code and exception. Please note that I am using java.rmi
package instead of weblogic.rmi and that both the session bean and RMI server
object (a startup class) is deployed on the same machine.
Thanks for your help in advance.
// a simple, replica-aware session bean method
// some code here
try {
MediatorInterface mediator = (MediatorInterface) java.rmi.Naming.lookup("rmi://localhost:7001/TestMediator);
catch (Exception e) {
// log the exception
The exception:
java.rmi.MarshalException: Error marshaling transport header; nested exception
i
s:
java.io.EOFException
java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:224)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:206
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at test.mgmtop.CreateNetworkOpHandler.execute(CreateNetworkOpHandler.jav
a:88)
at test.mgmtop.CreateNetworkOpHandler.perform(CreateNetworkOpHandler.jav
a:28)
at test.ejb.MgmtServiceBean.create(MgmtServiceBean.java:57)
at test.ejb.MgmtServiceSession_idi8yo_EOImpl.create(MgmtServiceSession_i
di8yo_EOImpl.java:46)
at test.ejb.MgmtServiceSession_idi8yo_EOImpl_WLSkel.invoke(Unknown Sourc
e)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:762)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:295)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
Maybe you are looking for
-
right now we have one itunes library, one apple id and 2 devices. so when we put an itunes card on the account, it is a race for who can use up the $ first. We are adding a 3rd device. I want to split the accounts so each person can spend their ow
-
Name of the Attachment without getting the entire message
Hi, Does anybody here knows how can i list all the messages with attachments and the name of the files attached without invoking getBodyPart()? I want to use POP3 as my mail getting protocol. Thank's in advance Ivan Koji Koga
-
Polishing the Clamshell's outer case
I recently acquired a very clean iBook SE 466 Graphite. It is in excellent cosmetic condition but on the, white part of the upper case there are a few scuffs, not even scratches. Other than these the case has that nice unblemished icy glean to it. Th
-
Aperture 3 hangs and crashes when using the retouch brush
Hi. I upgraded from A2 to A3 recently. I was pretty happy until I started to use the Retouch brush, which in best cases is incredibly slow (churns and churns...), and often makes A3 crash. It already killed one of my finest photo by corrupting the en
-
Wireless printing problems with 10.5.4 and Epson printers
Anyone else know about problems with Epson printers such as this no longer functioning wirelessly with bonjour once upgrade to 10.5.4? It appears they are not supporting this with a new driver yet? At this time, Epson says they have no drivers for 10