DOM4J线程挂起信息
"MyService.91" prio=10 tid=0x00002aab4034b000 nid=0x4df4 waiting for monitor entry [0x00002aab3fddb000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.zip.ZipFile.getEntry(ZipFile.java:147)
- waiting to lock <0x00002aaab9505aa8> (a java.util.jar.JarFile)
at java.util.jar.JarFile.getEntry(JarFile.java:206)
at java.util.jar.JarFile.getJarEntry(JarFile.java:189)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:754)
at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:732)
at sun.misc.URLClassPath.findResource(URLClassPath.java:145)
at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
at java.lang.ClassLoader.getResource(ClassLoader.java:958)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1148)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
at org.dom4j.io.JAXPHelper.createXMLReader(JAXPHelper.java:50)
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)
参照http://tech.ddvip.com/2009-09/1253614257133975.html避免了getEntry锁的问题,但是又出现新的Blocked
"servce-30" prio=10 tid=0x00002aab41afe000 nid=0xbc8 waiting for monitor entry [0x000000004b0b6000]
java.lang.Thread.State: BLOCKED (on object monitor)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:293)
- waiting to lock <0x00002aaabb244290> (a sun.misc.Launcher$AppClassLoader)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:111)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:146)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:187)
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:128)
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.io.SAXReader.read(SAXReader.java:365)
最终解决方案是org.dom4j.io.JAXPHelper的方法
public static XMLReader createXMLReader(boolean validating,
boolean namespaceAware) throws Exception {
//SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParserFactory factory = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
factory.setValidating(validating);
factory.setNamespaceAware(namespaceAware);
SAXParser parser = factory.newSAXParser();
return parser.getXMLReader();
}
public static org.w3c.dom.Document createDocument(boolean validating,
boolean namespaceAware) throws Exception {
//DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilderFactory factory = new org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
()
factory.setValidating(validating);
factory.setNamespaceAware(namespaceAware);
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.newDocument();
}
LOG4J线程挂起信息
"MyService.76" prio=10 tid=0x00002aab40ebf000 nid=0x4d52 waiting for monitor entry [0x000000007a60c000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:201)
- waiting to lock <0x00002aaabd724fd0> (a org.apache.log4j.Logger)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.info(Category.java:663)
dbcp线程挂起信息
"MyService-85" prio=10 tid=0x00002aab39af3000 nid=0x68a4 waiting for monitor entry [0x000000005a444000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
- waiting to lock <0x00002aaaba871308> (a org.apache.commons.dbcp.PoolableConnectionFactory)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)