This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250468

Summary: cannot access interfaces in app/modules from jars loaded using the command line --cp:a option
Product: platform Reporter: mccorb
Component: Module SystemAssignee: Tomas Hurka <thurka>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description mccorb 2015-02-17 17:41:55 UTC
We want to make it so others can develop plugins for our NetBeans Platform app without having to deal with the complexities of our project using the standard Java ServiceLoader. 

Everything we have tried fails with a classNotFound exception and the class that cannot be found is an interface that is defined in either a wrapped jar or module.

For example suppose we have an interface org.myInterface defined in Module A.

If a user creates a class:
class myClass implements org.myInterface {

and places this class in myClasses.jar (with the appropriate ServiceLoader info), when the jar is loaded into the app using --cp:a option, myClass can be found but org.myInterface cannot and throws a classNotFound exception. 

If, within the app, we cannot cast the object returned by the ServiceLoader to an interface (or subclass) that is defined in a module or a wrapped jar then we cannot use it. 

The bottom line is there needs to be some way for jars loaded with the classloader that loads jars specified with the -cp:a option to have access to the modules and wrapped jars loaded by other class loaders. Without this capability there is no way for other people to add functionality to the application without working with the entire application.

Thank you.
Comment 1 mccorb 2015-02-17 17:44:24 UTC
Just a clarification...

We want to make it so others can develop plugins for our NetBeans Platform app without having to deal with the complexities of our project. We want them to  be able to use the standard Java ServiceLoader to accomplish this. 

The original description was confusing.
Comment 2 Tomas Hurka 2015-02-27 09:36:25 UTC
I don't understand, why one should deal with the complexities of our project when developing plugin for your NetBeans Platform app. Just register your application as platform and create new Module plugin. Add dependency on your Module A and you can start writing your code. This looks quite easy to me, so maybe try to explain in more details those complexities of your project, which will affect writing new plugin (module).

In general NetBeans Platform uses Module system, so if you want to have dependency on module A (implementing org.myInterface) you have to use Module system to describe this dependency. 

This is not P1 defect, since there never was such functionality. This looks like enhancement with P3 priority to me, if for some reason using ordinary way with module dependencies could be impractical.
Comment 3 Geertjan Wielenga 2015-02-27 09:41:04 UTC
Indeed a very strange request. I'd be happy to work with you to get this working for you, drop me a mail at to discuss.