You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2018/10/25 17:25:00 UTC

[jira] [Comment Edited] (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=16663985#comment-16663985 ] 

Romain Manni-Bucau edited comment on OWB-1267 at 10/25/18 5:24 PM:
-------------------------------------------------------------------

Did you think to merge resources? Default setup of assembly breaks spi resources.

here is a sample using shade plugin:

{code}
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <executions>
    <execution>
      <id>bundle</id>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <shadedClassifierName>fat</shadedClassifierName>
        <shadedArtifactAttached>true</shadedArtifactAttached>
        <dependencyReducedPomLocation>${project.build.directory}/reduced-pom-bundle.xml</dependencyReducedPomLocation>
        <transformers>
          <transformer implementation="org.apache.openwebbeans.maven.shade.OpenWebBeansPropertiesTransformer"/>
          <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
        </transformers>
        <filters>
          <filter>
            <artifact>*:*</artifact>
            <excludes>
              <exclude>META-INF/*.SF</exclude>
              <exclude>META-INF/*.DSA</exclude>
              <exclude>META-INF/*.RSA</exclude>
              <exclude>META-INF/LICENSE.txt</exclude>
              <exclude>META-INF/LICENSE</exclude>
              <exclude>META-INF/NOTICE.txt</exclude>
              <exclude>META-INF/NOTICE</exclude>
            </excludes>
          </filter>
        </filters>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-maven</artifactId>
      <version>2.0.7</version>
    </dependency>
  </dependencies>
</plugin>
{code}


was (Author: romain.manni-bucau):
Did you think to merge resources? Default setup of assembly breaks spi resources.

> 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: Bug
>          Components: Lifecycle
>    Affects Versions: 2.0.7
>            Reporter: James Smith
>            Priority: Major
>
>  
> 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)