You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Greg Trasuk <tr...@trasuk.com> on 2016/12/27 00:49:05 UTC

OWB not discovering classes from jar files in classpath.

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


Re: OWB not discovering classes from jar files in classpath.

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 29 déc. 2016 01:05, "Greg Trasuk" <tr...@trasuk.com> a écrit :


Thank you Mark and Romain for replying.

@Romain - yes, if I set xbean.finder.use.get-resources=true, it seems to
work.  Is there any downside to setting it?  Is there a configuration file
that it can go into rather than a system property?  I tried putting the
setting into META-INF/openwebbeans/openwebbeans.properties, but it didn’t
work there.  Is there a similar mechanism for xbeans?


>> it is just a perf downside. No other config sadly.

@Mark - I tried the 1.7.1-SNAPSHOT and it has the same behavior.

The funny thing is that I also tried using the JarArchive class from xbeans
to read the file directly, and it works fine.

>> if so you can use a custom scanner service probably

If you’re curious about the project, it’s at https://github.com/trasukg/
jini-adv-api-sdk

Thanks again!

Greg.

> On Dec 27, 2016, at 5:33 AM, Mark Struberg <st...@yahoo.de> wrote:
>
>
> Hi Greg!
>
> First, welcome to OpenWebBeans and merry Christmas or Hanukka or just
holidays!
>
> We recently improved our URL handling a bit as well, could you please try
out our latest snapshot?
> Should be deployed to the apache.snpshots repo or just build our trunk
with mvn clean install.
>
> A sample project would help as well.
>
> txs and LieGrue,
> strub
>
>
>
>> Am 27.12.2016 um 09:30 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
>:
>>
>> Hi
>>
>> can you try setting the system property xbean.finder.use.get-resources
to true please? If it works it is due to the Jini classloader.
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau |  Blog | Old Blog | Github | LinkedIn | JavaEE Factory
>>
>> 2016-12-27 1:49 GMT+01:00 Greg Trasuk <tr...@trasuk.com>:
>> 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.ServiceWithMainMethodDescripto
r.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
>>
>>
>

Re: OWB not discovering classes from jar files in classpath.

Posted by Greg Trasuk <tr...@trasuk.com>.
Thank you Mark and Romain for replying.

@Romain - yes, if I set xbean.finder.use.get-resources=true, it seems to work.  Is there any downside to setting it?  Is there a configuration file that it can go into rather than a system property?  I tried putting the setting into META-INF/openwebbeans/openwebbeans.properties, but it didn’t work there.  Is there a similar mechanism for xbeans?

@Mark - I tried the 1.7.1-SNAPSHOT and it has the same behavior.  

The funny thing is that I also tried using the JarArchive class from xbeans to read the file directly, and it works fine.  

If you’re curious about the project, it’s at https://github.com/trasukg/jini-adv-api-sdk

Thanks again!

Greg.

> On Dec 27, 2016, at 5:33 AM, Mark Struberg <st...@yahoo.de> wrote:
> 
> 
> Hi Greg!
> 
> First, welcome to OpenWebBeans and merry Christmas or Hanukka or just holidays!
> 
> We recently improved our URL handling a bit as well, could you please try out our latest snapshot?
> Should be deployed to the apache.snpshots repo or just build our trunk with mvn clean install.
> 
> A sample project would help as well.
> 
> txs and LieGrue,
> strub
> 
> 
> 
>> Am 27.12.2016 um 09:30 schrieb Romain Manni-Bucau <rm...@gmail.com>:
>> 
>> Hi
>> 
>> can you try setting the system property xbean.finder.use.get-resources to true please? If it works it is due to the Jini classloader.
>> 
>> 
>> Romain Manni-Bucau
>> @rmannibucau |  Blog | Old Blog | Github | LinkedIn | JavaEE Factory
>> 
>> 2016-12-27 1:49 GMT+01:00 Greg Trasuk <tr...@trasuk.com>:
>> 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
>> 
>> 
> 


Re: OWB not discovering classes from jar files in classpath.

Posted by Mark Struberg <st...@yahoo.de>.
Hi Greg!

First, welcome to OpenWebBeans and merry Christmas or Hanukka or just holidays!

We recently improved our URL handling a bit as well, could you please try out our latest snapshot?
Should be deployed to the apache.snpshots repo or just build our trunk with mvn clean install.

A sample project would help as well.

txs and LieGrue,
strub



> Am 27.12.2016 um 09:30 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> Hi
> 
> can you try setting the system property xbean.finder.use.get-resources to true please? If it works it is due to the Jini classloader.
> 
> 
> Romain Manni-Bucau
> @rmannibucau |  Blog | Old Blog | Github | LinkedIn | JavaEE Factory
> 
> 2016-12-27 1:49 GMT+01:00 Greg Trasuk <tr...@trasuk.com>:
> 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
> 
> 


Re: OWB not discovering classes from jar files in classpath.

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

can you try setting the system property xbean.finder.use.get-resources to
true please? If it works it is due to the Jini classloader.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-12-27 1:49 GMT+01:00 Greg Trasuk <tr...@trasuk.com>:

> 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.ServiceWithMainMethodDescripto
> r.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
>
>