Re: Config files with application class references

Bob Scheifler <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
> I have a configuration class which provide static methods.  Let's say
> that I have a service configuration file that contains
>
> import some.package.of.ConfigMethods;
>
> some.other.package.for.a.service {
>     obj1 = ConfigMethods.getFactory( new Factory1() );
> }

OK, you mean that's the individual service's config file; it's
not in the ServiceStarter's config file?  In which case, it should
never be fetched by ServiceStarter, only by your service once it's
running.

> The construction of Factory1, and anything it constructs internally, is
> something that is specific to the service, as is the environment that
> ConfigMethods.getFactory() runs in.  Both the ClassLoader and the
> security context active at the time of construction are not going to be
> that which the service specified with its classpath and policy in the
> ServiceDescriptor.

What kind of ServiceDescriptor are you using?  If it's a
NonActivatableServiceDescriptor, then your service will be in
its own class loader with its own security context.

> In the stack trace, it appears that the configuration file passed to
> ServerStarter on the command line, is parsed with the JVMs classpath

Yes, but the config file passed on the command line should not be the
one you showed above, it should be one specifically for ServiceStarter.

> and
> no apparent security context (no security manager it seems).

ServiceStarter.main does set a security manager if one isn't already set.

> Factory1
> and any referenced classes must be resolved by the JVM app classloader.

It's not clear to me why you're trying to reference them within
ServiceStarter's configuration.

The stack trace you supplied seems to indicate that the exception is
occurring when the ServiceStarter attempts to get its "serviceDescriptors"
configuration entry.  The config file you provided doesn't match that
scenario, however.  So, something's getting lost in your approximate
translation.  More precision is required to sort it out.

- Bob

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
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.