Yes the build tool is gradle. It pulls resources from maven central just
like maven. It's worth checking out if you haven't. It uses the cool dep
resolution stuff from maven but ditches the pom straight-jacket.

I found the class, in the jar, overlooked it the first time. I searched on
loader when I opened the jar with emacs and didn't notice that the package
I found was com/sun/jini not net/jini (oops!). So that's resolved, but this
only makes things muddier. The jar is being packed with one-jar (which is a
tool that allows you to produce a jar containing both your classes and
their dependencies in the same jar). Clearly many other classes are loading
and so I turned on one-jar's logging and got this:

guss-mbp:ingest gus$ j7a -Done-jar.info=true -jar
build/libs/ingest-node.jar foo bar 2>&1 | grep Preferred
[JarClassLoader] WARN:
com/sun/jini/loader/pref/internal/PreferredResources.class in
lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassLoader$1.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassLoader$2.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassLoader$3.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassLoader$4.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassLoader.class in
lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassProvider$1.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassProvider$2.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassProvider$3.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassProvider$4.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassProvider$5.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:
net/jini/loader/pref/PreferredClassProvider$LoaderEntry.class in
lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:
net/jini/loader/pref/PreferredClassProvider$LoaderKey.class in
lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:  net/jini/loader/pref/PreferredClassProvider.class
in lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
[JarClassLoader] WARN:
net/jini/loader/pref/PreferredFactoryClassLoader.class in
lib/jsk-platform-2.2.2.jar is hidden by lib/jini-ext-2.1.jar (with
different bytecode)
java.lang.NoClassDefFoundError: net.jini.loader.pref.PreferredClassProvider

So I took the jini-ext jar out, and all I get is
uss-mbp:ingest gus$ j7a -Done-jar.info=true -jar build/libs/ingest-node.jar
foo bar 2>&1 | grep Preferred
java.lang.NoClassDefFoundError: net.jini.loader.pref.PreferredClassProvider

So it's there, it's found but something odd is going on after that that
results in NoClassDefFoundError. This may relate to the JarClassLoader that
gets installed, but clearly that works most of the time...

Are you attempting to manually load this class by looking up the .class as
file? (one-jar has a known bug along these lines. It loads classes just
fine from the included jars, and files from your project just fine. I think
it loads files from dep jars just fine too (otherwise lots of stuff would
have issues) but it seems to confused if you try to load classes as if they
are files: https://sourceforge.net/p/one-jar/bugs/73/)

How critical is PreferredClassProvider to river's operation?

-Gus


On Mon, Jul 7, 2014 at 9:39 AM, Greg Trasuk <[email protected]> wrote:

>
> PreferredClassProvider should be in jsk-platform.jar (which I think you
> confirmed with your ‘grep -r’).  It is there in the 2.2.2 build that I
> have.  I’m not familiar with your build tool (Gradle?) but you might want
> to check the class path entry in the jar manifest that’s generated, to see
> if jsk-platform is actually in the runtime class path.
>
> Are you starting up the system using the ServiceStarter approach or
> winging it yourself?  If ServiceStarter, could you post the starter
> configuration file?
>
> Cheers,
>
> Greg Trasuk.
> On Jul 6, 2014, at 8:27 PM, Gus Heck <[email protected]> wrote:
>
> > I've now spent several hours hunting for this class. What jar contains
> it?
> >
> > Presently I'm building with the following (shotgun, messy non minimized)
> > dependencies:
> > dependencies {
> >    compile 'com.google.guava:guava:15.0'
> >    compile 'com.google.code.findbugs:jsr305:2.0.3'
> >    compile 'jini:jini-core:2.1'
> >    compile 'org.apache.river:reggie:2.2.2'
> >    compile 'net.jini:jini-ext:2.1'
> >    compile 'net.jini:jsk-lib:2.2.2'
> >    compile 'net.jini:jsk-dl:2.2.2'
> >    compile 'net.jini:jsk-platform:2.2.2'
> >    compile 'net.jini:jsk-resources:2.2.2'
> >    compile 'net.jini:jini-core:2.1'
> >    compile 'net.jini:jini-ext:2.1'
> >    compile 'net.jini:jsk-policy:2.2.2'
> > //    compile 'net.jini:jini-starterkit:2.1-beta2' // 404 in maven
> central
> >    compile 'org.apache.logging.log4j:log4j-core:2.0-rc2'
> >    testCompile 'junit:junit:4.11'
> > }
> >
> > I basically got frustrated and just threw everything I could find at it
> and
> > it still does this:
> >
> > guss-mbp:ingest gus$ alias j7a
> > alias
> >
> j7a='/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/bin/java
> > -Djava.security.policy=/Users/gus/tools/jpolicy/all.policy
> >
> -Djava.rmi.server.RMIClassLoaderSpi=net.jini.loader.pref.PreferredClassProvider'
> > guss-mbp:ingest gus$ j7a -Done-jar.silent=true -jar
> > build/libs/ingest-node.jar foo bar
> > Starting injester node...
> > Jul 06, 2014 7:57:31 PM
> > net.jini.discovery.LookupDiscovery$UnicastDiscoveryTask run
> > INFO: exception occurred during unicast discovery to guss-mbp.lan:54290
> > with constraints InvocationConstraints[reqs: {}, prefs: {}]
> > java.lang.NoClassDefFoundError:
> net.jini.loader.pref.PreferredClassProvider
> >    at
> >
> java.rmi.server.RMIClassLoader.initializeProvider(RMIClassLoader.java:687)
> >    at java.rmi.server.RMIClassLoader.access$000(RMIClassLoader.java:110)
> >    at java.rmi.server.RMIClassLoader$1.run(RMIClassLoader.java:120)
> >    at java.rmi.server.RMIClassLoader$1.run(RMIClassLoader.java:119)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at java.rmi.server.RMIClassLoader.<clinit>(RMIClassLoader.java:117)
> >    at net.jini.loader.ClassLoading.loadClass(ClassLoading.java:138)
> >    at
> > net.jini.io.MarshalInputStream.resolveClass(MarshalInputStream.java:296)
> >    at
> > java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
> >    at
> java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
> >    at
> > java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
> >    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
> >    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
> >    at net.jini.io.MarshalledInstance.get(MarshalledInstance.java:358)
> >    at
> >
> com.sun.jini.discovery.DiscoveryV1.doUnicastDiscovery(DiscoveryV1.java:397)
> >    at
> net.jini.discovery.LookupDiscovery$13.run(LookupDiscovery.java:3327)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> net.jini.discovery.LookupDiscovery.doUnicastDiscovery(LookupDiscovery.java:3324)
> >    at
> >
> net.jini.discovery.LookupDiscovery.doUnicastDiscovery(LookupDiscovery.java:3355)
> >    at
> > net.jini.discovery.LookupDiscovery.access$3900(LookupDiscovery.java:696)
> >    at
> >
> net.jini.discovery.LookupDiscovery$UnicastDiscoveryTask.run(LookupDiscovery.java:1744)
> >    at
> com.sun.jini.thread.TaskManager$TaskThread.run(TaskManager.java:331)
> >
> > No Service Registries found
> >
> > I'm passing in the option for this class on the advice of your getting
> > started page <
> http://river.apache.org/user-guide-basic-river-services.html>.
> > It would be really nice if that page listed what dependency I needed for
> > this.
> >
> > I tried grepping the entire distribution and only found it in two places
> >
> > guss-mbp:apache-river-2.2.2 gus$ grep -r PreferredClassProvider *
> > <*snip* javadoc matches>
> > Binary file lib/jini-ext.jar matches
> > Binary file lib/jsk-platform.jar matches
> >
> > in both jars I see only:
> >  drwxr-xr-x         0  10-Nov-2013  22:49:20  com/sun/jini/loader/
> >  drwxr-xr-x         0  10-Nov-2013  22:49:20  com/sun/jini/loader/pref/
> >  drwxr-xr-x         0  10-Nov-2013  22:49:20
> > com/sun/jini/loader/pref/internal/
> >  -rw-r--r--      7218  10-Nov-2013  22:49:20
> > com/sun/jini/loader/pref/internal/PreferredResources.class
> >
> >
> > But in any case as you can see both of these libs are already in my
> > dependency list.
> >
> > This puzzles me since it's clearly in your repository...
> > http://svn.apache.org/viewvc/river/jtsk/trunk/src/net/jini/loader/pref/
> >
> > shouldn't it be in at least one of the distributed jars, if not one of
> the
> > packages on mavencentral?
> >
> > -Gus
> >
> > --
> > http://www.the111shift.com
>
>


-- 
http://www.the111shift.com

Reply via email to