RMI Stub Error
solved it!
wheeewwww i dont know why but im sure i've used the option of forward slash before.
continuation of the problems below.....
hi!
i've been trying to debug this auto downloading of Stub or classes, but i cant see what's wrong with the code that it cant see the stub... here's the code
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import classServer.ClassFileServer;
import java.io.IOException;
public class ProcessServer{
private static ClassFileServer cfs = null;
public static void main(String[] args){
setOptions();
//startHTTP();
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
try{
System.out.println("Starting server...");
Process p = new ProcessImpl("tuaman");
//String host = "rmi://localhost/TProcess";
//Naming.rebind(host, p);
String url = "TProcess";
Naming.rebind(url, p);
System.out.println("RMI binded...");
}catch(Exception e) {System.out.println("Error creating server..." + e);}
private static void setOptions(){
System.setProperty("java.rmi.server.codebase", "file:/C:\\Restua\\temp\\rmi\\/");
System.setProperty("java.security.policy", "java.policy");
private static void startHTTP(){
String loc = "C:\\Restua\\temp\\rmi";
try {
cfs = new ClassFileServer(2001, loc);
}catch(IOException io){ System.out.println("err cfs : " + io);}
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import java.rmi.RMISecurityManager;
public class ProcessClient {
public static void main(String[] args) {
setOptions();
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
try {
//String url = "rmi://localhost/TProcess";
String url = "TProcess";
Process p = (Process)
Naming.lookup(url);
System.out.println( p.getDescription() );
catch(Exception e){
System.out.println("Exception all.");
public static void setOptions(){
System.setProperty("java.rmi.server.codebase", "file:/C:\\Restua\\temp\\rmi\\/");
System.setProperty("java.security.policy", "java.policy");
} thanks again =)
--my previous post.....
hi!
I'm tying to run an RMI, on the tutorial it says run the service, with the classpath, here's my setup
C:\Restua\temp\rmi>dir
Volume in drive C has no label.
Volume Serial Number is D805-23B8
Directory of C:\Restua\temp\rmi
07/31/2006 11:38 AM <DIR> .
07/31/2006 11:38 AM <DIR> ..
07/31/2006 11:07 AM 219 Process.class
07/31/2006 11:07 AM 162 Process.java
07/31/2006 11:22 AM 1,099 ProcessClient.class
07/31/2006 11:21 AM 1,344 ProcessClient.java
07/31/2006 11:13 AM 608 ProcessImpl.class
07/31/2006 11:12 AM 460 ProcessImpl.java
07/31/2006 11:27 AM 1,649 ProcessImpl_Stub.class
07/31/2006 11:37 AM 913 ProcessServer.class
07/31/2006 11:37 AM 415 ProcessServer.java
9 File(s) 6,869 bytes
2 Dir(s) 16,828,911,616 bytes free
C:\Restua\temp\rmi>here's the content of the class...
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Process extends Remote{
String getDescription() throws RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
public class ProcessImpl extends UnicastRemoteObject
implements Process{
private String desc;
public ProcessImpl(String d) throws RemoteException{
super();
desc = d;
public String getDescription() throws RemoteException{
return "I am " + desc;
import java.rmi.Naming;
public class ProcessServer{
public static void main(String[] args){
try{
System.out.println("Starting server...");
Process p = new ProcessImpl("tuaman");
Naming.rebind("rmi://localhost/1099/TProcess", p);
}catch(Exception e) {System.out.println("Error creating server..." + e);}
}i opened a command windom ran rmiregistry on it, then on the other shell i ran this...
C:\Restua\temp\rmi>java -classpath . ProcessServer
Starting server...
Error creating server...java.rmi.ServerException: RemoteException occurred in se
rver thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: ProcessImpl_Stubeven with a java ProcessServer that error occurs, what could be wrong? Why cant it locate the Stub? Thank you so much again Sir/Mam =)
updates....
it works fine now =) made a security or policy file, then added a security manager =)
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
public class ProcessServer{
public static void main(String[] args){
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
try{
System.out.println("Starting server...");
Process p = new ProcessImpl("tuaman");
String host = "rmi://localhost/TProcess";
Naming.rebind(host, p);
System.out.println("RMI binded...");
}catch(Exception e) {System.out.println("Error creating server..." + e);}
}Message was edited by:
tuaman
Message was edited by:
tuaman
Message was edited by:
tuaman
Message was edited by:
tuaman
You have a mixture of GNU java and Sun Java installed. Get rid of the former.
Similar Messages
-
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. -
Urgent: please help - Object Hash Code of RMI stubs in a cluster
Hello all,
I'm trying to find out for a week now if members of a cluster can get out of synch
regarding "Object Hash Code" of RMI stubs in the JNDI.
After binding an RMI object to one server (no rmic performed since the object
is in the classpath of both servers and the service is pinned), the JNDI mapping
looked identical on both servers.
However, while one server went down for a few hours, the other server has changed
the "Object Hash Code" to a new one (the binding name stayed constant). When the
server went up again it tried to lookup the object under the same binding, then
found it but failed to execute remote methods on it. An error message says that
the object was garbage collected:
java.rmi.NoSuchObjectException: Unable to dispatch request to Remote object with
id: '347'. The object has been garbage collected. at weblogic.rjvm.RJVMImpl.dispatchRequest(RJVMImpl.java:766)
at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:738) at weblogic.rjvm.ConnectionManagerServer.handleRJVM(ConnectionManagerServer.java:207)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:777) at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:508)
at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:664) at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
Why isn't the new JNDI mapping replicated to the new booting server? Should I
use specific rmic flags? How can I maintain the JNDI trees identical on all clustered
servers?
I'm using two managed WLS 7.02 servers running on win2000 servers.
DaniHi Andy,
Thank you for responding.
The binding code looks like that:
m_ctx = new InitialContext();
int index = getNextAvailableRepositoryJNDIIndex();
m_ctx.bind(
NODE_PREFIX+index,
this
where this is the Remote implementation.
How will I make the object hash code constant or have all views remain constant
when the GC changes its reference?
Dani
Andy Piper <[email protected]> wrote:
"Daniel Gordon" <[email protected]> writes:
I'm trying to find out for a week now if members of a cluster can getout of synch
regarding "Object Hash Code" of RMI stubs in the JNDI.The hash code can probably change since the stub represents an
aggregate view of the cluster. But this may be a red-herring. What
does your code look like that binds the rmi object? It may be that DGC
is biting you.
andy -
I got a problem with runing RMI application.Sometimes it works well, but when I made some changes to Impl class, it sometimes shows :
Exception in thread "main" java.rmi.ServerException: Server RemoteException; nes
ted exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: com.qa.rmi.QAserverImpl_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:159)
at com.qa.rmi.QAserverImpl.main(QAserverImpl.java:29)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
ception is:
java.lang.ClassNotFoundException: com.qa.rmi.QAserverImpl_Stub
Caused by: java.lang.ClassNotFoundException: com.qa.rmi.QAserverImpl_Stub
I will appreciate whoeven gives me some idea to solve this problem.
DavidMost likely your java.server.rmi.codebase system property is not properly set (or if you are not trying do download the class files automatically, your classpath is not set properly).
It looks like the rmiregistry cannot find the class file for the com.qa.rmi.QAserverImpl rmi stub. Either you did not generate the stub file with rmic, or the codebase (or classpath) does not point to where it can be found. -
RMI, stubs and skeleton and EJB
HI,
IN RMI we copy stub on client machine and skeleton on Server machine.
EJBs are said to be extension of RMI.
In EJB when we deploy EJB on the app Server server generates stubs and skeleton.
But on the client machine we don't copy any stub.
So from where these stubs (home stub and remote stub ) comes on client machine because we only depoly the EJB at server and then use that from client
Can anybody explain this ?
Thanks,
Ankur MittalHi,
A number of these answers are correct. The thing to keep in mind is that the entire issue of RMI stubs and the mechanism by which those stubs are made available to the runtime code(whether that code is running in a J2EE server or a client) is vendor-specific. One important thing to note is that these generated artifacts are not present in a portable J2EE archive (.ear, ejb-jar, .war, etc.)
If needed, they are generated at some point by the J2EE implementation. Some vendors expose tools that generate these artifacts. The original J2EE 1.4 SDK beta release had such a tool called j2eec.
Alternatively, many vendors generate them as part of the deployment stage itself. In that case, it's typical for the deployment process to produce some output file that contains the generated artifacts. This is the approach used in the current J2EE 1.4 SDK. The output file is usually referred to as a client.jar. The stubs are automatically available to any code running within the server, but client applications that need them must somehow make the client.jar available to the client JVM. For Application Clients, this is done by specifying the client.jar as one of the input arguments to the runclient command. For stand-alone clients, the client.jar is simply added to the user-classpath when starting the JVM.
Some vendors also support automatic stub-downloading. This has the advantage that the stubs don't have to be available to the client classpath when the client starts. The downside is that using automatic stub downloading requires that a security manager be installed in the client JVM. That typically isn't an issue for the Application Client container, but many stand-alone clients are not coded to instantiate a security manager.
Yet another approach is to dynamically generate the stubs within the client code itself. This is one of the best options since it completely removes the notion of stubs from the developer's view. It's too bad this wasn't done from the beginning, since stub configuration is one of the most common errors encountered by EJB developers. In addition, the static generation of such artifacts is often a deployment-time bottleneck. Finally, note that the EJB Remote view is only one of many J2EE technologies that potentially require such generated artifacts. E.g., web services implementations typically rely on some of the same mechanisms to marshall and unmarshall requests.
--ken
Kenneth Saks
J2EE SDK Engineering
SUN Microsystems -
Hello
i read that ,in JDK 1.5 you don't have to generate stubs manually for server but it is generated automatically but when i tried this code , it throws this exception ,why???!!!!
public static void main(String[] args) {
try {
System.out.println("Constructing server implementations...");
LoginImpl Login = new LoginImpl();
System.out.println("Binding server implementations to registry...");
Context namingContext = new InitialContext();
namingContext.bind("rmi:Login", Login);
System.out.println("Waiting for invocations from clients...");
} catch (Exception e) {
e.printStackTrace();
}Exception
javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: dbHandling.Login]
at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
at com.sun.jndi.toolkit.url.GenericURLContext.bind(Unknown Source)
at javax.naming.InitialContext.bind(Unknown Source)
at dbHandling.Main.main(Main.java:16)
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: dbHandling.Login
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
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(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
... 4 more
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: dbHandling.Login
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
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.lang.ClassNotFoundException: dbHandling.Login
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:247)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:711)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:655)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:592)
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:1531)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1493)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
... 12 more
thanks in advancedPresumably dbHandling.Login is your remote
interface?
The Registry and the client both need access to that
via their CLASSPATHs or the codebase mechanism.yes dbHandling.Login is my interface and client can access it but i don't know how to make registry can access it
thanks -
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 -
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.
-
Java.rmi.UnmarshalException: Error unmarshaling return header
Hi,
We are running an RMI server instance to serve data ( from memory) to clients. It works fine if fewer number of inquiries goes in. But when the number of inquiries are larger, I am getting some exceptions at the client side. The server crashes without throwing any exceptions. Following are the exceptions received at client side:
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.net.SocketException: Connection reset
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:203)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at com.emf1.dataserver.KeyFrequencyKeeper_Stub.getDUNSCounts(Unknown Source)
at com..match.KeyFrequencyKeeperProxy.getKeyKQSs(KeyFrequencyKeeperProxy.java:307)
at com.emf1.match.KeyGenerator.generateKeys(KeyGenerator.java:453)
at com.emf1.match.InquiryProcessor.run(InquiryProcessor.java:870)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at java.io.DataInputStream.readByte(DataInputStream.java:331)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:189)
... 6 more
The period of time, the server keeps on running (before it crashes) is also not the same. Sometimes it works fine without any problem. But most of the time the server crashes after processing some records.
I don't know why this is happening.
Please help...
Thanks in advance..I have this error too when I running my rmi server site program.
I am running it in Linux Environment.
Anyone got any idea about this? -
Hello,
I am trying to make an Applet work with an RMI server, but i keep getting the same exception again and again whatever i do.
More specifically, i get the following :
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.net.MalformedURLException: unknown protocol: c
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at server.ClientDemo.initGUI(ClientDemo.java:100)
at server.ClientDemo.<init>(ClientDemo.java:85)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at sun.rmi.server.LoaderHandler.pathToURLs(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)
... 13 more
The exeption is thrown at the following line :
remoteReference = (RMIServer) registry.lookup(RMIServer.REGISTRY_NAME);
This is the code of the server which seems to be running ok:
if(System.getSecurityManager()==null)
System.setSecurityManager(new SecurityManager());
registry = LocateRegistry.createRegistry(1099);
RMIServer sr=(RMIServer) UnicastRemoteObject.exportObject(new ServerDemo(),1099);
registry.rebind(RMIServer.REGISTRY_NAME, sr);
and the client:
registry = LocateRegistry.getRegistry("localhost");
remoteReference = (RMIServer) registry.lookup(RMIServer.REGISTRY_NAME);
Thank you in advance
Alex
Forgot to mention that i am setting the security policy and codebase programmatically:
System.setProperty("java.security.policy","C:\\Users\\Alex\\workspace\\Demo\\grantall.policy");
System.setProperty("java.rmi.server.codebase","C:\\Users\\Alex\\workspace\\Demo\\bin");
Edited by: Alkon on May 15, 2008 4:31 PMI edited the code that sets the security and i am now getting the following error, again at the lookup:
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at server.ClientDemo.initGUI(ClientDemo.java:101)
at server.ClientDemo.<init>(ClientDemo.java:91)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(Unknown Source)
... 15 more -
Java.rmi.UnmarshalException:error
hi,
A rmi program does not work on my pc but it worked on others pc there are three programs ie RMIServer.java which is the server application ,RMIClient.java which is the client application and RMIInterface.java which has two methods which are remote all these programs gets compiled but while running it from the dos prompt it gives these errors:
RemoteException occured in serverthread;nested exception is:java.rmi.UnmarshalException:error unmarshalling arguments;nested exception is:java.lang.ClassNotFoundException:RMIServer_stub
what is the problem how does it work on others pc and not on mine how should i handle these exception what are the reasons for its occurrance please helpIt might help to start the rmiregistry from the directory where your class files are stored.
In this case the rmiregistry adds its working directory to its codebase.
Just keep in mind that the rmiregistry works in a similar fashion to the javac compiler & needs to be able to find the _Stub & _Skel class files. -
Java.rmi.UnmarshalException: error unmarshalling arguments;
Hi!
I'm a newbe with rmi, and I try to use a test program, from Thinking in Java:
ITiempoPerfecto.java
package c15.rmi;
import java.rmi.*;
interface ITiempoPerfecto extends Remote {
long obtenerTiempoPerfecto() throws RemoteException;
TiempoPerfecto.java
package c15.rmi;
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.net.*;
public class TiempoPerfecto extends UnicastRemoteObject implements ITiempoPerfecto {
public long obtenerTiempoPerfecto () throws RemoteException {
return System.currentTimeMillis();
public TiempoPerfecto() throws RemoteException {
super();
public static void main(String[] args) throws Exception {
System.setSecurityManager(new RMISecurityManager());
TiempoPerfecto tp=new TiempoPerfecto();
Naming.bind("//localhost/TiempoPerfecto",tp);
System.out.println("Preparado para dar la hora");
}and
MostrarTiempoPerfecto.java
package c15.rmi;
import java.rmi.*;
import java.rmi.registry.*;
public class MostrarTiempoPerfecto {
public static void main(String[] args) throws Exception {
System.setSecurityManager( new RMISecurityManager());
ITiempoPerfecto t=(ITiempoPerfecto)Naming.lookup("//localhost/TiempoPerfecto");
for (int i=0;i<10;i++)
System.out.println("Tiempo perfecto: "+t.obtenerTiempoPerfecto());
}I compile all the files normally.
Later I do:
rmiregistry &
rmic c15.rmi.TiempoPerfecto(This only generate the file TiempoPerfecto_Stub.class, it's ok?)
Without warnings or errors. But when I try to create a server object
java c15/rmi/TiempoPerfectoI obtain this:
Exception in thread "main" java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: c15.rmi.TiempoPerfecto_Stub
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)
.......What is the mistake? What may I do to run this programs?
Thank you!You must change your current directory to your class path (EX: java c15/rmi/TiempoPerfecto) then execute command remiregistry.
-
RemoteException: java.rmi.ConnectIOException: error during JRMP connection
We have a Java application implementing a RMI server.
The server uses with the jacob api in order to generate Word files in a windows system.
My clients work in linux.
The RMI method is synchronized in order not to have problems executing Word from multiple threads.
The application and the RMI server work all right for some time, but after some hours (sometimes days) the client throws the following error:
RemoteException: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketException: Connection resetHi Varun,
This is definitely required even if you are on WAS6.40.
After copying this , you have to also follow the register dll using this command
rgsvr32 "c:\Winnt\system32\librfc32.dll"
check the OS your using wether it is windowsXP/2003 or 2000.
there are seperate commands for them to register the dll.
This is available in the installation guide.
we also had the same problem and then we did this and it worked for us.
f you have done this, then there are other possibilities also
1. Install SOAP toolkit on the CRM server as this is required to establish the connectivity
2. See whether the MAPBOX services are deployed on the SAP J2EE engine
3. Create RFC through SM59 only for mapbox and register them.
4. See if there are any old versions of Java on your machine then uninstall them and install the required java components.
Let us know if it resolved the problem
Thanks
Yash
reward points if it helps. -
Hi all,
i want to generate RMI stubs. But by default, the application server generates as RMI Over iiop stubs. I cant use this stubs for some reason.
So, i want to know that how to generate RMI (JRMP) for an enterprise application using AS 8.1?
Is there any descriptors to specify that?
Thank you in advance,
MDBHi all,
i want to generate RMI stubs. But by default, the application server generates as RMI Over iiop stubs. I cant use this stubs for some reason.
So, i want to know that how to generate RMI (JRMP) for an enterprise application using AS 8.1?
Is there any descriptors to specify that?
Thank you in advance,
MDB
Maybe you are looking for
-
Same account, different computers...
Hi, I use my iTunes account on my MacBook and on someone elses laptop. If she downloads apps on her laptop, can I also have them on my MacBook? It's doesn't show in the 'Purchased' tab in iTunes, however it does show in my recently purchased bit in m
-
We have a cube logical partitioned by sales org. We now would like to add additional sales org's to the list. Is this possible?? Currently with data in the cube it is blocked. Does anyone know steps to re-logical partition a cube?? With/or withou
-
Dynamic variables' naming from SendAndLoad
Hello, Been chasing my tail for almost 2days now, I'm having problems on how to load dynamically named variables and place it on dynamically named movieclips. I'm loading variables from php/mysql query thru sendAndLoad (no problem with that). The loa
-
jsp: useBean.. and c: coding
I am trying to understand this coding. 1. What does the <jsp: useBean .. class="coreservlets.ShoppingCart"> mean? Are we bringing in the content of the ShoppingCart class? If we use <% import="coreserlets.*"> at the top of JSP, wouldn't this work to
-
Not too sure if posting this here is correct, but here goes. Might seem dumb but, when I begin to type a word in the search field for Yahoo, a drop down menu of history searches opens. Convenient but how can I clear this?? Thanks in advance, Paul 14