netbeans-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damian Carey <jami...@gmail.com>
Subject Platform wrapped jar cannot access META-INF/service impl via ServiceLoader
Date Sat, 17 Aug 2019 06:12:10 GMT
Hi all,

We have a "mature" (10+ year old) Netbeans Platform Swing product, which
has 35+ modules. This all works well.

As usual, when one Netbeans module provides an Implementation we find it
from other Netbeans modules using the usual idiom ...
Provider: puts entry in META-INF/services
Consumer: MyClass myObj = Lookup.getDefault().lookup(MyClass.class);

Our current issue is that we need to add an external jar that is NOT built
using Netbeans, so it can't use Lookup. I have placed this external jar
into a module wrapper, and one of our modules depends on it so we can
successfully start this service as appropriate. Again, everything is
perfect with this setup.

The problem is that this external jar is looking for services from our
Netbeans platform product, it is seeking them using standard java
ServiceLoader capability, but the implementations are not found.

I *think* that if we use the Netbeans System ClassLoader then it CAN locate
the implementations, however we don't want to use the system classloader
because it will cause other issues.

Does anyone have any suggestions on how a wrapped jar might access Netbeans
META-INF/services implementations via vanilla Java ServiceLoader SPI
interface?

Any suggestions would be hugely appreciated.

Many thanks,
-Damian

Mime
View raw message