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
Deskjet 1050 not compatible with HP301 but uses HP61Using HP301 or HP61 will depend on your region. Which country are you based in?  Finding and installing cartridges after moving to another country http://h30434.www3.hp.com/t5/Ink-Toner-Cartridge-Pr [More]
This is to create a new topic with regards to Safari, but with many windows and/or tabs open. Some have posted information in the previous topic, i.e.: safari slow - has anyone talked to someone at Apple? This post will be specifically about hangs an [More]
how do i connect a macbook pro to a verizon wireless network? Wi-Fi connection automatically assigns an IP address and indicates that the Mac won't be able to connect to the internet. Two other MacBook Pros connect to the network without any problems [More]
In writing a formal academic document that includes tables and or charts, it is best to have the the pages with charts in landscape. However, the rest of my work needs to be vertical orientation. How do I achieve this in Pages? In a Word document it [More]
Hi all After a 4 year abscence from Apples Mail program, I am back. I really like all of the apps, but I am having the same problems from 4 years ago and I really dont want to go back to Entourage. After 2 days of researching this PDF topic, I still [More]
Hi all- I'm new to using spry and xml, but not new to xhtml and layout, having said that. I'm trying to store file paths in my xml and parse that xml to repace <href> tags in an image map. For example (the actual cooridnates in the map are just made [More]
All, I am working on creating a schedule from multiple smaller schedules.  A few of these schedules had manual text formatting which I overwrote manually (selecting cells and changing text color).  Now when attempting to apply text styles to the crit [More]
I'm sure this will have been asked & probably answered before but i have done a search & found nothing on it. So I'll apologize now. Ok Ultrabeat patches or Ultrabeat presets. I know that Logic 8 already has an extensive library of presets for Ult [More]
I have been using Indesign CS6 on my government computer at work for over a year.  Yesterday I tried to launch it and it will not launch properly.  It basically becomes unresponsive and doesn't fully launch.  Or it completely launches but won't open [More]
Hi, I am starting Sql Loader from Forms 10g by using client_host(sqlldr.exe userid=..). The Sql Loader works fine, data is loaded to ORACLE tables but the application fails to go back to the Forms code and execute the rest. I have also tried to call [More]