• Post Reply Bookmark Topic Watch Topic
  • New Topic

Weird Problem !

 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm facing lot of problems with the Java Security policy. I just cant seem to over ride it ! I want to run this simple server program using RMI.


At first I used to get the error :

and I saved this file in my server programs folder and ran the server program with the following command
java -Djava.security.policy=java.policy -Djava.rmi.server.codebase=file:///c:\rmi\server\ SideAServer
Now I get this strange exception:
java.rmi.ServerException: Server RemoteException; nested exception is:java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:java.lang.ClassNotFoundException: SideAMain_Stub


It says that the "SideAMain_Stub.class" cannot be found but the class file is present both in the server folder and the client folder.

But the funny thing is, the same program works perfectly in my friends PC !!!

Pls Help !! Any sorta help wud be greatly appreciated.

Thanx in advance
[ September 21, 2005: Message edited by: Agent Dsypher ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am betting that this will work if you put the class in a package. The problem is that JVMs look up classes in the "default" package in the "current" directory - this frequently causes mysterious failures to find a class file.
Bill
 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:
I am betting that this will work if you put the class in a package. The problem is that JVMs look up classes in the "default" package in the "current" directory - this frequently causes mysterious failures to find a class file.
Bill


Thanx 4 da response William.

I created a package called "MyClasses" in the "current" directory and recompiled my source files but I could'nt compile using the "rmic" compiler. When I compile my implementation class using rmic, I get the following error:
F:/Server/MyClasses>rmic ChatMain
error: File .\ChatMain.class does not contain type ChatMain as expected, but type MyClasses.ChatMain. Please remove the file, or make sure it appears in the correct subdirectory of the class path.
error: Class ChatMain not found.

2 errors

[ September 22, 2005: Message edited by: Agent Dsypher ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

F:/Server/MyClasses>cd ..

F:/Server>rmic MyClasses.ChatMain
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Agent Dsypher" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.

You can change your user name here.

Thanks! and welcome to the JavaRanch!
 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanx guys !!! I pin pointed the problem. I have oracle installed in my machine and that was the main culprit all along. When I run the rmiregistry from the command prompt it runs the rmiregistry.exe in my oracle folder instead of the one in my java's bin folder. I had set the path under Environment variables but it never executes the latter only the former. Any idea's ???

Thanx again
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run the rmiregistry from the command prompt it runs the rmiregistry.exe in my oracle folder instead of the one in my java's bin folder.

That sounds like your environment PATH provides the oracle folder first. You could execute rmiregistry.exe directly from the java \bin or execute it using the full path to the bin folder in the command line.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!