wso2 / product-micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.
https://wso2.com/integration/
Apache License 2.0
204 stars 221 forks source link

Multiple failures building MI 4.2.0 with openjdk 11.0.20 #3012

Open resoli opened 1 year ago

resoli commented 1 year ago

Building on Ubuntu desktop 22.04, openjdk is from current package: openjdk-11-jdk:amd64 11.0.20.1+1-0ubuntu1~22.04 amd64 OpenJDK Development Kit (JDK)

$ java -version
openjdk version "11.0.20.1" 2023-08-24
OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

First failure: executing mvn clean install -DskipTests -Dmaven.test.skip=true -U

Build fails at WSO2 Micro Integrator - Mediation Initializer:

...
[INFO] WSO2 Micro Integrator - Mediation Initializer ...... FAILURE [  8.838 s]

...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:46 min
[INFO] Finished at: 2023-10-27T18:06:31+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:3.3.0:bundle (default-bundle) on project org.wso2.micro.integrator.initializer: Error calculating classpath for project MavenProject: org.wso2.ei:org.wso2.micro.integrator.initializer:4.2.0 @ /home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/components/org.wso2.micro.integrator.initializer/pom.xml: The JAR/ZIP file (/home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/components/mediation/inbound-endpoints/org.wso2.micro.integrator.inbound.endpoint/target/org.wso2.micro.integrator.inbound.endpoint-4.2.0.jar) seems corrupted, error: Invalid CEN header (invalid extra data field size for tag: 0xbfef at 242516) -> [Help 1]

This can be avoided setting the java system property -Djdk.util.zip.disableZip64ExtraFieldValidation=true , that is building with:

MAVEN_OPTS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true" mvn clean install -DskipTests -Dmaven.test.skip=true -U

Second failure: executing MAVEN_OPTS="-Djdk.util.zip.disableZip64ExtraFieldValidation=true" mvn clean install -DskipTests -Dmaven.test.skip=true -U

Build fails at Running Equinox P2 Publisher Application for Repository Generation:

[INFO] Running Equinox P2 Publisher Application for Repository Generation
[INFO] Command line:
    [/usr/lib/jvm/java-11-openjdk-amd64/bin/java, -jar, /home/resoli/.m2/repository/org/eclipse/tycho/tycho-bundles-external/0.25.0/eclipse/plugins/org.eclipse.equinox.launcher_1.3.200.v20151021-1308.jar, -configuration, /tmp/tycho-p2-runtime11327206677351068318.tmp/configuration, -nosplash, -application, org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher, -source, /home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/tmp.1698422412337/featureExtract, -metadataRepository, file:/home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/p2-repo, -metadataRepositoryName, micro-integrator-p2-profile, -artifactRepository, file:/home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/p2-repo, -artifactRepositoryName, micro-integrator-p2-profile, -publishArtifacts, -publishArtifactRepository, -compress, -append]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.osgi.storage.FrameworkExtensionInstaller (file:/home/resoli/.m2/repository/org/eclipse/tycho/tycho-bundles-external/0.25.0/eclipse/plugins/org.eclipse.osgi_3.11.0.v20160309-1913.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.eclipse.osgi.storage.FrameworkExtensionInstaller
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Generating metadata for ..
Status ERROR: this code=0 publishing result null children=[Status OK: unknown code=0 OK null Status ERROR: org.eclipse.equinox.p2.publisher.eclipse code=0 An error occurred while publishing bundle /home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/tmp.1698422412337/featureExtract/plugins/org.wso2.micro.integrator.inbound.endpoint-4.2.0.jar: Invalid CEN header (invalid extra data field size for tag: 0xbfef at 242516) java.util.zip.ZipException: Invalid CEN header (invalid extra data field size for tag: 0xbfef at 242516)]
Product publisher application was executed with the following arguments:
-source
/home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/tmp.1698422412337/featureExtract
-metadataRepository
file:/home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/p2-repo
-metadataRepositoryName
micro-integrator-p2-profile
-artifactRepository
file:/home/resoli/Scaricati/wso2/src/micro-integrator-4.2.0/p2-profile/target/p2-repo
-artifactRepositoryName
micro-integrator-p2-profile
-publishArtifacts
-publishArtifactRepository
-compress
-append
[ERROR] P2 publisher return code was 1
org.apache.maven.plugin.MojoFailureException: P2 publisher return code was 1
    at org.wso2.maven.p2.RepositoryGenMojo.generateRepository (RepositoryGenMojo.java:255)
    at org.wso2.maven.p2.RepositoryGenMojo.createRepo (RepositoryGenMojo.java:204)
    at org.wso2.maven.p2.RepositoryGenMojo.execute (RepositoryGenMojo.java:191)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for WSO2 Enterprise Integrator - micro-integrator P2 Profile Generation 4.2.0:
[INFO] 
[INFO] WSO2 Enterprise Integrator - micro-integrator P2 Profile Generation FAILURE [  6.112 s]

No workaround for this atm.

Build is ok with a previous openjdk version, (tested with 11.0.8)

gspadotto commented 8 months ago

@resoli try defining this environment variable before building (the "add-opens" is for JDK17, you might not need it in JDK11):

export JAVA_TOOL_OPTIONS=' -Djdk.util.zip.disableZip64ExtraFieldValidation=true -Djdk.nio.zipfs.allowDotZipEntry=true --add-opens=java.base/java.net=ALL-UNNAMED '

The system properties in JAVA_TOOL_OPTIONS will be passed to all instances of JVM, either used directly by maven or spawned by the p2 plugin:

https://github.com/wso2/maven-tools/blob/v5.1.2/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/RepositoryGenMojo.java#L203

whose latest commit is from 2018, to support Java 10: https://github.com/wso2/maven-tools/commit/5c67180549b21d82d35d2141147184dd48094679

TomasTokaMrazek commented 8 months ago

@gspadotto It's not only that.

This core WSO2 dependency is built with wrong ZIP headers. It needs to be fixed on WSO2 side. org.wso2.ei:org.wso2.micro.integrator.inbound.endpoint:4.2.0

This leads to behaviouor, where if I want to develop my custom inbound endpoint, I am not able to reference and import classes from this jar, becuase the whole IDE would have to be run with JAVA_TOOL_OPTIONS. And IDEA does not like that.

There might be more libraries like that, I haven't checked that.