我有一个部署在Websphere 8.5上的应用程序,类加载配置为“Parent Last”。
在应用程序中,我们使用GroovyScriptEngine来运行一个groovy脚本文件。
这是groovy脚本:
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.2' )
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
new File('grab.log').delete()
File file = new File('grab.log')
try{
file << '11111\n\n'
def http = new HTTPBuilder('http://www.google.com')
def html = http.get( path : '/search', query : [q:'Groovy'] )
file << html
file << '\n\n22222'
}catch(e){
file << org.apache.commons.lang.exception.ExceptionUtils.getStackTrace(e)
}
JAR成功下载到.groovy / grapes文件夹中,但代码行def http = new HTTPBuilder('http://www.google.com')
导致错误:
org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:159)
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:173)
at groovyx.net.http.HTTPBuilder.createClient(HTTPBuilder.java:858)
at groovyx.net.http.HTTPBuilder.getClient(HTTPBuilder.java:842)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
at groovyx.net.http.HTTPBuilder.get(HTTPBuilder.java:285)
at groovyx.net.http.HTTPBuilder.get(HTTPBuilder.java:255)
at groovyx.net.http.HTTPBuilder$get.call(Unknown Source)
at abc.run(abc.groovy:54)
at groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:551)
at com.mh.test.MHGroovyScriptEngine.runScript(MHGroovyScriptEngine.java:218)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.google.common.util.concurrent.SimpleTimeLimiter$1$1.call(SimpleTimeLimiter.java:104)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:345)
at java.util.concurrent.FutureTask.run(FutureTask.java:177)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.lang.Thread.run(Thread.java:777)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:416)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
... 24 more
Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:412)
... 25 more
我发现Jdk14Logger存在于这两个地方(至少),并且它们都实现了Log
我用谷歌搜索了几个小时并尝试了我找到的解决方案,但它们都不适用于我。
另一件事是同样的事情在tomcat上工作正常。
任何人对此为何会有任何建议或解释?谢谢!
答案 0 :(得分:1)
答案 1 :(得分:0)
当应用程序提供自己的Commons Logging JAR时,此问题在WebSphere上很常见。 WebSphere的出厂版本已修改,与标准Apache版本不兼容。
它的常见修复方法是:
JCL FAQ提供了有关WebSphere问题的更多信息。