Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database creation failed for apache project log4j #103

Open
johninclub opened this issue Dec 23, 2021 · 5 comments
Open

database creation failed for apache project log4j #103

johninclub opened this issue Dec 23, 2021 · 5 comments
Labels

Comments

@johninclub
Copy link

johninclub commented Dec 23, 2021

source code: apache-log4j-2.12.3 download from https://downloads.apache.org/logging/log4j/
os: ubuntu-20.04
maven: Apache Maven 3.6.3
codeql: 2.7.3

I can successfully build log4j without any problems with "mvn package -DskipTests ", but when I tried to create a codeql database with "codeql database create log4j.db -c "mvn package -X -DskipTests", I got the following error messages:

[2021-12-23 11:35:26] [build-stdout] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project log4j-api-java9: Compilation failure -> [Help 1]
[2021-12-23 11:35:26] [build-stdout] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project log4j-api-java9: Compilation failure
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[2021-12-23 11:35:26] [build-stdout]     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[2021-12-23 11:35:26] [build-stdout]     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[2021-12-23 11:35:26] [build-stdout]     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[2021-12-23 11:35:26] [build-stdout]     at java.lang.reflect.Method.invoke (Method.java:498)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[2021-12-23 11:35:26] [build-stdout] Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1224)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[2021-12-23 11:35:26] [build-stdout]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[2021-12-23 11:35:26] [build-stdout]     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[2021-12-23 11:35:26] [build-stdout]     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[2021-12-23 11:35:26] [build-stdout]     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[2021-12-23 11:35:26] [build-stdout]     at java.lang.reflect.Method.invoke (Method.java:498)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[2021-12-23 11:35:26] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[2021-12-23 11:35:26] [build-stdout] [ERROR] 
[2021-12-23 11:35:26] [build-stdout] [ERROR] 
[2021-12-23 11:35:26] [build-stdout] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[2021-12-23 11:35:26] [build-stdout] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[2021-12-23 11:35:26] [build-stdout] [ERROR] 
[2021-12-23 11:35:26] [build-stdout] [ERROR] After correcting the problems, you can resume the build with the command
[2021-12-23 11:35:26] [build-stdout] [ERROR]   mvn <args> -rf :log4j-api-java9
[2021-12-23 11:35:26] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/home/john/tools/codeql/codeql/tools/linux64/preload_tracer, mvn, package, -X, -DskipTests])
A fatal error occurred: Exit status 1 from command: [mvn, package, -X, -DskipTests]
@github-actions github-actions bot added the CLI label Dec 23, 2021
@edoardopirovano
Copy link
Contributor

Greetings! Thanks for reaching out to us with this issue. I note that your command codeql database create log4j.db -c "mvn package -X -DskipTests" is building the CodeQL database inside the same directory that the project is being built in. I've observed this confusing Maven and causing builds to fail before. This may not be what's happening here, but just to rule this out, could I get you to try something like codeql database create ../log4j.db -c "mvn package -X -DskipTests" to place the CodeQL database outside of the project's directory.

If that doesn't resolve your issue, we'll be happy to look into this further for you.

@johninclub
Copy link
Author

Thank you for your reply! Got same error when I tried "codeql database create ../log4j.db -c "mvn package -X -DskipTests".

I think this error should be related to the toolchain plugin used in apache log4j. Here is the toolchain config file from apache log4j

  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the license for the specific language governing permissions and
  ~ limitations under the license.
  -->
<toolchains>
  <!-- JDK toolchains -->
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.7</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-7-openjdk-amd64</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.8</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-8-openjdk-amd64</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>9</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-9-openjdk-amd64</jdkHome>
    </configuration>
  </toolchain>

  <!-- other toolchains -->
</toolchains>

I placed the toolchain config file to ~/.m2/toolchain.xml.

The output when I tried "codeql database create ../log4j.db --language java -c "mvn package -X -DskipTests" " is as below:

2021-12-29 20:35:30] [build-stdout] [INFO] Reactor Summary for Apache Log4j 2 2.12.2:
[2021-12-29 20:35:30] [build-stdout] [INFO] 
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j 2 ..................................... SUCCESS [  1.048 s]
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j API Java 9 support .................... FAILURE [  2.981 s]
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j API ................................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Implementation Java 9 support ......... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Core .................................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Core Integration Tests ................ SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j 1.x Compatibility API ................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j to SLF4J Adapter ...................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j SLF4J Binding ......................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j SLF4J 1.8+ Binding .................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Commons Logging Bridge ................ SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Flume Bridge .......................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Web ................................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Tag Library ........................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j JMX GUI ............................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Samples ............................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Samples: Flume - Common ............... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Samples: Flume - Remote ............... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Samples: Flume - Embedded ............. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Samples: Configuration ................ SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Samples: LoggerProperties ............. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j BOM ................................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j JDBC DBCP 2 ........................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j JPA ................................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j CouchDB ............................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j MongoDB 2 ............................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j MongoDB 3 ............................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Cassandra ............................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4J Performance Tests ..................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Streaming Interface ................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j JUL Adapter ........................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Liquibase Binding ..................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j App Server Support .................... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j OSGi .................................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Docker Library ........................ SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Spring Cloud Config Support ........... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Spring Cloud Config Client Support .... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Log4j Sample Configuration Service ................. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Apache Log4j Spring Cloud Config Samples ........... SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] Spring Cloud Config Sample Application ............. SKIPPED
[2021-12-29 20:35:30] [build-stdout] [INFO] ------------------------------------------------------------------------
[2021-12-29 20:35:30] [build-stdout] [INFO] BUILD FAILURE
[2021-12-29 20:35:30] [build-stdout] [INFO] ------------------------------------------------------------------------
[2021-12-29 20:35:30] [build-stdout] [INFO] Total time:  5.034 s
[2021-12-29 20:35:30] [build-stdout] [INFO] Finished at: 2021-12-29T20:35:30+08:00
[2021-12-29 20:35:30] [build-stdout] [INFO] ------------------------------------------------------------------------
[2021-12-29 20:35:30] [build-stdout] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project log4j-api-java9: Compilation failure -> [Help 1]
[2021-12-29 20:35:30] [build-stdout] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project log4j-api-java9: Compilation failure
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[2021-12-29 20:35:30] [build-stdout]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[2021-12-29 20:35:30] [build-stdout]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[2021-12-29 20:35:30] [build-stdout]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[2021-12-29 20:35:30] [build-stdout]     at java.lang.reflect.Method.invoke (Method.java:566)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[2021-12-29 20:35:30] [build-stdout] Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1224)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[2021-12-29 20:35:30] [build-stdout]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[2021-12-29 20:35:30] [build-stdout]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[2021-12-29 20:35:30] [build-stdout]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[2021-12-29 20:35:30] [build-stdout]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[2021-12-29 20:35:30] [build-stdout]     at java.lang.reflect.Method.invoke (Method.java:566)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[2021-12-29 20:35:30] [build-stdout]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[2021-12-29 20:35:30] [build-stdout] [ERROR] 
[2021-12-29 20:35:30] [build-stdout] [ERROR] 
[2021-12-29 20:35:30] [build-stdout] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[2021-12-29 20:35:30] [build-stdout] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[2021-12-29 20:35:30] [build-stdout] [ERROR] 
[2021-12-29 20:35:30] [build-stdout] [ERROR] After correcting the problems, you can resume the build with the command
[2021-12-29 20:35:30] [build-stdout] [ERROR]   mvn <args> -rf :log4j-api-java9
[2021-12-29 20:35:30] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/home/john/tools/codeql/codeql/tools/linux64/preload_tracer, mvn, package, -X, -DskipTests])
A fatal error occurred: Exit status 1 from command: [mvn, package, -X, -DskipTests]

As you may see, the first module "Apache Log4j 2" compiled by JDK8 is OK, while the second module "Apache Log4j API Java 9 support" compiled by JDK9 encounters a failure.

@edoardopirovano
Copy link
Contributor

edoardopirovano commented Dec 29, 2021

Greetings once again, thank you for trying that out for providing this additional information. I've tried to reproduce this issue locally but could not - on my machine, everything seems to work fine. For what it's worth, my toolchains.xml looks like this:

<toolchains>
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.8</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-8-openjdk-amd64</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>9</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/home/edoardo/jvms/jdk-9.0.4</jdkHome>
    </configuration>
  </toolchain>
</toolchains>

where the JDK in /usr/lib/jvm/java-8-openjdk-amd64 is the one from the Ubuntu 20.04 package openjdk-8-jdk and the JDK in /home/edoardo/jvms/jdk-9.0.4 was downloaded from https://jdk.java.net/archive/ as Java 9 is out of support and no longer available via the default Ubuntu PPAs (but is required for this build).

The java and javac on my PATH both point to the ones in /usr/lib/jvm/java-8-openjdk-amd64, and I also have the environment variable JAVA_HOME pointing there. The command I ran was codeql database create log4j.db -c "mvn package -X -DskipTests" -l java. Here are logs from my run and the DB produced:

I'm not quite sure why things aren't working for you, and investigating this further is getting beyond my area of expertise (I work on the general parts of the CodeQL CLI rather than the language-specific extractors). Perhaps someone from @github/codeql-java might be able to suggest what may be going wrong for you.

@johninclub
Copy link
Author

Thank you for your reply. I followed your setting, and now I can successfully create database. I think the problem might be related to the differences between adoptopenjdk and oracle jdk. The version information of the old jdk9 I used is

openjdk 9.0.4-adoptopenjdk
OpenJDK Runtime Environment (build 9.0.4-adoptopenjdk+12)
Eclipse OpenJ9 VM (build openj9-0.9.0, JRE 9 Linux amd64-64-Bit Compressed References 20180814_248 (JIT enabled, AOT enabled)
OpenJ9   - 24e53631
OMR      - fad6bf6e
JCL      - feec4d2ae based on jdk-9.0.4+12)

The version information of the new jdk9 is

openjdk 9.0.4
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)


@edoardopirovano
Copy link
Contributor

Interesting, glad it's working for you now and thank you for the additional information. I'll keep this issue open so we can further investigate what was going wrong before once the Java team are back from the holidays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants