Quantcast

tomcat thread BLOCKED when creating SqlSessionFactoryBean

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

tomcat thread BLOCKED when creating SqlSessionFactoryBean

Ming G
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Ming G
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Iwao AVE!
Hi Ming,

It seems more like a Tomcat issue.
There is a similar report on their tracker.

Regards,
Iwao


2017-02-20 12:44 GMT+09:00 Ming G <[hidden email]>:
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Ming G
Thanks for the link.
I tried tomcat 7, it just does not do any better.
Is there any workaround?

在 2017年2月20日星期一 UTC+8下午8:19:05,Iwao AVE!写道:
Hi Ming,

It seems more like a Tomcat issue.
There is a similar report on their tracker.
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56530" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=56530

Regards,
Iwao


2017-02-20 12:44 GMT+09:00 Ming G <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ru6S7O17CAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">albert....@...>:
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="ru6S7O17CAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Ming G
BTW, my tomcat is running on JDK7u79

在 2017年2月21日星期二 UTC+8上午11:15:44,Ming G写道:
Thanks for the link.
I tried tomcat 7, it just does not do any better.
Is there any workaround?

在 2017年2月20日星期一 UTC+8下午8:19:05,Iwao AVE!写道:
Hi Ming,

It seems more like a Tomcat issue.
There is a similar report on their tracker.
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56530" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=56530

Regards,
Iwao


2017-02-20 12:44 GMT+09:00 Ming G <[hidden email]>:
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Iwao AVE!
Did you configure the loader as instructed?

Also, be sure to use a recent version as it was added in 7.0.65.

If you need further assistance, it would be better to ask it on Tomcat mailing list.


2017-02-21 12:18 GMT+09:00 Ming G <[hidden email]>:
BTW, my tomcat is running on JDK7u79

在 2017年2月21日星期二 UTC+8上午11:15:44,Ming G写道:
Thanks for the link.
I tried tomcat 7, it just does not do any better.
Is there any workaround?

在 2017年2月20日星期一 UTC+8下午8:19:05,Iwao AVE!写道:
Hi Ming,

It seems more like a Tomcat issue.
There is a similar report on their tracker.

Regards,
Iwao


2017-02-20 12:44 GMT+09:00 Ming G <[hidden email]>:
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]om.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Ming G
my webapp is running on tomcat8.5, I tried both jdk7 and jdk8, and specified parallel class loader, problem is still there.


在 2017年2月21日星期二 UTC+8上午11:49:11,Iwao AVE!写道:
Did you configure the loader as instructed?
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56530#c8" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530%23c8\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8DOTkRQXdbXEtnTJUKs0ze-vyVA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530%23c8\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8DOTkRQXdbXEtnTJUKs0ze-vyVA&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=56530#c8
<a href="https://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#Standard_Implementation" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftomcat.apache.org%2Ftomcat-7.0-doc%2Fconfig%2Floader.html%23Standard_Implementation\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHqz-3-n2MYheoUERRbDM9iCB89Hg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftomcat.apache.org%2Ftomcat-7.0-doc%2Fconfig%2Floader.html%23Standard_Implementation\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHqz-3-n2MYheoUERRbDM9iCB89Hg&#39;;return true;">https://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#Standard_Implementation

Also, be sure to use a recent version as it was added in 7.0.65.
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=57681" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D57681\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHt3fmlkYe7rXhCOxu2E-7fOUGYNQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D57681\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHt3fmlkYe7rXhCOxu2E-7fOUGYNQ&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=57681

If you need further assistance, it would be better to ask it on Tomcat mailing list.
<a href="http://tomcat.apache.org/lists.html#tomcat-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftomcat.apache.org%2Flists.html%23tomcat-users\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWmllY7VRm7dPzAjXNri4d9ntZZA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftomcat.apache.org%2Flists.html%23tomcat-users\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWmllY7VRm7dPzAjXNri4d9ntZZA&#39;;return true;">http://tomcat.apache.org/lists.html#tomcat-users


2017-02-21 12:18 GMT+09:00 Ming G <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="cN1xXa-uCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">albert....@...>:
BTW, my tomcat is running on JDK7u79

在 2017年2月21日星期二 UTC+8上午11:15:44,Ming G写道:
Thanks for the link.
I tried tomcat 7, it just does not do any better.
Is there any workaround?

在 2017年2月20日星期一 UTC+8下午8:19:05,Iwao AVE!写道:
Hi Ming,

It seems more like a Tomcat issue.
There is a similar report on their tracker.
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56530" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=56530

Regards,
Iwao


2017-02-20 12:44 GMT+09:00 Ming G <[hidden email]>:
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="cN1xXa-uCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tomcat thread BLOCKED when creating SqlSessionFactoryBean

Ming G

after hours of inspection,  found out that is caused by the incorrect mybatis config.

在 2017年2月21日星期二 UTC+8下午12:11:42,Ming G写道:
my webapp is running on tomcat8.5, I tried both jdk7 and jdk8, and specified parallel class loader, problem is still there.


在 2017年2月21日星期二 UTC+8上午11:49:11,Iwao AVE!写道:
Did you configure the loader as instructed?
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56530#c8" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530%23c8\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8DOTkRQXdbXEtnTJUKs0ze-vyVA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530%23c8\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE8DOTkRQXdbXEtnTJUKs0ze-vyVA&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=56530#c8
<a href="https://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#Standard_Implementation" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftomcat.apache.org%2Ftomcat-7.0-doc%2Fconfig%2Floader.html%23Standard_Implementation\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHqz-3-n2MYheoUERRbDM9iCB89Hg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftomcat.apache.org%2Ftomcat-7.0-doc%2Fconfig%2Floader.html%23Standard_Implementation\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHqz-3-n2MYheoUERRbDM9iCB89Hg&#39;;return true;">https://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#Standard_Implementation

Also, be sure to use a recent version as it was added in 7.0.65.
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=57681" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D57681\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHt3fmlkYe7rXhCOxu2E-7fOUGYNQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D57681\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHt3fmlkYe7rXhCOxu2E-7fOUGYNQ&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=57681

If you need further assistance, it would be better to ask it on Tomcat mailing list.
<a href="http://tomcat.apache.org/lists.html#tomcat-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftomcat.apache.org%2Flists.html%23tomcat-users\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWmllY7VRm7dPzAjXNri4d9ntZZA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftomcat.apache.org%2Flists.html%23tomcat-users\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWmllY7VRm7dPzAjXNri4d9ntZZA&#39;;return true;">http://tomcat.apache.org/lists.html#tomcat-users


2017-02-21 12:18 GMT+09:00 Ming G <[hidden email]>:
BTW, my tomcat is running on JDK7u79

在 2017年2月21日星期二 UTC+8上午11:15:44,Ming G写道:
Thanks for the link.
I tried tomcat 7, it just does not do any better.
Is there any workaround?

在 2017年2月20日星期一 UTC+8下午8:19:05,Iwao AVE!写道:
Hi Ming,

It seems more like a Tomcat issue.
There is a similar report on their tracker.
<a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56530" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbz.apache.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D56530\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGrbnz8NkdtFoqXdiHQyJEQUD6LTQ&#39;;return true;">https://bz.apache.org/bugzilla/show_bug.cgi?id=56530

Regards,
Iwao


2017-02-20 12:44 GMT+09:00 Ming G <[hidden email]>:
Here is who locks the object.
"http-nio-exec-542" #797 daemon prio=5 os_prio=0 tid=0x00007fef3c225000 nid=0x6ca7 runnable [0x00007fef2d08e000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
        at java.lang.StringBuilder.<init>(StringBuilder.java:101)
        at org.apache.catalina.loader.WebappClassLoaderBase.binaryNameToPath(WebappClassLoaderBase.java:2285)
        at org.apache.catalina.loader.WebappClassLoaderBase.findLoadedClass0(WebappClassLoaderBase.java:2343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1161)
        - locked <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

在 2017年2月20日星期一 UTC+8上午11:41:38,Ming G写道:
The project is converted from iBatis to MyBatis, it works well with iBatis. When deployed in tomcat with MyBatis,  after seconds, the problem rises. it takes more time for tomcat 
to process requests from nginx.
I take a stack trace log, it looks like some threads are blocked when creating new SqlSessionFactoryBean.
Any clue would be appreciated.

Here is the jstack output.
"http-nio-exec-1" #29 daemon prio=5 os_prio=0 tid=0x00007fef40002000 nid=0x6796 waiting for monitor entry [0x00007fefafa9b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1152)
        - waiting to lock <0x00000006e7b0a2d8> (a java.lang.Object)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
        at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:506)
        at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:217)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)
        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)
        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.<init>(XPathContext.java:100)
        at org.apache.xpath.jaxp.XPathImpl.eval(XPathImpl.java:201)
        at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
        at org.apache.ibatis.parsing.XPathParser.evaluate(XPathParser.java:222)
        at org.apache.ibatis.parsing.XPathParser.evalNode(XPathParser.java:213)
        at org.apache.ibatis.parsing.XNode.evalNode(XNode.java:116)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
        at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:322)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:107)
        at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:92)
        at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:428)
        at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.event.AbstractApplicationEventMulticaster$ListenerRetriever.getApplicationListeners(AbstractApplicationEventMulticaster.java:246)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:135)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
        at <a href="http://org.springframework.context.su" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.springframework.context.su\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEu4wSJjujehNkeo0Q0CwVO3BStAg&#39;;return true;">org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
        at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1036)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:971)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...