RMI Registry Issue: rmiregistry may cause unintended exceptions when linking to the code base using the "file:" URL scheme

Please see the β€œRMI Registry Error” section of this article for background on Java Update 1.6.0_29.

If I understand correctly (I'm German), the update introduces an error in rmiregistry, which does not work with the file: code template in the code base.

those. The following will not work with 1.6.0_29:

-Djava.rmi.server.codebase="file:myproject/bin/ ..." 

We are currently using the code availability function with the syntax file :. Does anyone know a workaround to do this job?

Note: No, we do not want to start the local web server or ftp server.

Update:

In Naming.bind, this is an exception:

 java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: access to class loader denied at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:400) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:248) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) 
+2
source share
8 answers

I had the same problem and I can confirm that the problem of downgrading the JDK to an earlier version solves the problem. I know this is not the solution you are looking for, but at least it makes it work.

+2
source

As an example, take as an example:

Step 1. In C: \ Users \ Jimmy.java.policy (create it if it does not exist), add the content below:

 grant { permission java.security.AllPermission; }; 

Of course, "C: \ Users \ Jimmy \" is a home user, please change it to your home accordingly. Adding AllPermission is just for a quick fix to your problem. you better set up a more accurate FilePermission here.


Step 2. Launch rmiregistry:

 C:\JDK\bin>rmiregistry -J-Djava.rmi.server.codebase=file://C:/workspaces/MyLab/target/classes/ 

(Please note that the code base must end with "/")


Step 3. Start the server and client program.

Literature:

http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/codebase.html http://docs.oracle.com/javase/7/docs/technotes/guides/security/spec/security -spec.doc3.html http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/enhancements-7.html

+2
source

There seems to be no workaround, because this is a mistake, so wait for the fix

See details

https://bugzilla.redhat.com/show_bug.cgi?id=751203

Code fix http://icedtea.classpath.org/hg/icedtea6/rev/67df573b0734

+1
source

If you do not need dynamic code loading (in this case you can use ftp codebase), the solution is simply to set the CLASSPATH environment variable in the path to your jar file:

Windows: set CLASSPATH = "path_to_jarfile"

Linux (batch): CLASSPATH = "path_to_jarfile" export CLASSPATH

This is best done in some script that invokes the RMI server. Setting the class path on the command line (-cp option) when starting the RMI server does not help, because it does not affect the rmiregistry class path!

+1
source

If you run rmiregistry in the working directory of your project, it works. So essentially the working directory of your project and the current directory for rmiregistry should be the same.

+1
source

I recently ran into this problem. I can confirm that when using the: protocol rmiregistry file should either:

  • runs in the root of the directory containing the common classes; or
  • Set the classpath to common classes or to a cluster with a common class; or
  • use a protocol different from the file: // (I installed ngnix and gave the jar from this).
+1
source

It may not be what you want, but you can solve it with a classpath, not code. The JVM client will work fine if you add the necessary classes to its class path. If you use the file: URL scheme, then the classes should already be available on the local host.

0
source

I had the same problem, but I could not change the version of the JDK. It turns out you can solve it by running / running rmiregistry from the same directory as your code base, which in my case was the target / classes. So cd project / target / classes and then run rmiregistry &

0
source

All Articles