Classloader中的本地类路径消失了吗?

时间:2015-05-26 22:08:06

标签: java websphere classloader

我在WebService的类中有以下代码:

try { 
    master = PropertyResourceBundle.getBundle(filename, Locale.getDefault(), classLoader);
} catch (MissingResourceException e) { 
    /*logs error*/ 
    throw new PropertyException(e);
}

第一次执行时效果很好。后来,我启动了一个(Java)计时器来重新初始化应用程序中的属性,并再次调用此代码。然后它失败了,说它找不到文件。

我注意到,对于CompoundClassLoader,显然是toString()的一部分的“Local Classpath”在第一种情况下是一个非常长的字符串,而在第二种情况下是一个空字符串。如果没有类路径就无法找到文件,但我不明白为什么“Local Classpath”会发生变化。

有问题的类加载器通过4个例程传递,但它的生命如下:

... MyClassName.class.getClassLoader() ...

这是第一次在CompoundClassLoader上输出toString()(我是从RAD / eclipse中“变量”视图底部的变量值窗口得到的):

com.ibm.ws.classloader.CompoundClassLoader@1fd7f71f[appwar:myService] 
Local ClassPath: D:\Sandboxes\myServices\myService\myServiceWorkspace\ejbServices\build\classes;D:\Sandboxes\myServices\myService\myServiceWorkspace\myServiceWeb\WebContent\WEB-INF\classes;D:\Sandboxes\myServices\myService\myServiceWorkspace\myServiceWeb\WebContent;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-logging-1.1.1.jar;D:\Sandboxes\myServices\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\dao;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-lang3-3.1.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-pool-1.5.3.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\dataaccess-manager-1.0.0.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\log4j-1.2.15.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\domain\bin;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\local-calendar-1.1.2.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\ourCommon.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\reference-data-1.1.4.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\config-3.2.3.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\utilities-3.0.5.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\componentMediation-5.2.3.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\validator-1.2.0.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\CoreServices.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-beanutils-1.8.0.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-chain-1.2.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-collections-3.1.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-digester-2.0.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-validator-1.3.1.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\locale-manager-1.0.7.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-codec.jar;D:\Sandboxes\myServices\myService\myServiceWorkspace\myService\commons-httpclient.jar 
Parent: com.ibm.ws.classloader.ProtectionClassLoader@adab1a80 
Delegation Mode: PARENT_FIRST

第二次:

com.ibm.ws.classloader.CompoundClassLoader@1fd7f71f[appwar:issnrcServices] 
Local ClassPath:     
Parent: com.ibm.ws.classloader.ProtectionClassLoader@adab1a80    
Delegation Mode: PARENT_FIRST

我猜想EJB环境会以某种方式涉及,但我不知道如何。我调用.class.getClassLoad()的对象的ID在两种情况下都是相同的,为什么不能在第二次找到该包?

0 个答案:

没有答案