Sitemap

Amicuk Programming Answers

Not able to start the remote server - class not found exception

2015-10-11   Views:1

Advertisement

All, I am quite new to RMI programming, although i am an experienced java programmer. I am facing a problem in starting the remote server program which i wrote for RMI. I am getting class not found exception for "stub" class eventhough the class

All,
I am quite new to RMI programming, although i am an experienced java programmer. I am facing a problem in starting the remote server program which i wrote for RMI. I am getting class not found exception for "stub" class eventhough the class is in the classpath.
Following is the error console:
cmd> java -classpath "D:\Eclipse_WorkSpaces\WS2\RMITests\classes" MyServerImplementation
GetNames error: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImplementation_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImplementation_Stub
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(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at MyServerImplementation.main(MyServerImplementation.java:21)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImplementation_Stub
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: MyServerImplementation_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:247)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:434)
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:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
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 morePLEASE ADVISE HOW TO RESOLVE THIS...
Following are my classes:
MyRemoteInterface.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface MyRemoteInterface extends Remote {
public String[] getNames() throws RemoteException;
public class MyServerImplementation extends UnicastRemoteObject implements
MyRemoteInterface {
public MyServerImplementation()throws RemoteException{
super();
public String[] getNames() throws RemoteException{
return new String[]{"Name1","Name2","Name3","Name4"};
public static void main(String args[]) {
try {
// Create an object of the HelloWorldServer class.
MyRemoteInterface obj = new MyServerImplementation();
// Bind this object instance to the name "HelloServer".
Naming.rebind("rmi://localhost:1985/GetNames", obj);
System.out.println("GetNames bound in registry");
catch (Exception e) {
System.out.println("GetNames error: " + e.getMessage());
e.printStackTrace();
public class MyRMIClient {
[email protected] args*
public static void main(String[] args) {
try {
MyRemoteInterface remObj = (MyRemoteInterface) Naming.lookup("rmi://localhost:1985/GetNames");
System.out.println("Names are "+remObj.getNames());
catch(Exception e) {
System.out.println("Problem encountered accessing remote object "+e);
}

The replay answer
Advertisement
That's a remote exception coming from the registry. You need to learn to recognize remote exceptions and their source, it's a mjaor source of confusion in RMI.
In this case it's the registry that can't find the stub class.
The stub class needs to be in the CLASSPATH of (i) the Registry and (ii) the client as well. Ditto the remote interface; ditto any application classes it refers to, and so on until closure.
The easiest way to achieve (i) is to start it in the server's JVM, with LocateRegistry.createRegistry().

Go to See the other 3 answers

Error while executing script for sharepoint online (office 365) - the remote server returned an error: (503) server unavailable

Category:DefaultRelease time:2015-10-11Views:130

error while executing script for sharepoint online (office 365) - the remote server returned an error: (503) server unavailable. I am creating many site collections reading records from sharepoint list using powershell in sharepoint online tenant (of[More]

Log on to remote server and start database -error while installing CI in HA

Category:DefaultRelease time:2015-10-11Views:130

Hello All, We are installing ECC 6.0 with High Availability using HP-UX. We have completed installation in ASCS and Database Instance. Now when were trying to install in Central Instance, we encountered an error at Start Instance which informed us to[More]

How to set up local server to use a remote server for login authentication?

Category:DefaultRelease time:2015-10-11Views:130

Thank you in advance for any help you can offer. We are trying to set up a "sub-network" (dont' know if this is the right terminology) using a 10.4 Server OS, to manage a set of clients... the trick is that the client login/home directory inform[More]

Application not working after deployment in remote server

Category:DefaultRelease time:2015-10-11Views:130

I have a standard web application working in my localhost. But when I deploy the same in a remote server it gives the following exception. This happens for all the jsp:useBean. why is the container not able to fund the Beans. The Tomcat is installed[More]

When saving file to remote server it saves to wrong site

Category:DefaultRelease time:2015-10-11Views:130

I'm frustrated try to save a file to the remote server. I connect to the server OK. Then I open an html document, make my changes and save it. But instead of saving it where the file came from it connects to a different on of my sites. Ack!! Even whe[More]

JSP back-end interface to Remote server. Please help the newbie

Category:DefaultRelease time:2015-10-11Views:130

Could someone comment on pros and cons of the JSP back-end interfaces to the remote server/programs using.. (1) Socket Interface between JSP and Remote Server. One socket for one JSP session. JSP to create and delete the socket when done. (2) RMI bet[More]

Odbc.ini entry on local unix server to connect to a T10 on remote server

Category:DefaultRelease time:2015-10-11Views:130

I am trying to setup an entry in the ODBC.INI file on local unix server that has T10 client installed. I want to connect to a T10 datastore on a different server using this ODBC entry (client/server connection for a Informatica tool) Could some one t[More]

DW Procedures to connect to MS ACCESS database located on remote server

Category:DefaultRelease time:2015-10-11Views:130

I am confused about the procedures within Dreamweaver CS3 to connect to a MS ACCESS database on a remoter server. I am working through a tutorial book, "Dreamweaver 8 with ASP, Cold Fusion and PHP Training from the Source", but the instructions[More]

HOw to delete files from remote server?

Category:DefaultRelease time:2015-10-11Views:130

Hi, I want to delete files from a directory on remote server. I use the following command to delete on current server: find $srcdir -mtime +90 -name "COR*.txt" -exec rm -f {} \; Now, how can I delete files from remote server ? Thanks! YoginiSome[More]

Problem with display of files in remote server

Category:DefaultRelease time:2015-10-11Views:130

hi, i am trying to display to the files on a remote server using JTree. i am able to display local files and directories using JTree but i don't know how to display remote files. can anyone explain how to do it? Thank you, npailahi, i have exactly th[More]

I have an Ipad 2 and here is what I am trying to accomplish.  On my laptop I connect to a remote desktop connection to access a shared program we use for reporting.  How do I set up my Ipad to access this remote server?  Thanks for the help.

Category:DefaultRelease time:2015-10-11Views:130

I have an Ipad 2 and here is what I am trying to accomplish.  On my laptop I connect to a remote desktop connection to access a shared program we use for reporting.  How do I set up my Ipad to access this remote server?  Thanks for the help.Close ...[More]

Hot
This only happens when I try to read a reply to a post using my iPhone. I get the notification that there has been a reply to a thread via a email in my iPhone. I tap on the libk to take me to the thread and when it opens the window, I get a message [More]
Hi, I have setup a Lync server 2013 standard Front end on windows server 2012 R2 and also installed update for Mobility service and enabled it. It seems everything works perfect but... When I call by number in android phones and iphones, I do not hea [More]
WE FOLLWED INSTRUCTIONS TO UPDATE THE IPAD USING NEW COMPUTER.  WE HAVE DONE A BACKUP AND RESTORE AND CAN SEE THE APPS ON ITUNES FROM THE MAC BUT NOT FROM IPAD.  WE NEED HELP IN SYNCING THE IPAD NOW WITH THE MAC TO RESTORE THE APPS.If you are using i [More]
File is cmyk format..spot channel color is cmyk .such as an spot channel color is c100m50y20k5 how get spot channels color data use javascript? c=? m=? y=? k=? howv to get spot channel length n(don't cmyk channel) use javascript?  such as file cmyk + [More]
Mavens, In a ~230 page InDesign CC Book (9 INDD files), on about ~35 pages, there is a small text block with the word "NOTES." Currently, the NOTES text block is in the Middle-Center of the page. I would like to find a way for InDesign to move a [More]
Okay so I followed this video tutorial to the T.  http://www.gotoandlearn.com/play.php?id=123 One thing the Lee did not mention in this tutorial is that when you download the USB drivers from the Android SDK you still have to install them to the devi [More]
Hi experts, I have created a new movement type 702 (a copy of 602) for return delivery from customer. When I create delivery I did not face any issue. However while doing post goods issue, I get error "Goods Movement not possible with mvmt type 702.& [More]
Hello Frnsz, Can any one help to resolve the following error :) Got this error after deploying ear file into OC4J server. 2008-06-04 14:57:58.551 WARNING J2EE JSP-0027 Errors parsing file:/C:/Program Files/Java/oc4j/j2ee/home/applications/MyEarProjec [More]
hello guys i have a query in which i need to check that the last statment which oracle run is success or failure. i have sproc like this Declare BEGIN myproc; (now based on the success of this i need to do) UPDATEso i need to varify after that call . [More]
Hi, I want to manually enter a account in asset PO. this account is different with deafult account deciding by asset class. How to do? I try to enter it. but it's unblank. Regards HenryHI you can change the field status of field G/L account from disp [More]