Skupiny Google už nepodporují nová předplatná ani příspěvky Usenet. Historický obsah lze zobrazit stále.

RMI problem

15 zobrazení
Přeskočit na první nepřečtenou zprávu

Slavko Vorkapitch

nepřečteno,
26. 2. 2002 20:25:5126.02.02
komu:
Hi - I am trying to get a simple RMI example (3-14) going from chap 3
'Distributed Java' by Jim Farley (maybe I should ask him ?)-

On line 21 where he names the remote program "TheSolver", I keep
getting
an exception :

1) If I leave the string name as "TheSolver" I get a
java.net.SocketPermission 127.0.0.1:1099 connect,resolve) exception

or 2) if I try String name = "rmi://vail/The Solver";
where "vail" is the remote server on my lan. I get a
Caught an exception looking up Solver.java.net.MalformedURLException:
invalid UR
L string: rmi://vail/The Solver

Everyting on the server seems as should be. Can somebody clue me in as
to what a properly formed URL should look like for a RMI registered
service named "TheSolver" on a machine named "vail" ??

Thanks in advance,
El Squid

Tom Cole

nepřečteno,
26. 2. 2002 21:42:5726.02.02
komu:
In <e0a5b916.02022...@posting.google.com>
//ip_address:port/remote_name

//vail:1099/TheSolver

Ingo Pakleppa

nepřečteno,
27. 2. 2002 6:02:4427.02.02
komu:
On 26 Feb 2002 17:25:51 -0800, el_squ...@yahoo.com (Slavko
Vorkapitch) wrote:

>Hi - I am trying to get a simple RMI example (3-14) going from chap 3
>'Distributed Java' by Jim Farley (maybe I should ask him ?)-
>
>On line 21 where he names the remote program "TheSolver", I keep
>getting
>an exception :
>
>1) If I leave the string name as "TheSolver" I get a
>java.net.SocketPermission 127.0.0.1:1099 connect,resolve) exception
>
>or 2) if I try String name = "rmi://vail/The Solver";
>where "vail" is the remote server on my lan. I get a
>Caught an exception looking up Solver.java.net.MalformedURLException:
>invalid UR
>L string: rmi://vail/The Solver

Get rid of the space.

2147483647 Alexander Derazhne

nepřečteno,
27. 2. 2002 6:52:4127.02.02
komu:
Hello!

Slavko Vorkapitch wrote in message ...

>java.net.SocketPermission 127.0.0.1:1099 connect,resolve) exception

If You using Java2 - it has little different security model. Create
plain text file <file_name> and put following into it:
========
grant {
permission java.security.AllPermission;
};
========
Then start your server with keys:
-Djava.security.manager -Djava.security.policy=<file_name>

The value for file above is VERY bad. It turn off any security. Use it
for local testing only and never use it in public servers. Learn more about
java security and modify this file to give exact required permissions to
exact code. You will also know how to avoid using special keys in command
line!

Alexander Derazhne

Slavko Vorkapitch

nepřečteno,
27. 2. 2002 15:10:0027.02.02
komu:
Hi - I am still getting an exception - even when I use the following policy file
when starting the server on my Linux box:

grant {
permission java.security.AllPermission;
};

grant{
permission java.net.SocketPermission"*:1024-65535","accept,resolve,connect";
};

The last line is theoretically superfluous..

C:\Java>java dcj.rmi.RMISolverClient
Looking up rmi://vail/TheSolver...
Caught an exception looking up Solver.java.security.AccessControlException: acce
ss denied (java.net.SocketPermission vail resolve)

Looks to me like the client program is contacting the registry on my Linux box
but I still have a problem there..

El Squid

"2147483647 Alexander Derazhne" <sa...@antecltd.kiev.ua> wrote in message news:<a5ih9i$oqf$1...@alice.infopulse.kiev.ua>...

2147483647 Alexander Derazhne

nepřečteno,
28. 2. 2002 6:56:2728.02.02
komu:
Hello!

Slavko Vorkapitch wrote in message ...

>Hi - I am still getting an exception - even when I use the following policy


file
>when starting the server on my Linux box:
>
>grant {
> permission java.security.AllPermission;
>};
>
>grant{
> permission
java.net.SocketPermission"*:1024-65535","accept,resolve,connect";
>};
>
>The last line is theoretically superfluous..
>
>C:\Java>java dcj.rmi.RMISolverClient
>Looking up rmi://vail/TheSolver...
>Caught an exception looking up Solver.java.security.AccessControlException:
acce
>ss denied (java.net.SocketPermission vail resolve)
>
>Looks to me like the client program is contacting the registry on my Linux
box
>but I still have a problem there..

Now I understand. You successfuly bind server, but client application
can't invoke Naming.lookup(). Have You the following at the begin of main():
System.setSecurityManager(new java.rmi.RMISecurityManager());
?

Alexander Derazhne


Antonio Monetti

nepřečteno,
28. 2. 2002 11:58:0828.02.02
komu:
I have modified a class that extends UnicastRemoteObject class adding
new methods and modifying existing methods on server side and I have
generated a new stub class. If I try to connect to a server with a
client that contains an old stub class this ServerException appears:

java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
java.rmi.UnmarshalException: invalid method hash
java.rmi.UnmarshalException: invalid method hash
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
....

Is it possible to modify a class maintaining backward compatibility for
the generated stub classes? Thanks

Antonio

Slavko Vorkapitch

nepřečteno,
28. 2. 2002 13:08:1028.02.02
komu:
On the client yes, on the server no.

El Squid

"2147483647 Alexander Derazhne" <sa...@antecltd.kiev.ua> wrote in message news:<a5l5sn$hth$1...@alice.infopulse.kiev.ua>...

Esmond Pitt

nepřečteno,
28. 2. 2002 22:34:5428.02.02
komu:
Antonio Monetti wrote:
> Is it possible to modify a class maintaining backward compatibility for
> the generated stub classes? Thanks

Not if you modify the remote interface, you get 'invalid method hash'.
You should add another remote interface, or use
versioning-by-deriviation:

interface Version1 extends Remote {...}
interface Version2 extends Version1 {...}

class X extends UnicastRemoteObject implements Version1, Version2, ...

That way clients who only know about Version1 will still work.

EJP

2147483647 Alexander Derazhne

nepřečteno,
1. 3. 2002 4:32:0801.03.02
komu:
Hello!

Slavko Vorkapitch wrote in message ...

>On the client yes, on the server no.

It's strange. May be the root pf problem is in the Linux security (my
server works on WinNT/2K without any problem) ?

Alexander Derazhne

Slavko Vorkapitch

nepřečteno,
1. 3. 2002 12:18:3901.03.02
komu:
Hi - the solution was to specify a policy file when starting up the
client as well as the server. Funny thing I was able to correctly
execute both client and server on Win2000 by just using the policy
file specification with the client but Linux required both the policy
file specification on the server and on the Win2000 client... Strange.

Thanks everybody,
El Squid

"2147483647 Alexander Derazhne" <sa...@antecltd.kiev.ua> wrote in message news:<a5nhq7$16n$1...@alice.infopulse.kiev.ua>...

Phil Earnhardt

nepřečteno,
2. 3. 2002 11:11:3702.03.02
komu:
On 1 Mar 2002 09:18:39 -0800, el_squ...@yahoo.com (Slavko
Vorkapitch) wrote:

>Hi - the solution was to specify a policy file when starting up the
>client as well as the server. Funny thing I was able to correctly
>execute both client and server on Win2000 by just using the policy
>file specification with the client but Linux required both the policy
>file specification on the server and on the Win2000 client... Strange.

Not necessarily strange.

The security policy is needed when you're loading classes over the
network. Depending on how you set up your test case on a single
machine, you may be loading some classes from the network, or you may
simply be loading them from your classpath.

If you are running the client and the server on the same machine, you
must be very careful to ensure that the client's environment is what a
client would see on a remote machine. You must have a classpath for
the client side, and a classspath for the server side.

The O'Reilley text "Java RMI" covers deployment issues in detail. I
highly recommend getting a copy and reading through the pertinent
chapters.

--phil

Paul Roebuck

nepřečteno,
2. 3. 2002 15:19:5302.03.02
komu:
In article <7bu18u4se19luruoi...@4ax.com>,
Phil Earnhardt <p...@dim.com> wrote:

> On 1 Mar 2002 09:18:39 -0800, el_squ...@yahoo.com (Slavko
> Vorkapitch) wrote:
>
> If you are running the client and the server on the same machine, you
> must be very careful to ensure that the client's environment is what a
> client would see on a remote machine. You must have a classpath for
> the client side, and a classspath for the server side.
>

What I have read says to unset the CLASSPATH for the RMI Registry,
and set both java.rmi.server.codebase and java.rmi.server.hostname
for the server.

Phil Earnhardt

nepřečteno,
1. 3. 2002 12:36:2801.03.02
komu:
On 1 Mar 2002 09:18:39 -0800, el_squ...@yahoo.com (Slavko
Vorkapitch) wrote:

>Hi - the solution was to specify a policy file when starting up the
>client as well as the server. Funny thing I was able to correctly
>execute both client and server on Win2000 by just using the policy
>file specification with the client but Linux required both the policy
>file specification on the server and on the Win2000 client... Strange.

Not necessarily strange.

The security policy is needed when you're loading classes over the
network. Depending on how you set up your test case on a single
machine, you may be loading some classes from the network, or you may
simply be loading them from your classpath.

If you are running the client and the server on the same machine, you


must be very careful to ensure that the client's environment is what a
client would see on a remote machine. You must have a classpath for
the client side, and a classspath for the server side.

The O'Reilley text "Java RMI" covers deployment issues in detail. I

Phil Earnhardt

nepřečteno,
3. 3. 2002 14:55:3603.03.02
komu:
On Sat, 02 Mar 2002 20:19:53 GMT, Paul Roebuck
<roe...@mdanderson.org.invalid> wrote:

>> If you are running the client and the server on the same machine, you
>> must be very careful to ensure that the client's environment is what a
>> client would see on a remote machine. You must have a classpath for
>> the client side, and a classspath for the server side.
>
>What I have read says to unset the CLASSPATH for the RMI Registry,
>and set both java.rmi.server.codebase and java.rmi.server.hostname
>for the server.

If you have an issue with deployment, I'd recommend reading the
pertinent chapter from "Java RMI".

--phil

0 nových zpráv