RMI ClassNotFoundException:HelloImpl_stub
Hi there,
I'm trying to start my Rmi Server but I always get this exception:
RMI ClassNotFoundException:HelloImpl_Stub
In the rmiregistry window the following message appears:
File not found when looking for: HelloImpl_stub
All my class files are in the dir c:\mysrc, and I started rmiregistry there, with no classpath setted. The classes aren't inside packages.
Then, I used the following command line, with the CLASSPATH including c:\mysrc :
java -Djava.rmi.server.codebase=file:c:\mysrc -Djava.rmi.server.hostname=computer07 HelloImpl
When I do that I get those messages showed above.
I'm using Windows NT Workstation and I'm not using a Web Server.
I would aprecciate any help.
Thanks,
Nei
java -Djava.rmi.server.codebase=file:c:\mysrc
-Djava.rmi.server.hostname=computer07 HelloImpl
try using file:/c:\mysrc
Similar Messages
-
Problem running a simple Hello World RMI Program
I wrote a simple RMI application, consisting of a Server Interface, Server Implementation and a Client.
Since the codes are really small, am pasting them here so that you could identify the problem if any, in the code.
1. Server Interface......
import java.rmi.* ;
public interface HelloInterface extends java.rmi.Remote
public void sayHello(String arg) throws RemoteException ;
2. Server Implementation......
import java.rmi.* ;
import java.rmi.server.* ;
public class HelloImpl extends UnicastRemoteObject implements HelloInterface
public HelloImpl() throws RemoteException
super() ;
public void sayHello(String arg) throws RemoteException{
try{
System.out.println("RMI Program : Hello "+arg) ;
catch(Exception e){
e.printStackTrace() ;
//throw new java.rmi.UnexpectedException("undeclared checked exception", e);
public static void main(String[] args) throws RemoteException
try{
if( System.getSecurityManager() == null )
System.setSecurityManager( new RMISecurityManager() ) ;
HelloImpl impl = new HelloImpl() ;
Naming.bind("HelloService",impl) ;
System.out.println( "Service bound..." ) ;
catch(Exception e){
e.printStackTrace() ;
//throw new java.rmi.UnexpectedException("undeclared checked exception", e);
3. Client Code.
import java.rmi.* ;
import java.rmi.Naming.* ;
class RMIClient
public static void main(String[] args)
try{
if(System.getSecurityManager()==null)
System.setSecurityManager( new RMISecurityManager() ) ;
HelloInterface helloInt = (HelloInterface) Naming.lookup("rmi://sand.cise.ufl.edu/HelloService") ;
helloInt.sayHello("Ranjit") ;
catch(Exception e){
e.printStackTrace() ;
I have double checked the classpaths and they all look fine..
I have even unset the classpath from the shell which runs the rmiregistry..am still getting these errors..
1. If i use the default java to run the application..this is the error that it spits..
sand:24% java -Djava.security.policy=java.policy HelloImpl
java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
java.lang.ClassNotFoundException: HelloImpl_Stub
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:110)
at HelloImpl.main(HelloImpl.java:28)
Caused by: java.lang.ClassNotFoundException: HelloImpl_Stub
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:350)
... 3 more
2. Using java from some other location..the error looks different...but in both cases it just gives errors :((
sand:25% /usr/java1.2/bin/java -Djava.security.policy=java.policy HelloImpl
java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
java.lang.ClassNotFoundException: HelloImpl_Stub
java.lang.ClassNotFoundException: HelloImpl_Stub
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Compiled Code)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:116)
at HelloImpl.main(HelloImpl.java:28)
I am embarking on a huge assignment but if am having problems getting started..
Your help will be highly appreciated..
thanx and regards
Ranjit IyerFirst of all you should be posting this Q in the RMI forum :)
You are getting that error because your stub is not in your clients classpath (or u can say the compiler is not able to find it).
Make sure that the file HelloImpl_Stub is in the client classpath/package.
Regards
Meka Toka -
Solution contradicts documentation
Hi,
For two days I was caught up with the problem of rmi.ClassNotFoundException for the _stub.class while trying to register the remote object in rmiregistry.
I wrote the remote class and remote interface, started the rmiregistry, and when I tried to bind the remote object, I was getting the above mentioned error. I couldn't even get the "hello world" samples to run. The solution to the problem was:
Before starting the rmiregistry, set CLASSPATH=%CLASSPATH%;D:\my\project\bin\rmiHostDir\
rmiHostDir is where I kept the generated _stub.class. Before doing this, my problem was temporarily solved by using the command "javaw sun.rmi.registry.RegistryImpl" instead of rmiregistry. But I have no problems since I set the classpath before starting rmiregistry. However, the RMI documentation at http://java.sun.com/docs/books/tutorial/rmi/running.html clearly mentions that one should unset the CLASSPATH before starting rmiregistry. One the other hand, documentation at http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html does not mention any such requirement of "unsetting" the CLASSPATH.
There is clearly something out of place. Can someone please explain what's happening here?
Cheers,
Namit
P.S.: I am working on java2se 1.4.1_07. Neither Naming.rebind nor LocateRegistry.getRegistry().rebind worked for me before I fixed the classpath problem.java.rmi.server.codebase (1.1 and later)
See here:
http://java.sun.com/j2se/1.5/docs/guide/rmi/javarmiproperties.html
This property specifies the locations from which classes that are published by this JVM (for example: stub classes, custom classes that implement the declared return type of a remote method call, or interfaces used by a proxy or stub class) may be downloaded. -
RMI server ClassNotFoundException
I'm trying to resurrect some of my old RMI code and running into problems where the bind() throws a ClassNotFoundException for the remote interface. The old code ran on a older JDK and an older version of Windows.
Any help you could offer would be GREATLY appreciated.
I'm running on Windows XP Pro with 5.0 of the JDK. I've done my best to turn off any firewall, ani-virus, and Internet worm (Norton) checking.
I've tried to reduce it a trivial case:
* Message: an interface that extends Remote
* MessageImpl: a class that implements Message and extends
UnicatseRemoteObject.
* MessageServer: a class with a main method that:
a) creates an instance of MessageImpl
b) does a bind passing a name and the above instance.
All this is compiled and in a single jar.
I start the rmiregistry and run the Server.
However, I still get:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Message
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)i have the same problem.
and when i try to add the path (where my .class files are) to the classpath with the following command:
SET CLASSPATH=c:\temp\rmitester
then I still have the problem
C:\Temp\rmitester>java OkServerImpl
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: OkServer
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: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:343)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:111)
at OkServerImpl.main(OkServerImpl.java:18)
So was this the correct way to set my classpath??? -
Hello,
I'm not able to run the RMI example code provided by the sun tutorial. When I attempt running ComputeEngine in Eclipse I get:
ComputeEngine exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: compute.Compute
The code may be found on http://java.sun.com/docs/books/tutorial/rmi/running.html
I've only removed the code concerned with security. I run the registry in the terminal, before trying to execute. I recall it had worked with me yesterday, but today presenting it not.The RMI Registry can't find the class(es) in question on its CLASSPATH. So what to do?Err, make sure the RMI Registry can find the class(es) in question on its CLASSPATH?
For example, specify -J-classpath when starting the RMI Registry. Or start it in the root directory of your .class package structure. Or start it withing the server JVM via LocateRegistry.createRegistry(). Or use the codebase feature. -
I am trying to connect to mysql Db through RMI but i am getting this exception.
When trying to connect to db through a normal class implementation without RMI it is connected succesfully.
What is causing the problem????
Thanks in advaceCLASSPATH, man. The RMI server needs to have the MySQL driver JAR in its CLASSPATH.
That's usually what that exception means.
% -
I'm trying to run the hello world rmi example and I get these exceptions:
HelloImpl err: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: examples.hello.HelloImpl_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: examples.hello.HelloImpl_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: examples.hello.HelloImpl_Stub
java.lang.ClassNotFoundException: examples.hello.HelloImpl_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at examples.hello.HelloImpl.main(HelloImpl.java:29)
the HelloImpl_stub.class is in the server codebase and in the HelloImpl dir, should it be anywhere else?Follow
Set the Codebase while running the server.
eg:
java -Djava.rmi.server.codebase=file:/E:\rmiserver/
-Djava.security.policy=file:/E:\rmiserver\mypolicy <RMISERVER>
where my Stub classes and Server classes reside in E:\rmiserver
Make a note here: If u r running under Windows:
file:/E:\rmiserver/ points to the code base and stub classess can be found my rmiserver
Also make sure u have a policy file if using JDK 2
Create a Ascci file like this. for now grant all:
Pony java.security.policy to this file.
Policy File:
grant {
// Grant All permissions
permission java.security.AllPermission;
Hope this solves. -
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. -
I got the following problem.
My Server code is a simple RMI Server. I've also made a new policy
grant {
permission java.security.AllPermission;
};And give the following run commands: -Djava.security.policy=/home/nxt/java/SimpleRMI.policy
I did the same for the client:
Only with a different run command:
-Djava.rmi.server.codebase=file:/home/rawi/Desktop/Server/build/classes/server
-Djava.security.policy=/home/rawi/Desktop/Server/build/classes/server/SimpleRMI.policy
When I remove this from my code:
if (System.getSecurityManager() == null)
System.setSecurityManager (new RMISecurityManager());
The data does arrive on de Server, but the client gives me the following error:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: ReceiveMethods (no security manager: RMI class loader disabled)
But when I put this back,I got the error code;
Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 145.24.159.188:6666 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
Anyone any idea?
client code
import java.rmi.*;
import java.rmi.registry.*;
public class Client {
static public void main(String args[]) {
ReceiveMethods rmiServer;
Registry registry;
String serverAddress = "145.24.159.188";
String serverPort = "6666";
String text = "testing";
System.out.println("sending " + text + " to " + serverAddress + ":" + serverPort);
if (System.getSecurityManager() == null)
System.setSecurityManager (new RMISecurityManager());
try {
// get the registry
System.out.println("Maak registry code aan");
registry = LocateRegistry.getRegistry(serverAddress,
(new Integer(serverPort)).intValue());
// look up the remote object
System.out.println("We gaan de registry opzoeken");
rmiServer = (ReceiveMethods) (registry.lookup("Server"));
// call the remote method
System.out.println("We gaan de methode's uitvoeren");
rmiServer.Links();
rmiServer.Rechts();
//2e methode
} catch (RemoteException e) {
System.out.println("RemoteException Failure 1:" );
e.printStackTrace();
} catch (NotBoundException e) {
System.out.println("NotBoundException Failure 2:" );
e.printStackTrace();
}Server code:
import java.rmi.*;
import java.rmi.registry.*;
import java.net.*;
//import server.ReceiveMethods;
public class Server extends java.rmi.server.UnicastRemoteObject
implements ReceiveMethods, Runnable
int thisPort;
String thisAddress;
Registry registry; // rmi registry for lookup the remote objects.
DataExchange DE;
Pilot P;
public void run()
System.out.println("Run methode van Server");
try {
KomMaar();
catch (Exception e)
System.out.println("Things went Wrong" +e);
public Server(DataExchange DE, Pilot P) throws RemoteException {
private void KomMaar() throws RemoteException {
System.out.println("KomMaaar Methode komt");
if (System.getSecurityManager() == null)
System.setSecurityManager (new RMISecurityManager());
try {
// get the address of this host.
thisAddress = (InetAddress.getLocalHost()).toString();
} catch (Exception e) {
throw new RemoteException("can't get inet address.");
thisPort = 6666; // this port(registrys port)
System.out.println("this address=" + thisAddress + ",port=" + thisPort);
try {
// create the registry and bind the name and object.
registry = LocateRegistry.createRegistry(thisPort);
System.out.println("rmiServer wordt gebind");
registry.rebind("Server", this);
} catch (RemoteException e) {
throw e;
public void Links() {
System.out.println("Methode links wordt uitgevoerd");
Action move = new Action(1);
Thread links = new Thread(move);
links.start();
public void Rechts() {
System.out.println("Methode Rechs wordt uitgevoerd");
Action move = new Action(2);
Thread rechts = new Thread(move);
rechts.start();
}Edited by: hansteeuwen on Oct 13, 2009 12:09 PMI did the same for the client:
Only with a different run command:
-Djava.rmi.server.codebase=file:/home/rawi/Desktop/Server/build/classes/server Codebase is specified at the server only, unless the client is exporting remote objects of its own (i.e. callbacks).
Also that codebase specification would be wrong anyway - it should stop at 'classes', assuming 'server' is a package.
Finally, if you are using the codebase feature you must have a security manager in the client, as the exception is telling you.
Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 145.24.159.188:6666 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)So your client isn't seeing your .policy file. Run it with -Djava.security.debug=access,failure to check that. There's somethign wrong with the way you've specified the policy file.
registry = LocateRegistry.getRegistry(serverAddress,
(new Integer(serverPort)).intValue());Why are you holding the serverPort as a string in the first place?
Server code:
public void run()Why does the server have a run() method? That's not usual. Just put all that stuff into the constructor. -
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.
-
Java.rmi.ServerException:
I am new to RMI concept
i stuck with the below problem
when i execute
E:\MyProjects\StockRMI>java -Djava.security.policy=policy.all StockMarketServerStockMarketServer is as shown below
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import SimpleStocks.*;
public class StockMarketServer {
public static void main(String[] args) throws Exception {
if(System.getSecurityManager() == null) {
System.setSecurityManager( new RMISecurityManager() );
StockMarketImpl myObject = new StockMarketImpl( "NASDAQ" );
System.out.println( "RMI StockMarketServer ready..." );
} i got the following error
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: SimpleStocks.StockMarketImpl_Stub
RMI StockMarketServer ready...Interface class, Interface implementation class and stub all reside in MyProjects\StockRMI\SimpleStocks directory
where as Server class(StockMarkerServer) is in MyProjects\StockRMI
even i place the stub in MyProjects\StockRMI directory i got the same error.
Can any one please save me out of this problemhurry!
Thank u First of all
I got it.. finally after 2 days
The error is in CLASSPATH only , i set it
Thanks once again -
Java.rmi.ServerException Problem
The exception that has occured is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Process00Impl_Stub
I have the interface, Client, Server and the Implementation java files
in the same machine.
11/29/2002 08:52p 282 Process00.class
11/29/2002 08:25p 221 Process00.java
11/29/2002 07:40p 215 Process00.java.bak
11/29/2002 08:56p 1,008 Process00Client.java
11/29/2002 08:55p 1,010 Process00Client.java.bak
11/29/2002 08:57p 451 Process00Impl.class
11/29/2002 08:57p 936 Process00Impl.java
11/29/2002 08:52p 934 Process00Impl.java.bak
11/29/2002 08:57p 2,153 Process00Impl_Skel.class
11/29/2002 08:57p 3,938 Process00Impl_Stub.class
11/29/2002 08:56p 995 Process00Server.class
11/29/2002 08:57p 645 Process00Server.java
11/29/2002 08:56p 643 Process00Server.java.bak
I also have the _Stub.class. I do not know why I get this error. If any
one have an idea, kindly share with me.
Thanks.Hi,
I had the same problem. In my machine, path was having jre1.1.7 before my jdk 1.4. So it was picking up from jre1.1.7.
Java was happy when I moved my jdk1.4 path to the beginning of the path variable.
Hope this helps you. -
ClassNotFoundException in EJB's and Threads (Classloader issue)
A very interesting bug has cropped up in WebLogic 6.1. When a J2EE
application packaged appropriately, a client application running in a
user-created Thread will always throw a ClassNotFoundException when
attempting to get back a user-created object from an EJB living on
another cluster. This error does not happen when the call is being made
from outside a Thread.
Sounds strange, I know, so I'll try to give everyone as much detail as
possible so they can avoid this bug, and so that the folks at BEA can
fix it.
* A java class running inside a clustered WL6.1 server is attempting to
reference an EJB on another clustered WL 6.1 server. Accessing the bean
is not a problem, the client class is able to obtain a remote reference
to the bean and make method calls on it. Calling a method causes the
following stack trace:
2002-01-11 10:36:57,331 [Thread-4] ERROR
wpni.app.mywp.display.DisplayJobs$JobsMonitor -
wpni.app.mywp.display.DisplayJobs$JobsMonitor.run: Error checking Jobs
status.
java.rmi.UnmarshalException: failed to unmarshal class
wpni.app.jobs.JobsData; nested exception is:
java.lang.ClassNotFoundException: wpni.app.jobs.JobsData: This
error could indicate that a component was deployed on a cluster member
but not other members of that cluster. Make sure that any component
deployed on a server that is part of a cluster is also deployed on all
other members of that cluster
java.lang.ClassNotFoundException: wpni.app.jobs.JobsData: This error
could indicate that a component was deployed on a cluster member but
not other members of that cluster. Make sure that any component deployed
on a server that is part of a cluster is also deployed on all other
members of that cluster
at
weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:146)
at
weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInputStream.java:211)
at
weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputStream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:906)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:107)
at
weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:115)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at
weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.java:230)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:254)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy140.getJobsData(Unknown Source)
at
wpni.app.mywp.display.DisplayJobs$JobsMonitor.run(DisplayJobs.java:48)
at java.lang.Thread.run(Thread.java:484)
* The class that is not found (JobsData) is definitely in the EAR file
on both the client cluster and the server cluster, and in the
appropriate location.
* When we attempted to run the code outside of a Thread, everything
worked perfectly, so it was definitely the Thread that was causing the
problem.
* Deploying the EJB on the client cluster did not do anything to solve
the problem.
* Adding the JobsData to the System CLASSPATH at the startup of the
WebLogic server DID solve the problem. But of course that defeats the
purpose of packaging everything in the EAR file.
So, the conclusion seems to be that when DisplayJobs$JobsMonitor kicked
off the Thread, the Thread should have been created in either the WAR's
classloader or the JAR's classloader (wouldn't matter, since the
JobsData class is in the JAR's classloader, which is a parent of the
WAR's classloader). But instead, the Thread is being created in the
System classloader, which can't find the JobsData class!
We believe that any Thread created by a class living within an EAR's
classloader should remain within that same classloader, and not migrate
to any other classloader, in order to avoid situations like this. We're
opening a case with BEA to attempt to get this resolved. In the
meantime, we recommend to developers that if they have to make
cross-cluster RMI calls from inside user-created Threads, that they only
attempt to receive primitive types or standard JDK objects. Otherwise,
you'll have to add the classes to the System CLASSPATH at startup of the
WebLogic instance.
Thanks,
Erin
* "[White House spokeperson Ari] Fleischer
* warned Democrats this morning against
* investigations into the Bush administration's
* dealings with Enron. 'The American people
* are tired of partisan witch hunts and endless
* investigations,' he said." [Ed.: Uh... ]
* www.washingtonpost.com/wp-dyn/articles/A25159-2002Jan10.html
* Erin Reid Myers, Chief Architect
* WashingtonPost.Newsweek Interactive
* [email protected]
* Work: (703) 469-3154
* Cell: (703) 725-3050
[att1.html]Things can go seriously wrong if your application uses user threads (violating
EJB spec programming restrictions and BEA recommendations).
I'm curious, does it work if you enable network classloading on the server
which invokes remote EJB (in config.xml -
<Server NetworkClassLoadingEnabled="true" ...
</Server>
Erin Reid Myers <[email protected]> wrote:
A very interesting bug has cropped up in WebLogic 6.1. When a J2EE
application packaged appropriately, a client application running in a
user-created Thread will always throw a ClassNotFoundException when
attempting to get back a user-created object from an EJB living on
another cluster. This error does not happen when the call is being made
from outside a Thread.
Sounds strange, I know, so I'll try to give everyone as much detail as
possible so they can avoid this bug, and so that the folks at BEA can
fix it.
* A java class running inside a clustered WL6.1 server is attempting to
reference an EJB on another clustered WL 6.1 server. Accessing the bean
is not a problem, the client class is able to obtain a remote reference
to the bean and make method calls on it. Calling a method causes the
following stack trace:
2002-01-11 10:36:57,331 [Thread-4] ERROR
wpni.app.mywp.display.DisplayJobs$JobsMonitor -
wpni.app.mywp.display.DisplayJobs$JobsMonitor.run: Error checking Jobs
status.
java.rmi.UnmarshalException: failed to unmarshal class
wpni.app.jobs.JobsData; nested exception is:
java.lang.ClassNotFoundException: wpni.app.jobs.JobsData: This
error could indicate that a component was deployed on a cluster member
but not other members of that cluster. Make sure that any component
deployed on a server that is part of a cluster is also deployed on all
other members of that cluster
java.lang.ClassNotFoundException: wpni.app.jobs.JobsData: This error
could indicate that a component was deployed on a cluster member but
not other members of that cluster. Make sure that any component deployed
on a server that is part of a cluster is also deployed on all other
members of that cluster
at
weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:146)
at
weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInputStream.java:211)
at
weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputStream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:906)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at
weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:107)
at
weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:115)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at
weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.java:230)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:254)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy140.getJobsData(Unknown Source)
at
wpni.app.mywp.display.DisplayJobs$JobsMonitor.run(DisplayJobs.java:48)
at java.lang.Thread.run(Thread.java:484)
* The class that is not found (JobsData) is definitely in the EAR file
on both the client cluster and the server cluster, and in the
appropriate location.
* When we attempted to run the code outside of a Thread, everything
worked perfectly, so it was definitely the Thread that was causing the
problem.
* Deploying the EJB on the client cluster did not do anything to solve
the problem.
* Adding the JobsData to the System CLASSPATH at the startup of the
WebLogic server DID solve the problem. But of course that defeats the
purpose of packaging everything in the EAR file.
So, the conclusion seems to be that when DisplayJobs$JobsMonitor kicked
off the Thread, the Thread should have been created in either the WAR's
classloader or the JAR's classloader (wouldn't matter, since the
JobsData class is in the JAR's classloader, which is a parent of the
WAR's classloader). But instead, the Thread is being created in the
System classloader, which can't find the JobsData class!
We believe that any Thread created by a class living within an EAR's
classloader should remain within that same classloader, and not migrate
to any other classloader, in order to avoid situations like this. We're
opening a case with BEA to attempt to get this resolved. In the
meantime, we recommend to developers that if they have to make
cross-cluster RMI calls from inside user-created Threads, that they only
attempt to receive primitive types or standard JDK objects. Otherwise,
you'll have to add the classes to the System CLASSPATH at startup of the
WebLogic instance.
Thanks,
Erin
* "[White House spokeperson Ari] Fleischer
* warned Democrats this morning against
* investigations into the Bush administration's
* dealings with Enron. 'The American people
* are tired of partisan witch hunts and endless
* investigations,' he said." [Ed.: Uh... ]
* www.washingtonpost.com/wp-dyn/articles/A25159-2002Jan10.html
* Erin Reid Myers, Chief Architect
* WashingtonPost.Newsweek Interactive
* [email protected]
* Work: (703) 469-3154
* Cell: (703) 725-3050
Dimitri -
Rmi with security manager not working in netbeans
Hello i'm trying to use rmi but get the error java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve) when i run it in netbeans. here is my code
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
try {
String name = "Compute";
Compute engine = new ComputeEngine();
Compute stub =
(Compute) UnicastRemoteObject.exportObject(engine, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(name, stub);
System.out.println("ComputeEngine bound");
} catch (Exception e) {
System.err.println("ComputeEngine exception:");
e.printStackTrace();
}It works if i don't have a security manager and it works with a security manager if i don't use netbeans to run it and use the command line. i need to use a secuirty manager because the client code is running in eclipse and it moans that there is no security manager if i run it without one
this is the error i get when running with no security manager
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: takenoteremote.Compute (no security manager: RMI class loader disabled)
Please helpI have sort of got it to work, i took out the security manager and used the code base parameter on the command line, and put my interface into a jar file. I can only get it to work though on the command line, if i run it in netbeans it doesn't find the class in the jar file it needs.
Any ideas? -
RMI Trouble - UnmarshalException
I had several classes thata had been working great under RMI until I made a smalla change
I change the package path of my classes adding a parent package and adding a level in the
directory path (from D:\Des\MicroApl to D:\Des\MicroAplsrc), so my directory tree change from:
D:\Des\MicroApl
transmision
modelo
controlador
vista
to:
D:\Des\MicroApl
jars
make
classes
docs
src
rut
transmision
modelo
controlador
vista
So I change the package statement in the classes adding the new level, for instance, from:
package modelo;
to:
package rut.modelo;
and i change my make files in order to compile the classes acordingly, from:
javac modelo\ModeloMaestro.java
to:
javac rut\modelo\ModeloMaestro.java
and from:
rmic modelo.ModeloMaestro
to:
rmic rut.modelo.ModeloMaestro
I also changed the path of my call from:
java -cp .\mimjdbc-2_2.jar;. modelo.ModeloMaestro
to:
java -cp D:\Des\MicroApl\jars\mimjdbc-2_2.jar;. rut.modelo.ModeloMaestro
Now, after compiling without any error, I get a big runtime error, as follows:
Excepcion Remota de servidor: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: rut.modelo.ModeloMaestro_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: rut.modelo.ModeloMaestro_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:352)
Does anyone knows whats going on?
I had not made any other change,
not at all
Juan
[email protected]I had a similar problem after connecting the internet using a modem
Win 98 coudln't restore the local TCP/IP after that
Maybe you are looking for
-
Itunes will not associate with my music folders on an external hard drive
I moved all of my music on both libraries for two separate Ipods onto an external hard drive. Now when I open Itunes neither one of the libraries comes up. I have tried holding down the shift and choosing a library but it does not open. I am beyond f
-
Once I begin to play a movie from my iPad to the TV using the HDMI adapter it will pause and lose sound every few minutes. I am using the video app and the movie plays fine if not connected. I have also checked to make sure that everything is connec
-
Hi, When we replicate the vendor from ECC to SUS system, thr PI. The ECC number is not assigned in the SUS system instead it generated some number . How to assign the same number as that of ECC in SUS. I know in standard it is not possible...But i n
-
Unable to access OBIEE Presentation services
Hi Everybody, I am obiee admin, i got complaint from some developers that there are unable to open Presentation services. Please help me ASAP
-
Can my macbook's Ram work on a minimac?
Hi I was wondering if the ram that came with my black macbook be used to upgrade a minimac? Thanks