Question

RMI exception

Asked by: cofactor



Q1:


when i tried to run the RMI server i got exception


D:\RMI>java -classpath  .;D:\RMI  HelloServerImpl
Creating server Object
Error RemoteException occurred in server thread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
        java.lang.ClassNotFoundException: HelloServerImpl_Stub


i dont know  why my RMI server did not started. i read in the tutorial its a security problem. i need to run with -Djava command and java security policy file etc etc. is that true ?


please tell me how do i run my RMI server . i am exhausted and failed to run it after reading the tutorials. i have become confused.


please tell me , the exact command to run the RMI server from my command prompt.


Q2: can i run the RMI client from JSP ?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-10-20 at 00:54:11ID21601387
Tags

rmi

,

exception

,

helloserverimpl_stub

Topics

Java Programming Language

,

Java Standard Edition

Participating Experts
2
Points
60
Comments
30

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Stub not found - RMI
    Hi, I was woundering if anybody can help me. I've compiled my RMI server. And I generated the Stub and Skel. And I ran the rmiregistry. But when I run my program this error occurs: java.rmi.UnexpectedException: Unexpected exception; nested exception is: java.lang.Cla...
  2. RMI Exception
    I'm getting an UnMarshallException while i'm running the RMI Server. It's a simple code i don't know why is it come. I'm having both client & server on the same machine. public interface server extends Remote{ public void getvalue()throws RemoteException; } serverImpl...
  3. RMI Server Exception
    When I try to execute the RMI server file I am getting the following error. What could be the problem? java.rmi.ServerException: Server RemoteException; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.Cl...
  4. RMI Stub copying in the client side
    Hello, I am writing a cimple application in RMI. How can I get the client stubs in the client system. do we need to copy the stubs on the client machine explictly. If i am having the client and server in the same machine then i am explictly copying the stubs into the client...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: cofactorPosted on 2005-10-20 at 02:13:39ID: 15122741

anbody knows RMI here ? i just can not start my RMI server . i am getting exception. is that because of security problem ?   how do i run my RMI server then ?

i saw the Sun RMI tutorial ...but not able to run my RMI server.

please tell me  the exact run command to run he RMI server.

 

by: mayankeaglePosted on 2005-10-20 at 05:51:28ID: 15123764

You have not generated stubs for the server class. You need to do:

rmic fullClassName

Then start the rmiregistry service. And then try to start your server application.

>> can i run the RMI client from JSP ?

You mean a JSP talking to the server using RMI? That should be possible.

 

by: mayankeaglePosted on 2005-10-20 at 05:53:12ID: 15123778

http://www.javaalmanac.com/egs/java.rmi/DefineRemote.html

Have a look at the "related examples" as well.

 

by: InNoCenT_Ch1ldPosted on 2005-10-20 at 17:57:30ID: 15129700

you need to create a stub file out of the class that extends Remote. then, you need to make this stub file available for your client app.

Eg:
if the stub file is located at
remote.HelloServerImpl_stub.class
for the server side..

it should be placed under
remote/
at the client side as well. (the same package: remote)


like this:

SERVER
---------
Main.class
remote/HelloServerImpl.class
remote/HelloServerImpl_stub.class


CLIENT
--------
Main.class
remote/HelloServerImpl_stub.class

 

by: InNoCenT_Ch1ldPosted on 2005-10-20 at 17:59:57ID: 15129710

so each time u create the stub file, you need to copy it over to the client as well.

 

by: cofactorPosted on 2005-10-24 at 00:42:54ID: 15144622

hi,
sorry for late reply.
i have done it myself.
i did not check mail so i could not reply .

i took the help of the "Complete Reference"by  herb schield . i followed all the steps there and it started working immediately. the steps were very easy to understand and comfortable.

i want to close this question

 

by: mayankeaglePosted on 2005-10-24 at 00:46:26ID: 15144629

What exactly was the problem? I mean - what were you missing last time? As far as I know, you had not generated stubs.

 

by: cofactorPosted on 2005-10-24 at 01:02:53ID: 15144675

>As far as I know, you had not generated stubs

yes. correct.

i opened my books and found all the steps information and followed steps.
anyway,

 will you please tell me, what are the files need to copy to the client. i did it blindly. i dont understood it.
i copied...a)_stub file (b) client class file  and (c) serverinterface

if i use more additional classes(may be beans, ) should i copy that too ?

what to copy and waht not to copy is a dilema till now.

of course, my application is running but i am not cool. i have some hesitation about what to copy and what not to copy to the client.



and one more question :

after rmic fullclassname...i got a stub and a skel file....wha are these guys ?



thanks for the response.
please respond.


 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 01:06:59ID: 15144693

you just need to copy the interface that you extends Remote, and the stub file.
that's it.

I'm sure you have an interface that look like this:

public interface XXX extend Remote{
    public void dosth() throws RemoteException;
}

right?

just copy this over to the client side along with the stub file.

 

by: mayankeaglePosted on 2005-10-24 at 01:13:21ID: 15144717

You need the stub for the actual RMI to happen between the client and the server (at the client-side, you don't have any definition for what the server should do and how the client should connect to the server - who manages this?).

>> yes. correct.

Then your Q was answered by mayankeagle and InNoCenT_Ch1ld, so you should split.

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 01:14:05ID: 15144719

>>after rmic fullclassname...i got a stub and a skel file....wha are these guys ?
RMI uses a remote object's stub class as a proxy in clients so that clients can communicate with a particular remote object.
The client communicate with the server through stub file(s).

btw, which version of Jdk you are using?
if you use the latest version of jdk, you won't get a skel file anymore. ;-)

 

by: cofactorPosted on 2005-10-24 at 01:57:18ID: 15144878


>if you use the latest version of jdk, you won't get a skel file anymore
but i am getting  skel !! ....my java version is 1.4.


i am also surprised why other tutorials  talks too much about security !!...there was no security, no java  policy ...nothing involved. does it mean those tutorials are wrong ?


yes. thanks...i am going to split the points

 

by: mayankeaglePosted on 2005-10-24 at 02:09:31ID: 15144919

>> my java version is 1.4.

1.4 will still give the skel. 1.5 will not give them.

>> does it mean those tutorials are wrong ?

No. Security is the next step. It comes after you have done the basics.

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 02:11:41ID: 15144924

>>but i am getting  skel !! ....my java version is 1.4.
ok, well, i'm not sure since which version skel is no longer being created. ;-)
i'm using 1.5

security might be an issue when you develop some commercial application. but if you are learning, you can put that a side and concentrate on the RMI structure.

You will discover that RMI is fun! ;-)

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 02:12:13ID: 15144928

mayankeagle is fast....

 

by: mayankeaglePosted on 2005-10-24 at 02:20:24ID: 15144964

:)

 

by: cofactorPosted on 2005-10-24 at 02:49:44ID: 15145073

right now, i  copy the files  to the client machine. and then i invoke remote method and the remote method works.
everything is fine.

 >Security is the next step
>security might be an issue when you develop some commercial application
i am confused.

my  application is running on 1099 port. do u meant to change port to 2000 ? is that u mean by security ?

i did not mean that . i mean sometimes i have noticed to run the RMI  application
with -Djava command and java policy . so, its a peculiar  things to me, i tried to use -Djava command and java policy file but that did not worked.


However,

i) even  if i use so called "Security" do i have to copy files ? or copying files is always ?
2)can u tell how do i use this security ?

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 02:59:11ID: 15145099

>>my  application is running on 1099 port. do u meant to change port to 2000 ? is that u mean by security ?
no.

about security, follow this link ( a bit outdated i guess, but provide the info)

http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 03:05:03ID: 15145118

www.purpletech.com/talks/RMI.ppt - mentioned bout stub-skel, security..

 

by: mayankeaglePosted on 2005-10-24 at 03:05:46ID: 15145120

You need permission to connect to the particular ports, etc - those aspects are covered in security. Those topics get more complicated when you are connecting to remote servers behind fire-walls, etc

 

by: cofactorPosted on 2005-10-24 at 04:42:14ID: 15145662

hi, i need some time to read those tutorials. both of you have helped me a lot.  i'll come back

 

by: cofactorPosted on 2005-10-24 at 21:24:49ID: 15151953

hi,i read in PPT provided by you,
this line...
"Registry VM needs to be able to find stub file(s).You must set the CLASSPATH to include the directory containing the stub file..."

very strange . you know, i did not do it. but still my application running !!...surprising.
my RMI class file is in c:\RMICODE\packages\classes


and i started the rmiregistry from c:\start rmiregistry


the application running perfectly !!.

you see i did not use any -classpath option while running rmiregistry.

is that statement in the PPT wrong ?

 

by: cofactorPosted on 2005-10-24 at 21:36:20ID: 15151992

the PPT says...

Creating an RMI Client
=======================
Install a Security Manager




System.setSecurityManager(
      new RMISecurityManager());
Adder a = (Adder) Naming.lookup("adder");

int sum = a.add(2,2);
System.out.println("2+2=" + sum);


just this much !!  so, if i want the security then i should add this ..

System.setSecurityManager(
      new RMISecurityManager());


to my client code. rest is same . is that all ?



but in another tutorial(http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html)...they are talking about -Djava & policy file and so many things.


i am confused what to do and what not to do.







can you please tell me the steps ?

here i am starting the steps.


STEP1 : i should add System.setSecurityManager (new SecurityManager()); in my client code. is this correct ?


STEP2: How do i compile now ? whats the command ? my RMI codes are in e:\rmicode\com.web packages

STEP3: How do i run my client now ?


please provide a clear example otherwise its going to be difficult to understand.

i appreciate your help.

Thank you

 

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 22:00:52ID: 15152074

>> hi,i read in PPT provided by you,
>>this line...
>>"Registry VM needs to be able to find stub file(s).You must set the CLASSPATH to include the directory containing the >>stub file..."

>>very strange . you know, i did not do it. but still my application running !!...surprising.
>>my RMI class file is in c:\RMICODE\packages\classes
you might have done that without you realize it ;-)
it is actually the same thing with setting the classpath for your java class so that your jvm can find them.
if you are using IDE, the IDE might have set the classpath for your java classes for you.


>>is that statement in the PPT wrong ?
no. you dont need to specify the classpath when u are running registry. you only need to specified it when you run your java code.

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 22:06:31ID: 15152090

The default security manager uses a policy that is defined in a collection of policy files. For the locations of these files see the documentation of the policytool program. If one wishes to grant additional permissions, then one can specify them in a policy file and then request that they be loaded using options such as the following:

java -Djava.security.manager -Djava.security.policy=policy-file MyClass

 

by: InNoCenT_Ch1ldPosted on 2005-10-24 at 22:08:04ID: 15152098

so,
System.setSecurityManager (new SecurityManager());
should be enough.

 

by: mayankeaglePosted on 2005-10-25 at 00:26:22ID: 15152535

Here's a brush-up on classpath: http://www.mindprod.com/jgloss/classpath.html

 

by: cofactorPosted on 2005-10-25 at 21:46:59ID: 15159906

>For the locations of these files see the documentation of the policytool >program.

where this policy file resides in j2sdk 1.4 ? is it inside "lib" folder ? is it inside "bin" folder  or where is the location ?...i want to see those policy files. i am very much curious about the content of those files.


>java -Djava.security.manager -Djava.security.policy=policy-file MyClass

who will run this command ?

only client ?

only server ?

server and client both ?

 

by: cofactorPosted on 2005-11-09 at 21:15:19ID: 15262968

excellent ratings to you

 

by: InNoCenT_Ch1ldPosted on 2005-11-09 at 21:58:33ID: 15263079

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...