【发布时间】:2014-11-26 07:34:49
【问题描述】:
我有一个部署在 Websphere 8.5 上的应用程序,类加载配置为“Parent Last”。在应用程序中,我们使用GroovyScriptEngine 来运行一个 groovy 脚本文件。
在这个 groovy 脚本文件中,我们使用:
Thread.currentThread().getContextClassLoader().addURL( new URL("file:/test/ojdbc6.jar"))
加载外部 jar 文件。但它会导致错误:
groovy.lang.MissingMethodException: No signature of method: com.ibm.ws.classloader.CompoundClassLoader.addURL() is applicable for argument types: (java.net.URL) values: file:/test/ojdbc6.jar
我需要提到两件事:
- 相同的应用程序和 groovy 在 tomcat 上运行良好
- 如果我将 groovy 更改为
ClassLoader.systemClassLoader.addURL(new URL("file:/test/ojdbc6.jar")),那么它在 Websphere 和 tomcat 上都可以正常工作
我的问题
- 此错误是否与 Websphere 上的“上一个父级”设置有关?为什么?
- 为什么系统类加载器工作正常?
【问题讨论】:
标签: groovy websphere classloader