关于weblogic中使用Dom4j、Xerces导致执行线程挂起的问题
时间:2010-12-25 BlogJava 走走停停又三年
这两天有客户跟我说了个问题,说他们发现weblogic不停的load class,最后线程都挂在了Zip Entry操作上。让他们做了thread dump, 开始以为跟JDK的IO性能有关系,因为我曾经在HP\AIX上都碰到过线程挂起在zip操作上的问题,最终客户通过调整OS参数后,问题得到解决。但在拿到thread dump后, 发现问题不是他们说的那样,thread trace如下:
"ExecuteThread: ''6'' for queue: ''Out.Thread Pool''" daemon prio=5 tid=0005ff90 nid=54 lwp_id=1885955 waiting for monitor entry [0x239fa000..0x239f94f0]
at java.util.zip.ZipFile.getEntry(ZipFile.java:161)
- waiting to lock <35da8e78> (a sun.net.www.protocol.jar.URLJarFile)
at java.util.jar.JarFile.getEntry(JarFile.java:194)
at sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:89)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:95)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:107)
at java.net.URL.openStream(URL.java:913)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:997)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:160)
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:87)
at org.dom4j.io.JAXPHelper.createXMLReader(JAXPHelper.java:46)
at org.dom4j.io.SAXHelper.createXMLReaderViaJAXP(SAXHelper.java:125)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:78)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
at org.dom4j.io.SAXReader.read(SAXReader.java:435)
at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278)
......
我们可以看看SAXParserFactory.newInstance()的实现,
1 public static SAXParserFactory newInstance()
2 throws FactoryConfigurationError
3 {
4 try
5 {
6 return (SAXParserFactory)FactoryFinder.find("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");
7 }
8 catch(FactoryFinder.ConfigurationError configurationerror)
9 {
10 throw new FactoryConfigurationError(configurationerror.getException(), configurationerror.getMessage());
11 }
12 }
購噐weblogic嶄聞喘Dom4j、Xerces擬崑峇佩?殻航軟議諒籾(2)
扮寂:2010-12-25 BlogJava 恠恠唯唯嗽眉定
壅栖心心FactoryFinder.find()議糞??
1 static Object find(String s, String s1)
2 throws ConfigurationError
3 {
4 debugPrintln("debug is on");
5 ClassLoader classloader = findClassLoader();
6 try
7 {
8 String s2 = System.getProperty(s);
9 if(s2 != null)
10 {
11
|