示例项目上的Open Liberty Log Configuration异常

时间:2018-10-25 03:00:20

标签: java maven java-ee open-liberty

我正在尝试开始在Fedora 28上运行OpenLiberty java服务器,但无法从OpenLiberty主页启动示例应用程序。
说明说:

git clone https://github.com/OpenLiberty/sample-getting-started.git 
cd sample-getting-started 
mvn clean package liberty:run-server

运行服务器时,出现此错误,构建失败:

Caused by: org.apache.commons.logging.LogConfigurationException: 
User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable.

我尝试清除Maven缓存并执行另一个mvn install,但这仍然无济于事。这个项目可以在我的Macbook上正常工作。有任何解决方法的想法吗?

其他日志:

这是我运行mvn clean package liberty:run-server后得到的内容的简化版本

[WARNING] Error injecting: org.apache.maven.wagon.providers.http.HttpWagon$__sisu21                                                                                                                                                                                                                                         
java.lang.ExceptionInInitializerError                                                                                                                                                                                                                                                                                       
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit> (SSLConnectionSocketFactory.java:146)                                                                                                                                                                                                                   
at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.createConnManager (AbstractHttpClientWagon.java:347)                                                                                                                                                                                                      
at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.<clinit> (AbstractHttpClientWagon.java:273)
...
Caused by: org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable.                                                                                                                                        
at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation (LogFactoryImpl.java:804)                                                                                                                                                                                                                   
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance (LogFactoryImpl.java:541)                                                                                                                                                                                                                                 
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance (LogFactoryImpl.java:292)                                                                                                                                                                                                                                 
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance (LogFactoryImpl.java:269)     

...                                                

[INFO] ------------------------------------------------------------------------                                                                                                                                                                                                                                             
[INFO] BUILD FAILURE                                                                                                                                                                                                                                                                                                        
[INFO] ------------------------------------------------------------------------                                                                                                                                                                                                                                             
[INFO] Total time: 1.941 s                                                                                                                                                                                                                                                                                                  
[INFO] Finished at: 2018-10-29T09:22:12-07:00                                                                                                                                                                                                                                                                               
[INFO] Final Memory: 18M/185M                                                                                                                                                                                                                                                                                               
[INFO] ------------------------------------------------------------------------                                                                                                                                                                                                                                             
[ERROR] Failed to execute goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:2.0:install-server (install-liberty) on project io.openliberty.sample.getting.started: Execution install-liberty of goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:2.0:install-server failed: An API incompatibility was encountered while executing net.wasdev.wlp.maven.plugins:liberty-maven-plugin:2.0:install-server: java.lang.ExceptionInInitializerError: null                                                                                                                                                                                         
[ERROR] -----------------------------------------------------                                                                                                                                                                                                                                                               
[ERROR] realm =    plugin>net.wasdev.wlp.maven.plugins:liberty-maven-plugin:2.0                                                                                                                                                                                                                                             
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy                                                                                                                                                                                                                                               
[ERROR] urls[0] = file:/home/jsolum/.m2/repository/net/wasdev/wlp/maven/plugins/liberty-maven-plugin/2.0/liberty-maven-plugin-2.0.jar                                                                                                                                                                                       
[ERROR] urls[1] = file:/home/jsolum/.m2/repository/net/wasdev/wlp/ant/wlp-anttasks/1.3/wlp-anttasks-1.3.jar                                                                                                                                                                                                                 
[ERROR] urls[2] = file:/home/jsolum/.m2/repository/org/apache/ant/ant/1.8.4/ant-1.8.4.jar                                                                                                                                                                                                                                   
[ERROR] urls[3] = file:/home/jsolum/.m2/repository/org/apache/ant/ant-launcher/1.8.4/ant-launcher-1.8.4.jar                                                                                                                                                                                                                 
[ERROR] urls[4] = file:/home/jsolum/.m2/repository/org/codehaus/mojo/plugin-support/1.0-alpha-1/plugin-support-1.0-alpha-1.jar                                                                                                                                                                                              
[ERROR] urls[5] = file:/home/jsolum/.m2/repository/ant/ant/1.6.5/ant-1.6.5.jar                                                                                                                                                                                                                                              
[ERROR] urls[6] = file:/home/jsolum/.m2/repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar                                                                                                                                                                                                                       
[ERROR] urls[7] = file:/home/jsolum/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar                                                                                                                                                                                                          
[ERROR] urls[8] = file:/home/jsolum/.m2/repository/commons-jexl/commons-jexl/1.1/commons-jexl-1.1.jar                                                                                                                                                                                                                       
[ERROR] urls[9] = file:/home/jsolum/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar                                                                                                                                                                                                                                        
[ERROR] urls[10] = file:/home/jsolum/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar                                                                                                                                                                                                         
[ERROR] urls[11] = file:/home/jsolum/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar                                                                                                                                                                                                   
[ERROR] Number of foreign imports: 1                                                                                                                                                                                                                                                                                        
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]                                                                                                                                                                                                                                               
[ERROR]                                                                                                                                                                                                                                                                                                                     
[ERROR] -----------------------------------------------------                                                                                                                                                                                                                                                               
[ERROR] : User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable.                                                                                                                                                                                               
[ERROR] -> [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/PluginContainerException '

Java版本:

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

更新

删除~/.m2/log4j后出现此错误:

Downloading from central: https://repo.maven.apache.org/maven2/io/openliberty/openliberty-runtime/maven-metadata.xml                                                                                                                                                                                                         
[WARNING] Could not transfer metadata io.openliberty:openliberty-runtime/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable. 

4 个答案:

答案 0 :(得分:2)

我也遇到过这个问题。

最后,结果证明是由 opensuses 提供的 maven 版本造成的,或者可能是我选择的插件随它安装。

切换到官方 Maven 二进制文件后,问题消失了。

答案 1 :(得分:1)

对于 OpenSUSE,按照 Filip Paczyński 所说的去做。切换到 maven 的官方版本。

缺少 OS maven 发行版(当前为 3.6.3)中的某些内容。正式发布后一切正常。我安装了最新的 3.8.1,但可能使用旧版本也可以。跳过操作系统之一。

PS:遗憾的是,我还没有对 Filip 的回答发表评论的声誉。所以...抱歉扩大页面。

答案 2 :(得分:0)

尝试将插件依赖项添加到wagon-http:

<dependencies>
    <dependency>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-http</artifactId>
        <version>3.2.0</version>
    </dependency>
</dependencies>

在多模块项目中,我和您有相同的错误,看来错误User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable并不是问题本身,而是插件尝试记录问题时的第二个错误。

直接在模块中运行插件,我会收到此错误:[WARNING] Error injecting: org.apache.maven.wagon.providers.http.HttpWagon java.lang.ExceptionInInitializerError

您在堆栈跟踪中有一个类似的错误,因此将依赖项添加到wagon-http中为我修复了此问题。

这是我的Maven + Java配置:

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: C:\Users\Public\Apps\Maven\apache-maven-3.6.0
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_121\jre
Default locale: en_CA, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

答案 3 :(得分:0)

今天在使用版本的虚拟机上点击:Apache Maven 3.5.4 (Red Hat 3.5.4-5)。升级到Maven 3.6.3,问题解决。