ci.maven icon indicating copy to clipboard operation
ci.maven copied to clipboard

prepare-feature seems not to be working

Open hiebra opened this issue 3 years ago • 11 comments

I've tried hard, following the documentation and observing previous issues, but I'm not able to prepare my user feature

I've created an OSGi bundle, an ESA, and a BOM having all of them on C:\Users\Santi\.m2\repository\com\softalks\hello

I've issued an mvn clean liberty:create liberty:prepare-feature against this effective pom getting this error response and this one when using mvn -e

You, like me, could prefer the lazy friendly version:

Caused by: java.lang.NullPointerException: Cannot invoke "java.io.FileInputStream.close()" because "instream" is null
    at io.openliberty.tools.common.plugins.util.PrepareFeatureUtil.generateJson (PrepareFeatureUtil.java:278)
    at io.openliberty.tools.common.plugins.util.PrepareFeatureUtil.prepareFeature (PrepareFeatureUtil.java:120)
    at io.openliberty.tools.common.plugins.util.PrepareFeatureUtil.prepareFeatures (PrepareFeatureUtil.java:87)
    at io.openliberty.tools.maven.server.PrepareFeatureMojo.prepareFeatures (PrepareFeatureMojo.java:56)

Not so effective POM (kids first):

POM++ (ESA, BOM, and bundle): poms.zip

Postscript: I did not find PrepareFeatureUtil.java over there. Is it closed source?

hiebra avatar Dec 04 '22 02:12 hiebra

@hiebra I have not looked at your issue yet, but wanted to respond about your question at the end.

Postscript: I did not find PrepareFeatureUtil.java over there. Is it closed source?

That is located in our common dependency at this location.

cherylking avatar Dec 04 '22 23:12 cherylking

@hiebra I have not looked at your issue yet, but wanted to respond about your question at the end.

Postscript: I did not find PrepareFeatureUtil.java over there. Is it closed source?

That is located in our common dependency at this location.

Thank you. Good to know. Github search didn't help (search in organization seems not to be brilliant) and even Google could not find it yesterday (today, who knows why, it gives me a clue). Hard to understand in this century

hiebra avatar Dec 05 '22 07:12 hiebra

@jjiwooLim

cherylking avatar Dec 06 '22 19:12 cherylking

Hi @hiebra,

Could you enable Maven debug trace mvn -X and send us the output?

jjiwooLim avatar Dec 07 '22 20:12 jjiwooLim

@hiebra Did you see @jjiwooLim request for debug trace? Is this issue still affecting you?

cherylking avatar Feb 20 '23 18:02 cherylking

@hiebra I'm closing this issue since there has been no activity in over 3 months. Feel free to reopen and provide the requested information if the problem persists.

cherylking avatar Mar 22 '23 14:03 cherylking

I'm facing same errros.

teruz avatar Sep 15 '23 20:09 teruz

@teruz Can you provide any debug trace or further details to help us follow up on this issue?

cherylking avatar Sep 15 '23 20:09 cherylking

@cherylking hi, I upload some materials.

Reference

https://openliberty.io/blog/2022/07/06/user-feature-install.html

Versions

> java -version
openjdk version "17.0.5" 2022-10-18
IBM Semeru Runtime Open Edition 17.0.5.0 (build 17.0.5+8)
Eclipse OpenJ9 VM 17.0.5.0 (build openj9-0.35.0, JRE 17 Windows 11 amd64-64-Bit Compressed References 20221018_298 (JIT enabled, AOT enabled)
OpenJ9   - e04a7f6c1
OMR      - 85a21674f
JCL      - 32d2c409a33 based on jdk-17.0.5+8)

> mvn -version
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: C:\Users\TERUYUKIXXXXXXXX\opt\apache-maven-3.9.1
Java version: 17.0.5, vendor: IBM Corporation, runtime: C:\Program Files\Semeru\jdk-17.0.5.8-openj9
Default locale: ja_JP, platform encoding: MS932
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Reproduce steps

example.zip

> mvn clean install -f bundle
> mvn clean install -f esa
> mvn clean install -f bom
> mvn clean liberty:create -f json
> mvn liberty:prepare-feature -f json

[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.demo:app-name >--------------------------
[INFO] Building app-name 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- liberty:3.8.2:prepare-feature (default-cli) @ app-name ---
[WARNING] Cannot read the BOM file C:\Users\TERUYUKIXXXXXXXX\.m2\repository\test\user\test\osgi\features-bom\0.0.1-SNAPSHOT\features-bom-0.0.1-SNAPSHOT.pom
[WARNING] A features-bom file must be provided at C:\Users\TERUYUKIXXXXXXXX\.m2\repository\test\user\test\osgi\features-bom\0.0.1-SNAPSHOT\features-bom-0.0.1-SNAPSHOT.pom. Please ignore this warning if this is not a user feature.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.945 s
[INFO] Finished at: 2023-09-16T18:07:13+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.8.2:prepare-feature (default-cli) on project app-name: Execution default-cli of goal io.openliberty.tools:liberty-maven-plugin:3.8.2:prepare-feature failed: Cannot invoke "java.io.FileInputStream.close()" because "instream" is null -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

The POM in .m2 (Sorry in Japanese)

I can read the POM.

> dir C:\Users\TERUYUKIXXXXXXXX\.m2\repository\test\user\test\osgi\features-bom\0.0.1-SNAPSHOT\features-bom-0.0.1-SNAPSHOT.pom
 ドライブ C のボリューム ラベルは Windows です
 ボリューム シリアル番号は 3E7E-F33B です

 C:\Users\TERUYUKIXXXXXXXX\.m2\repository\test\user\test\osgi\features-bom\0.0.1-SNAPSHOT のディレクトリ

2023/09/16  05:05               955 features-bom-0.0.1-SNAPSHOT.pom
               1 個のファイル                 955 バイト
               0 個のディレクトリ  383,788,740,608 バイトの空き領域
> type C:\Users\TERUYUKIXXXXXXXX\.m2\repository\test\user\test\osgi\features-bom\0.0.1-SNAPSHOT\features-bom-0.0.1-SNAPSHOT.pom
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test.user.test.osgi</groupId>
    <artifactId>features-bom</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>user features bill of materials</name>
    <description>user features bill of materials</description>
    <url>https://openliberty.io/</url>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>test.user.test.osgi</groupId>
                <artifactId>SimpleActivatorESA-</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

mvn -X

debug.log

teruz avatar Sep 16 '23 09:09 teruz

@jjiwooLim Can you look at the data/logs that teruz provided?

cherylking avatar Sep 18 '23 13:09 cherylking

Hi,

It looks like the blog has a missing element in features-bom/pom.xml. Inside the pom.xml of features-bom there should be <type>esa</type>. The doc shows the correct pom.xml.

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>test.user.test.osgi</groupId>
        <artifactId>SimpleActivatorESA-</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <scope>runtime</scope>
        <type>esa</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

I am currently working on a PR to provide better error message, and will check if I can update the blog.

jjiwooLim avatar Sep 18 '23 21:09 jjiwooLim