You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "James Smith (JIRA)" <ji...@apache.org> on 2019/03/08 18:38:00 UTC

[jira] [Commented] (OWB-1267) SeContainer Fails with NPE when starting from Exec Maven Plugin

    [ https://issues.apache.org/jira/browse/OWB-1267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16788165#comment-16788165 ] 

James Smith commented on OWB-1267:
----------------------------------

[~romain.manni-bucau],

I'm still having issues with this approach. I think I can now wrap my head around what is happening.

According to the [SE setup guide|https://openwebbeans.apache.org/owbsetup_se.html] and the [download page|https://openwebbeans.apache.org/download.html]. For maven, you should be able to add the libraries and run the application. I chose the geronimo-jcdi setup to resolve the implementations. But I still only have this working correctly when the project is run from an IDE.

When bundling it with the shade plugin, however, because all of the dependencies of OWB are *provided* scope (osgi, xbean-finder, etc.), I have to add every dependency manually.

So my final request for this ticket would be to provide a working example of an OWB fat jar, included with steps on how to run the final jar with *java -jar* and not from the IDE (The [standalone sample|https://github.com/apache/openwebbeans/tree/trunk/samples/standalone-sample] is not building correctly. I'm running it with the *package* goal, then executing the jar with *java -jar*.)

If you can provide this, I would greatly appreciate it. Thanks!

Here is my stack trace:

{code}
Mar 08, 2019 12:25:21 PM org.apache.webbeans.lifecycle.AbstractLifeCycle bootstrapApplication
INFO: OpenWebBeans Container is starting...
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery addWebBeansXmlLocation
INFO: added beans archive URL: jar:file:<REDACTED>/target/standalone-fat-jar-0.1.0-SNAPSHOT-fat.jar!/META-INF/beans.xml
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery addWebBeansXmlLocation
INFO: added beans archive URL: jar:file:/System/Library/Java/Extensions/MRJToolkit.jar!/
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery getBeanClassesPerBda
WARNING: Ignoring class [org.apache.xbean.finder.BundleAnnotationFinder$AnnotationFindingCallback] because it could not be loaded: java.lang.NoClassDefFoundError: org/apache/xbean/osgi/bundle/util/BundleResourceFinder$ResourceFinderCallback 
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery getBeanClassesPerBda
WARNING: Ignoring class [org.apache.xbean.finder.BundleAnnotationFinder] because it could not be loaded: java.lang.NoClassDefFoundError: org/apache/xbean/osgi/bundle/util/BundleResourceFinder$ResourceFinderCallback 
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery getBeanClassesPerBda
WARNING: Ignoring class [org.apache.xbean.finder.BundleAssignableClassFinder] because it could not be loaded: java.lang.NoClassDefFoundError: org/apache/xbean/osgi/bundle/util/BundleClassFinder 
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery getBeanClassesPerBda
WARNING: Ignoring class [org.apache.xbean.finder.archive.BundleArchive$AnnotationFindingCallback] because it could not be loaded: java.lang.NoClassDefFoundError: org/apache/xbean/osgi/bundle/util/BundleResourceFinder$ResourceFinderCallback 
Mar 08, 2019 12:25:21 PM org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery getBeanClassesPerBda
WARNING: Ignoring class [org.apache.xbean.finder.archive.BundleArchive] because it could not be loaded: java.lang.NoClassDefFoundError: org/apache/xbean/osgi/bundle/util/BundleResourceFinder$ResourceFinderCallback 
Mar 08, 2019 12:25:22 PM org.apache.webbeans.config.BeansDeployer getBeanAttributes
INFO: Skipping deployment of Class class org.apache.webbeans.container.BeanManagerImpldue to a NoClassDefFoundError: javax/el/ELResolver
Mar 08, 2019 12:25:22 PM org.apache.webbeans.config.BeansDeployer getBeanAttributes
INFO: Skipping deployment of Class class org.apache.webbeans.container.InjectableBeanManagerdue to a NoClassDefFoundError: javax/el/ELResolver
Mar 08, 2019 12:25:22 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints
INFO: All injection points were validated successfully.
Mar 08, 2019 12:25:22 PM org.apache.webbeans.lifecycle.AbstractLifeCycle bootstrapApplication
INFO: OpenWebBeans Container has started, it took [659] ms.
{code}


> SeContainer Fails with NPE when starting from Exec Maven Plugin
> ---------------------------------------------------------------
>
>                 Key: OWB-1267
>                 URL: https://issues.apache.org/jira/browse/OWB-1267
>             Project: OpenWebBeans
>          Issue Type: Question
>          Components: Samples &amp; Documentation
>    Affects Versions: 2.0.7
>            Reporter: James Smith
>            Priority: Minor
>
>  
> I am using OWB and the CDI 2.0 spec, starting my injection with the following code:
> {noformat}
> SeContainer container = SeContainerInitializer.newInstance().initialize(){noformat}
>  
> When I run the program via *main*, the program runs fine. But, when I run the program with the *Exec Maven Plugin*, using the following command:
> {noformat}
> mvn clean package exec:exec{noformat}
> I get the following error:
>  
> {code:java}
> Exception in thread "main" java.lang.NullPointerException
> at org.apache.openwebbeans.se.OWBInitializer.newContainer(OWBInitializer.java:107)
> at org.apache.openwebbeans.se.OWBInitializer.initialize(OWBInitializer.java:91)
> at org.apache.openwebbeans.se.SeInitializerFacade.initialize(SeInitializerFacade.java:137)
> at com.my.package.core.Main.main(Main.java:11)
> {code}
> Also, I am packaging all of the dependencies into a single jar using the *Apache Maven Assembly Plugin*. Running the jar with the following command produces the same output mentioned above:
> {noformat}
> java -jar target/my-jar-with-dependencies.jar{noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)