开发学院软件开发Java 关于weblogic中使用Dom4j、Xerces导致执行线程挂起... 阅读

关于weblogic中使用Dom4j、Xerces导致执行线程挂起的问题

 2009-09-22 00:00:00 来源:WEB开发网   
核心提示: 其实在上面的分析中可以看到,前三项中都没有找到parser factory, 那我们只能在当前class loader中去查找,关于weblogic中使用Dom4j、Xerces导致执行线程挂起的问题(4),并创建instance,因为你的应用部署在weblogic上, weblogic的cla

其实在上面的分析中可以看到,前三项中都没有找到parser factory, 那我们只能在当前class loader中去查找,并创建instance。因为你的应用部署在weblogic上, weblogic的classloader机制是,所有的应用class loader都继承于weblogic application class loader, 所以你会看到weblogic class loader在trace中。但为什么不停的在class loader呢?其实看看JDK文档,并看看JDK的实现就能知道,

protected Class<?> loadClass(String name, 
boolean resolve) 
throws ClassNotFoundException

Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:

Invoke findLoadedClass(String) to check if the class has already been loaded.

Invoke the loadClass method on the parent class loader. If the parent is null the class loader built-in to the virtual machine is used, instead.

Invoke the findClass(String) method to find the class.

If the class was found using the above steps, and the resolve flag is true, this method will then invoke the resolveClass(Class) method on the resulting Class object.

 1     protected synchronized Class loadClass(String name, boolean resolve)
 2     throws ClassNotFoundException
 3     {
 4     // First, check if the class has already been loaded
 5     Class c = findLoadedClass(name);
 6     if (c == null) {
 7         try {
 8         if (parent != null) {
 9             c = parent.loadClass(name, false);
10         } else {
11             c = findBootstrapClass0(name);
12         }
13         } catch (ClassNotFoundException e) {
14             // If still not found, then invoke findClass in order
15             // to find the class.
16             c = findClass(name);
17         }
18     }
19     if (resolve) {
20         resolveClass(c);
21     }
22     return c;
23     }

看看,其实能看到loadclass(),并不能说class loader一定在load class,更多的时候,他们是在find loaded class,否则怎么去创建对象?

上一页  1 2 3 4 

Tags:关于 weblogic 使用

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接