Re: help! rmi server constructor throws ExceptionInInitializerError ?? is this an rmi bug ??

al joslin <[email protected]>
Newsgroups gmane.comp.java.sun.rmi
Message-ID <BF1D77C4.3318A%[email protected]>
I've been told that my original message likely didn't make it to the list --
I was joining and posting at the same time, so -- here it is again.

(Our usage of these classes is used to launch code already existant on the
target machine -- no dynamic class loading needed)

Allen Joslin wrote:

> I hope that someone can help me with this.  I really have no idea what is
> failing -- I'm starting to suspect my java installation as the problem appears
> to be within the rmi support structure...
>
>
> I am bringing long working code forward from: java version "1.2.2" Classic VM
> (build Linux_JDK_1.2.2_RC4, native threads, sunwjit) to: java version "1.4.2"
> gcj (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) -- and it's failing in the
> place where I start the rmi server code.  (the registery starts fine.)
>
> the full_open_policy referenced in the launch is a standard AllPermissions
> file, also long running...
>
> When I launch the JobListenerImpl (java -Djava.rmi.server.disableHttp=true -
> Djava.rmi.server.codebase=file:///apps/common/com/RMI/ -
> Djava.security.policy=full_open_policy JobListenerImpl &) the main routine
> (public static void main) adds the SecurityManager
> (System.setSecurityManager(new RMISecurityManager())) successfully -- and then
> the call to the JobListenerImpl constructor fails with a "Operation not
> allowed" exception message, followed closely by a "Exception in thread "main"
> java.lang.ExceptionInInitializerError *** Got java.lang.NoClassDefFoundError:
> gnu.gcj.runtime.NameFinder while trying to print stack trace." message when I
> try to print the exception stack trace.
>
> My code is appended, here are the loglines I print:
>
> log: java -Djava.rmi.server.disableHttp=true
> -Djava.rmi.server.codebase=file:///apps/common/ com/RMI/
> -Djava.security.policy=full_open_policy JobListenerImpl test nwot-m01
> 192.168.20.190 1099 &
>
> log: public static void
> main(['test','nwot-m01.printingforsystems.com','192.168.20.190','1099'])
>
> log: System.setSecurityManager(new RMISecurityManager());
>
> At this point I get the exception:
>
> exception: Operation not allowed
>     cause: null
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> *** Got java.lang.NoClassDefFoundError: gnu.gcj.runtime.NameFinder while
> trying to print stack trace.
>
>
> Here's the relevant code:
>
> public static void main(String args[]) {
>
>  String nwoRoot = args[0];
>  String machineName = args[1];
>  String address = args[2];
>  String port = args[3];
>
>  System.out.println("");
>
>  System.out.println(" log: public static void
>                       main(['"+args[0]+"','"+args[1]+"','"+args[2]
>                            +"','"+args[3]+"'])");
>
> // Create and install a security manager
> if (System.getSecurityManager() == null) {
>
>  System.setSecurityManager(new RMISecurityManager());
>  System.out.println(" log: System.setSecurityManager(new
>                                    RMISecurityManager());");
> }
>
> try {
>
>   JobListenerImpl obj = new JobListenerImpl(nwoRoot,machineName,address,port);
>
>   System.out.println(" log: JobListenerImpl obj = new
>                          JobListenerImpl(args[0],args[1],args[2],args[3]);");
>
>   String binder = "//"+ address +":"+ port +"/JobListener";
>
>   Naming.rebind(binder, obj);
>
>   System.out.println(" log: Naming.rebind('"+binder+"', obj);");
>
>  } catch (Exception e) {
>   System.out.println(" exception: "+ e.getMessage());
>   System.out.println("     cause: "+ e.getCause());
>   e.printStackTrace();
>  }
> }
>
> //-------------------------------------------------------------------------
>
> public JobListenerImpl ( String nr, String mn, String ad, String po )
>                                                  throws RemoteException
> {
>
>   super();
>
>   System.out.println(" log:
>   JobListenerImpl('"+nr+"','"+mn+"','"+ad+"','"+po+"')");
>
>   nwoRoot = nr;
>   machineName = mn;
>   address = ad;
>   port = po;
> }
>

Peter Jones - JavaSoft East wrote:

> I don't think that your original message, which you seem to have
> excerpted below, actually made it to this list.  If you (re?)post the
> complete stack trace of the ExceptionInInitializerError, along with
> other relevant information like JDK version, full command lines, etc.,
> we might be able to diagnose the problem.
>
> Without knowing any of the above, I would guess that some application
> class is attempting some operation in its static initializer that
> requires a permission, but your security policy is not granting it
> that permission-- thus, the static initializer fails with a
> SecurityException when there is a security manager, which the VM wraps
> in an ExceptionInInitializerError when it propagates outside the
> initializer.
>
> As far as whether you should care if there is a security manager-- you
> should care if there is a possibility of untrusted code running in the
> virtual machine, or if you intend to dynamically load classes through
> RMI, which is disabled if there is no security manager set.
>
> -- Peter
>
>
> Quoting al joslin <[email protected]>:
>> Hello all,
>>
>>     the plot thickens (or thins, depending on your perspective)
>>
>>     I can now get the server to instantiate -- by commenting out the call to
>> load the RMISecurityManager
>>
>>     What does this mean?
>>
>>     Should I care?
>>
>>     Certainly my RMI is working now, and it's between machines behind
>> firewalls, and I can use encrypted parms if I want to be safer...
>>
>> Al;
>>
>>
>>> // Create and install a security manager
>>> if (System.getSecurityManager() == null) {
>>>
>>>  System.setSecurityManager(new RMISecurityManager());
>>>  System.out.println(" log: System.setSecurityManager(new
>>> RMISecurityManager());");
>>> }
>
> ===========================================================================
> To unsubscribe, send email to [email protected] and include in the body
> of the message "signoff RMI-USERS".  For general help, send email to
> [email protected] and include in the body of the message "help".
>
> For a list of frequently asked RMI questions please refer to:
> http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
>
> To view past RMI-USERS postings, please see:
> http://archives.java.sun.com/archives/rmi-users.html

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.