• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unmarshalling Error while registering an object in RMIRegistery

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys ,
I am executing the code , in which i try to "Server.java" file which binds an object to the RMI registry , but when i run this file it give me following error.

Exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: bankrmi.Bank




Could anyone please help me out in resolving this issue.
 
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

please check this link
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks , but my problem is not solved yet .
 
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a class called Bank in a package bankrmi? According to the error the RMI registry can't find one of your classes.


Hunter
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i have .
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can post some more information? Like the directory structure you are using? I can't really help if I have nothing to go on but
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please find the attached screenshot for error and structure , do you something more ?
RMI_Error.png
[Thumbnail for RMI_Error.png]
RMI structure + error
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the definition of BankImpl?


Hunter
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the value of the bankname variable? it is supposed to be a url, something like





Hunter
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am passing it in the argument as 'Nordea' for the bank name .
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using "rmi:Nordea"
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the same error while try using rmi:Nordea.

While compiling the source code , i have noticed that i am getting an error .

Compiling 7 source files to C:\Users\Dell\Documents\NetBeansProjects\RMI_Example01\build\classes
Note: C:\Users\Dell\Documents\NetBeansProjects\RMI_Example01\src\bankrmi\BankImpl.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details
.

could it be the cause of error.
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No that just means you are using deprecated code somewhere in your program, it isn't as big of an issue as the ServerException. Do you have the Bank.class file in the bankrmi.classes.bankrmi folder?
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i guess ,please find the attached screenshot.
RMI_Error.png
[Thumbnail for RMI_Error.png]
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While i am generating the classes and stub s using the following command , in the command prompt.

javac -d classes -cp classes *.java
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need the .class files in the bankrmi folder as well.

This is an example directory structure from an example in the Core Java Vol. 2 Book:

server/
->WarehouseServer.class
->Warehouse.class
->WarehouseImpl.class

client/
->WarehouseClient.class
->Warehouse.class

Notice how the Warehouse.class file (in your case Bank.class) is in both folders

Hunter
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean that all the classes including the stubs needs to be in the "main" bankrmi folder , then i have tried it out , but it did not make any impact, maybe its not the reason of error.
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't mean to imply all the class files, just the Bank.class file. The JVM can't find bankrmi.Bank, that is what the ClassNotFoundException you got is referring to.

Hunter
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it prior , got same error.
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know for a fact that you need it in both folders, other than that I'm out of ideas..Sorry

Hunter
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hunter McMillen wrote:No that just means you are using deprecated code somewhere in your program, it isn't as big of an issue as the ServerException.


Not deprecated code, non-generic collection classes. In this case, the Hashtable and Enumeration.
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:

Hunter McMillen wrote:No that just means you are using deprecated code somewhere in your program, it isn't as big of an issue as the ServerException.


Not deprecated code, non-generic collection classes. In this case, the Hashtable and Enumeration.



Thanks, I didn't know that I thought it was for deprecated code.

Hunter
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think i have got the problem , when i extend the Interface with "java.rmi.remote" , its giving me the unmarshalling exception , but when i did not extend it with Remote, the "Server" works fine.
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the server extending java.rmi.Remote? Because the server isnt supposed to do that. The server has access to the real objects(non-remote)


Hunter
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's about time I move this thread to our Distributed Java forum. I should have done so days ago...
 
mohsin Rasheed
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we discuss that problem over the skype , it would be easier than to solve it.
 
The only cure for that is hours of television radiation. And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic