openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Trasuk <tras...@trasuk.com>
Subject OWB not discovering classes from jar files in classpath.
Date Tue, 27 Dec 2016 00:49:05 GMT
Hello:

I’m trying to use OpenWebBeans to implement CDI with an extension inside a specialized container
for Jini services.  You can see the main class at https://github.com/trasukg/jini-adv-api-sdk/blob/master/adv-api-bootstrap/src/main/java/org/apache/river/container/advapi/Main.java

When I run the class from inside Netbeans, it picks up the main class and the extension just
fine, outputting the following:

Dec 26, 2016 7:40:19 PM org.apache.webbeans.lifecycle.AbstractLifeCycle bootstrapApplication
INFO: OpenWebBeans Container is starting...
Dec 26, 2016 7:40:19 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery addWebBeansXmlLocation
INFO: added beans archive URL: file:/Users/trasukg/NetBeansProjects/jini-adv-api-sdk/adv-api-bootstrap/target/classes/META-INF/beans.xml
Dec 26, 2016 7:40:19 PM org.apache.river.container.advapi.AdvAPIExtension beforeBeanDiscovery
INFO: beginning the scanning process
Dec 26, 2016 7:40:19 PM org.apache.river.container.advapi.AdvAPIExtension processAnnotatedType
INFO: scanning type: org.apache.river.container.advapi.Main
Dec 26, 2016 7:40:19 PM org.apache.river.container.advapi.AdvAPIExtension processAnnotatedType
INFO: scanning type: org.apache.river.container.advapi.AdvAPIExtension
Dec 26, 2016 7:40:19 PM org.apache.river.container.advapi.AdvAPIExtension afterBeanDiscovery
INFO: finished the scanning process
Dec 26, 2016 7:40:20 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Dec 26, 2016 7:40:20 PM org.apache.webbeans.lifecycle.AbstractLifeCycle bootstrapApplication
INFO: OpenWebBeans Container has started, it took [206] ms.
Here's me running the app.
And the extension is:org.apache.river.container.advapi.AdvAPIExtension@61f8bee4
We retrieved the main class

But when I run inside the Jini service starter, which sets up a custom classloader, the extension
loads, but OpenWebBeans doesn’t find the classes in the jar file.  Output is below:

Dec 26, 2016 7:43:00 PM org.apache.webbeans.lifecycle.AbstractLifeCycle bootstrapApplication
INFO: OpenWebBeans Container is starting...
Dec 26, 2016 7:43:00 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery addWebBeansXmlLocation
INFO: added beans archive URL: jar:file:/Users/trasukg/NetBeansProjects/jini-adv-api-sdk/adv-api-hello-home/target/adv-api-hello-home-1.0-SNAPSHOT-bin/lib/adv-api-bootstrap.jar!/META-INF/beans.xml
Dec 26, 2016 7:43:00 PM org.apache.river.container.advapi.AdvAPIExtension beforeBeanDiscovery
INFO: beginning the scanning process
Dec 26, 2016 7:43:00 PM org.apache.river.container.advapi.AdvAPIExtension afterBeanDiscovery
INFO: finished the scanning process
Dec 26, 2016 7:43:00 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Dec 26, 2016 7:43:00 PM org.apache.webbeans.lifecycle.AbstractLifeCycle bootstrapApplication
INFO: OpenWebBeans Container has started, it took [170] ms.
Dec 26, 2016 7:43:00 PM org.apache.river.container.advapi.Main main
SEVERE: null
java.util.NoSuchElementException
	at java.util.HashMap$HashIterator.nextNode(HashMap.java:1431)
	at java.util.HashMap$KeyIterator.next(HashMap.java:1453)
	at org.apache.river.container.advapi.Main.main(Main.java:49)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.apache.river.tools.rt.start.ServiceWithMainMethodDescriptor.create(ServiceWithMainMethodDescriptor.java:394)
	at org.apache.river.tools.rt.start.ServiceStarter.create(ServiceStarter.java:264)
	at org.apache.river.tools.rt.start.ServiceStarter.processServiceDescriptors(ServiceStarter.java:422)
	at org.apache.river.tools.rt.start.ServiceStarter.main(ServiceStarter.java:453)

The big difference that jumps out at me is the url that’s added for the bean archive url.
 In the working case, it is:
INFO: added beans archive URL: file:/Users/trasukg/NetBeansProjects/jini-adv-api-sdk/adv-api-bootstrap/target/classes/META-INF/beans.xml

In the non-working case, it is:
INFO: added beans archive URL: jar:file:/Users/trasukg/NetBeansProjects/jini-adv-api-sdk/adv-api-hello-home/target/adv-api-hello-home-1.0-SNAPSHOT-bin/lib/adv-api-bootstrap.jar!/META-INF/beans.xml

i.e. in the non-working case it’s a classpath resource that’s inside a jar file in the
class path rather than a url that points to a file in the file system.  I’m surprised this
would be a problem, given that OWB works fine inside Tomcat, which would also be using a specialized
classloader.

Any suggestions on how to track down what’s going on?

Thanks,

Greg Trasuk


Mime
View raw message