wechaty / java-wechaty-getting-started

Java Wechaty Starter Project Template that Works Out-of-the-Box
https://gitpod.io/#https://github.com/wechaty/java-wechaty-getting-started
Apache License 2.0
46 stars 41 forks source link

[ERROR] Failed to execute goal on project wechaty-examples #2

Closed huan closed 4 years ago

huan commented 4 years ago

I got this error message when I running make install:

[ERROR] Failed to execute goal on project wechaty-examples: Could not resolve dependencies for project io.github.wechaty:wechaty-examples:jar:1.0.0-SNAPSOHOT: Failure to find io.wechaty:wechaty:jar:1.0.0-SNAPSOHOT in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

Full log messages:

$ make install
mvn clean install -f examples/pom.xml
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
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
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< io.github.wechaty:wechaty-examples >-----------------
[INFO] Building wechaty-examples 1.0.0-SNAPSOHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for io.wechaty:wechaty:jar:1.0.0-SNAPSOHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.192 s
[INFO] Finished at: 2020-05-21T11:10:02+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project wechaty-examples: Could not resolve dependencies for project io.github.wechaty:wechaty-examples:jar:1.0.0-SNAPSOHOT: Failure to find io.wechaty:wechaty:jar:1.0.0-SNAPSOHOT in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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/DependencyResolutionException
chengaopan commented 4 years ago

[INFO] Scanning for projects... [INFO] [INFO] -----------------< io.github.wechaty:wechaty-examples >----------------- [INFO] Building wechaty-examples 1.0.0-SNAPSOHOT [INFO] --------------------------------[ jar ]--------------------------------- Downloading from mvnrepository: http://www.mvnrepository.com/io/wechaty/wechaty/1.0.0-SNAPSOHOT/wechaty-1.0.0-SNAPSOHOT.pom Downloading from github: https://maven.pkg.github.com/diaozxin007/java-wechaty/io/wechaty/wechaty/1.0.0-SNAPSOHOT/wechaty-1.0.0-SNAPSOHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 19.070 s [INFO] Finished at: 2020-05-22T09:32:43+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project wechaty-examples: Could not resolve dependencies for project io.github.wechaty:wechaty-examples:jar:1.0.0-SNAPSOHOT: Failed to collect dependencies at io.wechaty:wechaty:jar:1.0.0-SNAPSOHOT: Failed to read artifact descriptor for io.wechaty:wechaty:jar:1.0.0-SNAPSOHOT: Could not transfer artifact io.wechaty:wechaty:pom:1.0.0-SNAPSOHOT from/to mvnrepository (http://www.mvnrepository.com/): Transfer failed for http://www.mvnrepository.com/io/wechaty/wechaty/1.0.0-SNAPSOHOT/wechaty-1.0.0-SNAPSOHOT.pom 503 Service Temporarily Unavailable -> [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/DependencyResolutionException

huan commented 4 years ago

I got the following error message after merged #4:

[INFO] --- maven-install-plugin:2.4:install (default-install) @ wechaty-examples ---
[INFO] Installing /home/huan/chatie/java-wechaty-getting-started/examples/target/wechaty-examples-1.0.0-SNAPSHOT.jar to /home/huan/.m2/repository/io/github/wechaty/wechaty-examples/1.0.0-SNAPSHOT/wechaty-examples-1.0.0-SNAPSHOT.jar
[INFO] Installing /home/huan/chatie/java-wechaty-getting-started/examples/pom.xml to /home/huan/.m2/repository/io/github/wechaty/wechaty-examples/1.0.0-SNAPSHOT/wechaty-examples-1.0.0-SNAPSHOT.pom
[INFO] Installing /home/huan/chatie/java-wechaty-getting-started/examples/target/wechaty-examples-1.0.0-SNAPSHOT-jar-with-dependencies.jar to /home/huan/.m2/repository/io/github/wechaty/wechaty-examples/1.0.0-SNAPSHOT/wechaty-examples-1.0.0-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.122 s
[INFO] Finished at: 2020-05-22T12:08:12+08:00
[INFO] ------------------------------------------------------------------------
(base) ┌ huan@huan-home:~/chatie/java-wechaty-getting-started [12:08:12] tty:[0] jobs:[0]
└ {master} $ make bot
java -jar examples/target/wechaty-examples-1.0.0-SNAPSHOT-jar-with-dependencies.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/StackLocator$FqcnCallerLocator
    at org.apache.logging.log4j.util.StackLocator.<clinit>(StackLocator.java:37)
    at org.apache.logging.log4j.util.StackLocatorUtil.<clinit>(StackLocatorUtil.java:33)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:44)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at io.github.wechaty.eventEmitter.EventEmitter.<clinit>(EventEmitter.kt:119)
    at io.github.wechaty.DingDongBot.main(DingDongBot.java:21)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.StackLocator$FqcnCallerLocator
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 9 more
make: *** [Makefile:10: bot] Error 1
diaozxin007 commented 4 years ago

https://stackoverflow.com/questions/52700803/im-getting-noclassdeffounderror-org-apache-logging-log4j-util-reflectionutil

May be you should make sure the log4j2 version in your ~/.m2 folder higher then 2.9

huan commented 4 years ago

Thanks! I'll check it and try to make it work later.

BTW: My environment should be very clean and fresh, because I have never run any Java build before.

diaozxin007 commented 4 years ago

plz provide mvn and jvm version

mvn -version
java -version
huan commented 4 years ago

I tried the latest master branch code today, it still the same error message:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/StackLocator$FqcnCallerLocator

My mvn and jvm version:

$ mvn -version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 14.0.1, vendor: Private Build, runtime: /usr/lib/jvm/java-14-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-29-generic", arch: "amd64", family: "unix"

$ java -version
openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+7-Ubuntu-1ubuntu1)
OpenJDK 64-Bit Server VM (build 14.0.1+7-Ubuntu-1ubuntu1, mixed mode, sharing)
diaozxin007 commented 4 years ago

may be the reason is jdk version 14,plz try jdk 8.

huan commented 4 years ago

MacBook Pro:

$ mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"

$ mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"
┌ huan@Huans-MacBook-Pro.local:~/chatie/java-wechaty-getting-started [18:25:54] tty:[ttys003] jobs:[0]
└ (master) $ java -version
openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
$ make bot
java -jar examples/target/wechaty-examples-1.0.0-SNAPSHOT-jar-with-dependencies.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/StackLocator$FqcnCallerLocator
    at org.apache.logging.log4j.util.StackLocator.<clinit>(StackLocator.java:37)
    at org.apache.logging.log4j.util.StackLocatorUtil.<clinit>(StackLocatorUtil.java:33)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:44)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at io.github.wechaty.eventEmitter.EventEmitter.<clinit>(EventEmitter.kt:119)
    at io.github.wechaty.DingDongBot.main(DingDongBot.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.StackLocator$FqcnCallerLocator
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 9 more
make: *** [bot] Error 1
diaozxin007 commented 4 years ago

plz

 mvn dependency:tree
huan commented 4 years ago

Fixed! Thank you @diaozxin007 so much for the fixing!