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

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

[~romain.manni-bucau], maybe I'm just doing this wrong, but *javax.el* is 
included with the CDI 2.0 dependency, which OWB implements. Here are my only 
dependencies:

 
{code:java}
<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
    <version>2.0</version>
</dependency>
<dependency>
    <groupId>org.apache.openwebbeans</groupId>
    <artifactId>openwebbeans-se</artifactId>
    <version>2.0.7</version>
</dependency>
<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>javax.annotation-api</artifactId>
    <version>1.3.2</version>
</dependency>
{code}
 

In my code, I'm only doing a simple container initializer:

 
{code:java}
SeContainer container = SeContainerInitializer.newInstance().initialize()
{code}
And a context observer:

 

 
{code:java}
public void onBootEvent(@Observes @Initialized(ApplicationScoped.class) Object 
obj) {
    // ...
}
{code}
And here's the shaded output:
{code:java}
[INFO] --- maven-shade-plugin:3.2.1:shade (bundle) @ <artifactId> ---
[INFO] Including javax.enterprise:cdi-api:jar:2.0 in the shaded jar.
[INFO] Including javax.el:javax.el-api:jar:3.0.0 in the shaded jar.
[INFO] Including javax.interceptor:javax.interceptor-api:jar:1.2 in the shaded 
jar.
[INFO] Including javax.inject:javax.inject:jar:1 in the shaded jar.
[INFO] Including org.apache.openwebbeans:openwebbeans-se:jar:2.0.7 in the 
shaded jar.
[INFO] Including org.apache.openwebbeans:openwebbeans-impl:jar:2.0.7 in the 
shaded jar.
[INFO] Including org.apache.xbean:xbean-finder-shaded:jar:4.9 in the shaded jar.
[INFO] Including org.apache.xbean:xbean-asm6-shaded:jar:4.9 in the shaded jar.
[INFO] Including org.apache.openwebbeans:openwebbeans-spi:jar:2.0.7 in the 
shaded jar.
[INFO] Including javax.annotation:javax.annotation-api:jar:1.3.2 in the shaded 
jar.
[INFO] Attaching shaded artifact.
{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)

Reply via email to