RMI callback error
We have a client that makes an RMI call. The server then tries to make a callback to the client. I know the client's call to the server succeeds, but when the server tries to make the callback, it gives the error below.
Until recently the callback worked most of the time, but now it errors most of the time. The few times it works is mostly late at night. Some here have speculated that the cause is related to the network load. We aren't going through any firewalls. Unfortunately I'm not the author of this code, I inherited it and I'm primarily a C++ programmer.
Does anyone have any suggestions?
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err:java.rmi.ConnectException: Connection refused to host: 10.8.96.207; nested exception is:
java.net.ConnectException: Operation timed out: connect
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err:java.net.ConnectException: Operation timed out: connect
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at java.net.PlainSocketImpl.socketConnect(Native Method)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at java.net.Socket.<init>(Socket.java:268)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at java.net.Socket.<init>(Socket.java:95)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:20)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:115)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:494)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:169)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:78)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at radar_jclient.RadarClientRemoteObjectImpl_Stub.loginResult(RadarClientRemoteObjectImpl_Stub.java:120)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at com.ourcompany.radar.radar_server.RadarServerImpl$Registerer.run(RadarServerImpl.java:131)
Sun Jan 09 20:25:13 MST 2005:ExecGroup-0:err: at com.ourcompany.radar.radar_util.RadarThreadPool$PooledThread.run(RadarThreadPool.java:86)
Mark
Is 10.8.96.207 the correct IP address for the client? Can this address be pinged from the server host?
If it can be pinged, I have to agree that it is network load, although you would need a huge load or a very erratic network to cause this problem (dropping of at least 3 SYN packets at increasing intervals). Are there now any bridges &c in the network that weren't there when it worked? or have any of the NICs changed? or any other network topology?
Similar Messages
-
RMI callbacks with no replica aware stubs in a cluster?
We would like to use either an RMI ping mechanism or an RMI callback in an upcoming project but are limited to 1.1 and 1.2 JRE's. I don't believe generating a replica aware proxy is an option for us given those constraints, no support for dynamic proxies. So we have a remote server object that we would ideally like to be clusterable that we can register a callback interface with. How can we accomplish this given our client limitations with weblogic 8.1 RMI? Any options?
Yep you speak no lies. Of course once I thought about it some more I realized the error of assuming one could register a jdk rmi object with a weblogic rmi object. JRMP vs T3?. Not good.
We still like using plain jane RMI w/in weblogic. I can register my UnicastRemoteObject stub with a normal RMI object on the server and it can callback and deliver messages. It will also send heartbeats periodically. If the heartbeat isn't heard from in awhile we re-register through http. The advantage of this is that the http session has failed over to another box and the web tier manages the rmi registration for me. The client can remain ignorant of any RMI lookups, which are tedious when not using JNDI or the cluster aware proxy.
All of this to get back a few seconds and keep a few thousand clients from polling through a servlet every second. Argh JDK 1.1.
Thanks for hammering that final point in. -
RMI callback with JAVA1.5
Since the version 1.5 we have no need to distribute the stub to all the clients.
It's a great feature, but I need to perform a callback from the server to the client, in this case I need to perform a call to UnicastRemoteObject.exportObject() client-side before calling the registration method exposed by the server, and the stub of the class implementing the callback interface must be placed in the classpath of the server, is it true? Is there any other methos to perform an RMI-callback?
To be clear as much as possible I have this interface exposed by the server
public interface Services extends Remote
public Map<String, ApplicationStatus> applicationsList () throws RemoteException;
public ApplicationStatus startApplication (String identifier) throws RemoteException;
public ApplicationStatus stopApplication (String identifier) throws RemoteException;
public int exitCode (String identifier) throws RemoteException;
* This method, as the name says, is used by the client to register the listener to some server-side event.
* @param callback
* @throws RemoteException
public void registerForNotification (ExitCodeCallback callback) throws RemoteException;
}and the interface of the callback is
public interface ExitCodeCallback extends Remote
public void notifyExitCode (ExitCodeEvent event) throws RemoteException;
}On the server side I export the services in the registry
Services servicesServerSide = new MyServices();
Services services = (Services) UnicastRemoteObject.exportObject(servicesServerSide , 0);and on the client I perform a lookup of the services
Registry registry = LocateRegistry.getRegistry("192.168.0.1", 1099);
Services services = (Services) registry.lookup("SERVICES");I export my implementation of the interface
public class ClientExitCodeCallback implements ExitCodeCallback
public void notifyExitCode (ExitCodeEvent event)
System.out.println(event.asString());
}through the code
services.registerForNotification(remoteCallback);but on the calling of this method I obtain a ServerSideException
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: it.sogei.jscheduler.rmi.client.ClientExitCodeCallback_Stub
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
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:126)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.registerForNotification(Unknown Source)
at it.sogei.jscheduler.rmi.client.StartClient.main(StartClient.java:45)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: it.sogei.jscheduler.rmi.client.ClientExitCodeCallback_Stub
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:285)
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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: it.sogei.jscheduler.rmi.client.ClientExitCodeCallback_Stub
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:246)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:279)
... 6 moreIs it true all of the above?If the server gets that exception, it's because the client found and used the stub when it exported its callback, or else the server is running < 1.5.
If the client explicitly cites a port number or zero and it is running >= 1.5 and there is no stub class, it won't use it; it will create a dynamic stub class; and it will send an object of that class to the server as a parameter to the registration call. If the server is running >= 1.5, it will succesfully deserialize that object, reconstruct the dynamic stub from information in the serialization stream, and execute the registration method implementation.
If the client exports by using a stub class instead of the above, it will create an object of that class and send it to the server as a parameter to the registration call; the server will try to deserialize it; and if it doesn't have the stub class available it will throw that exception.
This is how it works. -
Hi,
I have a simple RMI Callback Client/Sever Application, where the client-side is inplemented in a JApplet. All works fine by local tests (client and server on my machine), but when the client is on remote machine I got an security exception or error (ClassFormatError(Bad magic number)).
How can I make my client/server work?No, I'm testing inside LAN, no firewalls, no proxys, no nothing. Just a server and the client (applet).
And this strange error, I'll paste the entire stack trace:
java.lang.ClassFormatError: Client (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
On my local machine oll works fine... is the problem the applet's "sandbox"? Or...?
Any ideas are welcome
Thanks -
Hi,
I'm trying to get a RMI Callback running on 2 different machines. The client registers itself at the server who then calls a method on the client. Locally everything works fine, but when running the server on a different PC I get a ConnectException when trying to call the callback method on the client. Funnily enough, the IP to which the connection is refused is that of the server! Why does it try to connect to itself? No firewalls involved, policies okay, registry running... Tested already with two machines running the same OS and Java version.
What am I missing?
Thanks a lot!I'm also facing the same problem. The application without callbacks runs without problem in one machine AND two different machines. but when i run those on different machines the app with callbacks fails. In this case the client program gives error. The IP address it looks to connect is correct in my case.
Lookup completed
Server said hello
Exception in CallbackClient: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ConnectException: Connection refused to host: 192.168.0.199; nested exception is:
java.net.ConnectException: Connection refused -
Hello WL gurus,
I'm trying to convert an existing regular RMI server into a fantastic WL
RMI server so I can use it for a callback. From what I've seen I don't
think I need to change anything to the implementation of my server's
impl (I bind however into the Context now), nor anything for my
interface (no import weblogic.rmi.XXX).
I've done a simple call from a standalone client to this server, and I
receive this proxy back:
%java -classpath $WLCLASSPATH:$JINICLASSPATH:. TestWLRMI mycomp 7001
Successfully connected to EventBroker on mycomp at port 7001 got stub:
weblogic.rmi.internal.LeasedRemoteRef@113 - jvmid:
'-6820166576366540384S:132.204.96.20:[7001,7001,7002,7002,7001,7002,-1]:vaucher:myserver',
oid: '275'
I seem to get what is a WL rmi proxy (great!!).
If I then want to use this same server to receive a callback, I get a
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException: cirano.nadim.services.EventBroker_Stub
connection error (it wants to send the _stub):
If I remove the "extends javax.rmi.server.UnicastRemoteObject" from my
server impl, it instead tries to serialize the class itself, and I get:
java.rmi.MarshalException: error marshalling arguments; nested exception
is:
java.io.NotSerializableException: cirano.nadim.services.EventBroker
I'm using WL-6.1 sp2 with
jdk1.3.1 build 1.3.1-b24 on
RedHat 7.1
I'm contacting a JavaSpace that should get the remote reference to
generate remote events.
I've also added the following to my policy file:
permission java.io.SerializablePermission "enableSubstitution";
I didn't have any problems using regular RMI, but I had problems using a
third-party thread pool package (by D. Lea), so I wish to switch to use
the execute queues.
Thanks for any help you might offer,
Stephane Vaucher
CIRANO
Research ProfessionalSince I'm using standard Java RMI for the first invocation (from wl to
my rmi server), I don't know what protocol is being used (come to think
of it, probably just a simple protocol over stream sockets).
My wl server wants to send the information necessary for a callback i.e.
a remote refence to itself, normally a RMI stub, or for wl a proxy. When
I attempt to do this, the rmi server doesn't seem to send a proxy, but a
serialized version of itself, if it does not inherit
UnicastRemoteObject(URO). If it does inherit URO, then it tries sending
a _stub (the normal java way) in which case, it will not use wl RMI, but
standard java rmi.
My tests indicate that we can only access a wl rmi server using a iiop
or t3 protocol. I'm assuming that if we use java rmi, we automatically
exclude the possibility of using wl RMI; I believe this to be a weakness
to wl RMI.
Regards,
Stephane Vaucher
CIRANO
Research Professional
Andy Piper wrote:
Stephane Vaucher <[email protected]> writes:
I'm not sure I understand your question. I've got two rmi servers: my
wl rmi server (started by my startup class) and my distant rmi server
(jini service). The wl server locates the jini service and
communicates with it using, I believe, HTTP and Object serialization,
if it's not it is certainly not iiop or t3.
No idea what you are talking about now :)
My wl server sends a rmi reference to itself for a callback. This rmi
reference is normally a stub, but since wl rmi doesn't use stubs, why
does it not send the super proxy? Or is it out of wl's capabilities?
It should work. The stub doesn't get sent but the relevant data does.
andy
Cheers,
Stephane Vaucher
CIRANO
Research professional
Andy Piper wrote:
Stephane Vaucher <[email protected]> writes:
Are you using iiop or t3?
Try making the impl just implement your remote interface.
andy
Hello WL gurus,
I'm trying to convert an existing regular RMI server into a
fantastic
WL RMI server so I can use it for a callback. From what I've seen I
don't think I need to change anything to the implementation of my
server's impl (I bind however into the Context now), nor anything for
my interface (no import weblogic.rmi.XXX).
I've done a simple call from a standalone client to this server,
and I
receive this proxy back:
%java -classpath $WLCLASSPATH:$JINICLASSPATH:. TestWLRMI mycomp 7001
Successfully connected to EventBroker on mycomp at port 7001 got stub:
weblogic.rmi.internal.LeasedRemoteRef@113 - jvmid:
'-6820166576366540384S:132.204.96.20:[7001,7001,7002,7002,7001,7002,-1]:vaucher:myserver',
oid: '275'
I seem to get what is a WL rmi proxy (great!!).
If I then want to use this same server to receive a callback, I get
a
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException:
cirano.nadim.services.EventBroker_Stub
connection error (it wants to send the _stub):
If I remove the "extends javax.rmi.server.UnicastRemoteObject" from
my
server impl, it instead tries to serialize the class itself, and I get:
java.rmi.MarshalException: error marshalling arguments; nested
exception is:
java.io.NotSerializableException: cirano.nadim.services.EventBroker
I'm using WL-6.1 sp2 with
jdk1.3.1 build 1.3.1-b24 on
RedHat 7.1
I'm contacting a JavaSpace that should get the remote reference to
generate remote events.
I've also added the following to my policy file:
permission java.io.SerializablePermission "enableSubstitution";
I didn't have any problems using regular RMI, but I had problems
using
a third-party thread pool package (by D. Lea), so I wish to switch to
use the execute queues.
Thanks for any help you might offer,
Stephane Vaucher
CIRANO
Research Professional -
'JS Callback error while executing script' in 4.7
hello everyone,
When I was installing SAP 4.7 after the Database load jobs I am getting an error like ' JS Callback error while ecevuting script'.... Jobs are loading but after thatI was having this error... I tried several times but the error is the same... Can anyone plz help me out in this regard ?? If anyuone having scrreenshots of 4.7 installation plz help me...
Byeem
-
RemoteException: 111 java.rmi.ServerError: Error occurred in server thread
Hi,
I'm just new to the RMI field of JAVA. I'm trying to write a program that import the math.jar file in the server side. And the client end can invoke the methods of math.jar and get the value.
I got the error messages as below:
RemoteException: 111 java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.NoClassDefFoundError: org/mathwhizz/Heron
It can work well if I use source classes(*.class) directly instead of importing math.jar. The failure only happened when I try to make use of jar file. Thus I guess my setup and configuration should be ok. Is there anything I should be very careful if I try to run RMI and import a jar file in the program of server side ?
Do I need to use JNLP and web start application in this issue?
I'm appreciated for your responses...thanks...
Sincerely,
BrandonI've got a problem with rmi, when I launch my server, I have this error:
Erreur du remote: java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.NoClassDefFoundError: com/borland/dx/dataset/DataSetData
Help me please
Thank you -
NAPT Firewall, RMI Callbacks and JRMP MultiplexProtocol
Hi All,
I am looking at having an RMI client behind a Network Address Port Translation firewall receive RMI calls back from an RMI server. NAPT makes it impossible for the client to listen for connection coming from the server through the NAPT firewall.
This is discussed at http://www.rmiproxy.com and http://cssassociates.com/rmifirewall.html but the proposed solutions do not appear to use the MultiplexProtocol protocol defined by JRMP (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/spec/rmi-protocol3.html).
The RMI FAQ
"How can I receive incoming RMI calls through a local firewall"?
(http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html#firewallIn) had a section for JSSE 1.3 that explained how to use the multiplex protocol (option 4). It sounds like this option referred to the JRMP MultiplexProtocol protocol.
The multiplex protocol option has been removed from the 1.4 FAQ
(http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#firewallIn).
Tried the "checkListen" and "socket factory" techniques mentioned in the 1.3 FAQ without success with 1.4.2. The RMI client behind the NAPT firewall runs in a signed Applet.
Is the ability of using the JRMP MultiplexProtocol protocol available in the JRE in order to receive incoming RMI calls through a local firewall? If yes, what do you do in order to use it?
What is the best way to have RMI callbacks work behind NAPT?
Thanks a lot in advance!
Cheers
BertrandAs of about JDK 1.2.2, the ability of RMI clients to negotiate the multiplex protocol was
removed, but the server-side support remains.
Your best answer for negotiating NAT filrewalls may be the RMI Proxy http://www.rmiproxy.com, although I could be biased as I wrote it.
EJP -
RMI Callbacks with Highavailability
Hi,
I would like to use the RMI Callbacks mechanism. The only problem I got is that I need to also implement highavailability, meaning that I will have more than one server. How can this be implement? Do I need to pass the callback reference to all the other servers? Is it possible to keep the reference in a data base?
Thanks!I resent your remark.
A client can connect to one server. Now, this server has the refernce to later be used by RMI Callback. In order for other servers to use it as well, the server can serialize the reference and save it in the DB (that was my question - if saving it in the database is possible). A server that gets a request from a client and wants to forward it to another client, checks to see if it has its reference. If not, it reads it from the database and uses it. -
Hello everyone!
I have problem with RMI callbacks. I have on server function "connect" which is adding a client to host lists. Then if necessary I send something to people from that list. Everything is working, client can send info to server which is next resend to clients from host list. But problem is at start-up. Sending to a server a reference to a client object is very, very slow. It takes about 10-20 sec.
Then everything is fine, every method gives me an answer within parts of seconds.
How can I eliminate this startup problem?
Thanks in advance,
DanielIt seems that I resolve the problem first :) Hopfully.
Here is the answer for those of You who has or will have same problem:
If you want to pass the object by reference to server you need to implement Remote interface. Of course this is implemented by class UnicastRemoteObject, which you have to extend, but you must remember to implement it in every object which is called by class as well. I have forgoten about this and insted passing by reference it copied object, which is horrible SLOW!! -
RMI Callback messages can not be sent to all clients
we I send a message to all clients using RMI Callback the message dont arrive to all clients when one or more clients is disconnected without removing themselves from the hashtable at the server side .
how i can know if the client is disconnected before sending the message to him using RMI callback taking into account that the client dosnt tell the server when he has disconnected.
please i want a solution to this problem.
thanksYou seem to be making this a little complicated. During the login (or sometime) have one of the parms that are passed back to the server be a remote object on the client. It can have a nice interface like
public void callMe(Object obj) throws .... or you could get cute and add
pubic void shutDown() throws.... but this could be handled in the other method.
During the call the client becomes the server and the server the client. The callMe method has no clue as to what thread it is on so it should just quickly queue up whatever it has gotten and return. It should not be doing work that will effect the Awt thread. If the client is no longer there then you should be able to catch this on the server, and continue posting other clients.
Howie
Your question is very similar to what I'm currently
researching. I've got the additional complication of
detecting when clients crash without unregistering (in
my case unlocking) a resource. I haven't written any
test code yet, so don't shoot me if I'm wrong, but
here is my general strategy.
In order to implementing RMI callbacks, it looks like
you must make both the clients and the server register
themselves in the RMI Registry. Parameters sent
through RMI method calls are done by value so
you can't simply add a listener as you normally do.
The server will put itself in the registry using a
well known ID. The clients will get this reference
and ask the server for a unique ID. They will then
register themselves in the RMI registry using this
value. The client will then tell the server that it
is registered. I believe if the client object is
wrapped in a WeakReference, then when the client dies
or ends, the reference contained in the WeakReference
will be null. The server will perform this check on
all registered clients to determine which clients are
still alive.
,Marcus -
New @ RMI need help with java.rmi.UnmarshalException: error unmarshalling
Hi @ all out there,
I'm new with Java RMI and have to write a EventSystem for an college project where clients can subscribe to a topic and get notified when someone publishes a message to the subscribed topic.
At server-side I have a class called EventSystem that provides methods for subscribing and unsubscribing from topics, and also for posting messages (for publishers).
To subscribe i thought that the client must specify the topic and also itself ( means that a client calls in this way: obj.subscribe("mytopic", this).
The EventSystem handles a list of all clients, and whenever a new message is posted it goes trough all clients and invokes the handleMessage(String msg) method that all Clients have to provide.
On my local machine without RMi this concept works just great.
I now tried to get it working using RMI , but I get the following Exception when starting the client (the server starts fine) :
Looking up for rmiregistry at 138.232.248.22:1099
Subscriber exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.io.InvalidClassException: SubscriberImpl; SubscriberImpl; class invalid for deserialization
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:336)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.subscribe(Unknown Source)
at SubscriberImpl.main(SubscriberImpl.java:48)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.io.InvalidClassException: SubscriberImpl; SubscriberImpl; class invalid for deserialization
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:293)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.InvalidClassException: SubscriberImpl; SubscriberImpl; class invalid for deserialization
at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:713)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1733)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:290)
... 9 more
Caused by: java.io.InvalidClassException: SubscriberImpl; class invalid for deserialization
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:587)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
... 13 moreI googled now for 2 hours but can't resolve the problem alone. As far as I can understand I have to serialize Objects that I want to send to the server, right?
So how can i do this? I've never used serialization till now.
any ideas how to solve this problem?
greets from italy and sorry for my very weak english
bd_italyA class has been modified after deployment. Stop the Registry, clean, recompile, and redeploy.
-
JSP client in RMI system - java.rmi.UnmarshalException: error unmarshalling
Hi,
Im developing a login part for a distributed airline reservation system using JSP as the client but while executing the jsp, the error that is being catched is :
java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: AirlineImpl_Stub (no security manager: RMI class loader disabled)
Here are my codes:
//Interface - Airline.java
package Air;
import java.rmi.*;
public interface Airline extends Remote
public int CheckUname(String username) throws RemoteException;
}//implementation - AirlineImpl.java
import java.net.*;
import java.io.*;
import java.sql.*;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class AirlineImpl extends UnicastRemoteObject implements Airline
public AirlineImpl() throws RemoteException
super();
public int CheckUname(String username) throws RemoteException
try
int UnameCount = 0;
String xxx = "eaglebeta";
if(username.equals(xxx)
UnameCount++;
return UnameCount;
catch (Exception e3)
System.out.println("Error: " + e3);
return 0;
}//Server - AirlineServer.java
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class AirlineServer
public static void main(String arg[])
try
Airline myAirline = new AirlineImpl();
Naming.rebind("Airline", myAirline);
System.out.println();
System.out.println("************************************");
System.out.println(" >>> Airline Reservation System <<< ");
System.out.println(" >>> Server is Listening! <<< ");
System.out.println("************************************");
System.out.println();
catch (RemoteException e)
//System.out.println("Error: " + e);
System.out.println("RMI Registry is not active!");
System.out.println("Activate RMI Registry and retry!");
System.out.println("Bye bye, exiting...");
catch (java.net.MalformedURLException e)
//System.out.println("URL Error: "+ e);
System.out.println("URL Malformed!");
System.out.println("Bye bye, exiting...");
}//JSP client - newuser.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.rmi.*, javax.servlet.*" %>
<%@ page import="java.util.*, java.lang.*, java.io.*, Air.Airline" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#99CCFF">
<%
Object Airline = null;
try
Airline Air = (Airline)Naming.lookup("rmi://localhost/Airline");
String Name = "eaglebeta";
if(Air.CheckUname(Name)>0)
%>
Username already exists, choose another name
<%
else
%>
<%=Name%>
<%
catch (Exception e1)
%>
<%=e1%>
<%
%>
</body>
</html>The server, implementation, interface and stub are in a folder named "Airline Server" located on my desktop.
The interface and stub again are in another folder named "Air" located in the "classes\Air" directory which is located in the tomcat 5.5 installation directory!
The JSP client is located in the "Root" folder in the tomcat 5.5 installation derectory!
1. I start the registry in the "Airline Server" folder by typing rmiregistry
2. Load the Airline Server - java AirlineServer
3. Call the jsp - http://localhost/newuser.jsp
And i get the following error:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: AirlineImpl_Stub (no security manager: RMI class loader disabled)
Please help me to solve this problem!When I am including security manager in my JSP code, the browser just get blank without any display
if(System.getSecurityManager() == null)
System.setProperty("java.security.policy", "java.policy");
System.setSecurityManager(new RMISecurityManager());
}Please, someone solve my problem! Im realy stuck and I don't know how to proceed! Provide me with a solution or any tutorial that would help me... -
Java.rmi.MarshalException: error marshalling arguments
I've two class Client and Main. Eventnotify is implemented in class Client using RMI techniques. Here is sample
public interface EventNotify extends Remote {
void SendNotification (String str) throws RemoteException;
public class Client implements EventNotify {
//implementation of EventNotify
public void SendNotification(String str) {
System.out.println("from srver: ..." +str);
class Main {
public static void main(String[] args) {
Client clnt = new Client();
int val = stub.register_client(host, clnt); //THE ERROR IS HERE
The idea is to pass remote objects from client to a server. I've a server program running continously, but the problem is on passing objects of type Client. I'm facing marshaling problem.
AND THE ERROR IS
Client exception: java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: Client
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: Client
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:156)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:195)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:149)
at $Proxy0.register_client(Unknown Source)
at Main.main(Client.java:74)
Thanks for helping.
Caused by: java.io.NotSerializableException: Client
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)
at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:292)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:151)Probably I have a similar problem while calling remote object's method with parameter looks like that :
public class ParamClass extends AbstractParamClass implements Runnable,
java.io.Serializable {
private NodeList field1; // part of crimson's tree
private NamedNodeMap field2 = null;// part of crimson's tree
public class RmiRemote extends AbstractRemote { // Remote Object Class
@Override
public Object remoteMethod1() throws RemoteException{
ParamClass param = new ParamClass("build with crimson");
CustomInterface stub = (CustomInterface) registry.lookup(name);
stub.callRemoteMethod(param); // exception here
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: org.apache.crimson.tree.AttributeSet
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:138)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)when I build param object with xerces - no exception occurs . Other methods of remote object doing well. Remote object extends AbstractRemote superclass derived from UnicastRemoteObject. How can I avoid this problem and call method with crimson's tree fields parameter?
Thank you.
Maybe you are looking for
-
Sending mail attachments as attachments, not images
I send a lot of resumes, and I set up my Mac Mail to function with my website's email address. I recently changed my resume to a PDF. When I attach it, it appears as an image. I just want to attach it for others to download as a file. I know I can to
-
Removing "recent words" suggestions from Kotoeri
I'm using the Japanese Kotoeri input and accidentally entered a gibberish word combination. Now, Kotoeri keeps suggesting this gibberish combination in its "recent words" window whenever I start typing a similar combination of characters. It's really
-
GNOME 3: File Management Default Is Baobab
I am using GNOME 3 for my desktop and AWN for a launcher. Every time I open a directory in either Cardapio or any of the default menus on AWN, Baobab opens and tries to analyze the folder. How can I set it so that Nautilus opens these? I feel as if t
-
Brush presets / tool presets - confusion
I'm by no means a beginner (I think this I'm in my 15th year using Photoshop..), but something that's always bugged me is the difference between brush presets and tool presets. It's never been much of an issue in the past, but I'm spending an increas
-
is it possible to retrieve photos and videos that was uploaded to itunes account but on a different computer