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
hi all In the return process when iam doing the delivery with reference to sales order number delivery quantity is not picking up . can any one help me on this issue Regards sridharHi The returns process is create a Returns sales order>>>>> [More]
Hello, We loaded supplier(LSUPPLIER) from ECC to SPM. The data got loaded to PSA and info objects. But when I release the supplier load, the process chain is running for last 7 hours. We had same issue in QA where it ran for almot 2 days and even aft [More]
Hello All, I have a strange issue that I hope someone has seen before. (Exchange 2003) I have one user that does not receive mail to her outlook or OWA box if her address is in the To: field.  If her address is in the CC or BCC field she receives the [More]
Hi , I have used the NODIM data function in my formula and now the report is not displaying the formula column in report in first screen. I have to select the filter value from structure. I have already made the formula as Always show , still its not [More]
Hello, I am using 11.1.1.4, I am having a requirement to display all the components on my page read only when first time page loaded, By clicking on 'Edit' button I have to make all components in editable. I am using Transient View object to render v [More]
Hi All Thanks in advance, have searched the forums and can't seem to find an answer. I work in a small office using the following 3 Mac's all on a wired network 1. PowerPC G5 - OS 10.4.11 2. Intel G5 - OS 10.4.11 3. G4 - OS 10.4.11 We have an Epson R [More]
How do you put album art on if i didnt buy the song from itunes? i tried the drag and drop thing but it only shows up on my ipod for about ten of them. Please help.i tried the drag and drop thing but it only shows up on my ipod for about ten of them. [More]
Hello !! Please I need some help. I have to update the Street field in ADRC table. I have this list. Where I can put a Flag and an Update to do it. Im really newbie.  Im doing it in IDES, to test it first. Help ! REPORT  Z_LIST_ADRC      LINE-SIZE 19 [More]
How can I test what version of Acrobat reader is installed on my users computers. I have a rather large user base and need a link or something that sends me the version installed.Query for all the GUIDs: 20   Identifying Existing Installs - Enterpris [More]
We are trying to identify what is causing segmentation fault and particularly how to troubleshoot it? The following exception is thrown on our server when under stress, which kills all running java processes. # SIGSEGV (0xb) at pc=0x0000000000000038, [More]