[JBoss JIRA] Created: (JBPM-2908) Creating JbpmConfiguration with a different jbpm.cfg.xml in an action handler causes StackOverflowError
by Toshiya Kobayashi (JIRA)
Creating JbpmConfiguration with a different jbpm.cfg.xml in an action handler causes StackOverflowError
-------------------------------------------------------------------------------------------------------
Key: JBPM-2908
URL: https://jira.jboss.org/browse/JBPM-2908
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 3.2.9
Environment: SOA-P 4.3.0 CP04
Reporter: Toshiya Kobayashi
I tried to switch jbpm.cfg.xml (= create JbpmConfiguration with a different jbpm.cfg.xml) and start a process instance in my action handler.
Client:
1. Create a JbpmConfiguration with "jbpm.1.cfg.xml"
2. Create a JbpmContext with the JbpmConfiguration(jbpm.1.cfg.xml)
3. Create and start a process instance
Action handler of the process:
4. Create JbpmConfiguration instance with "jbpm.2.cfg.xml"
5. Create a JbpmContext with the JbpmConfiguration(jbpm.2.cfg.xml)
6. jbpmContext.getGraphSession() causes infinite loop and ends up with StackOverFlowError
Caused by: java.lang.StackOverflowError
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:210)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
at org.apache.log4j.Category.callAppenders(Category.java:203)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.log(Category.java:853)
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.commons.logging.impl.Log4jProxy.log(Log4jProxy.java:311)
at org.apache.commons.logging.impl.Log4jProxy.info(Log4jProxy.java:273)
at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:150)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1432)
at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:89)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:69)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:97)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:330)
at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:618)
at org.jbpm.instantiation.ProcessClassLoader.getProcessDefinition(ProcessClassLoader.java:57)
at org.jbpm.instantiation.ProcessClassLoader.findResource(ProcessClassLoader.java:63)
at java.lang.ClassLoader.getResource(ClassLoader.java:958)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1148)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:51)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:187)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:150)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
at org.dom4j.io.SAXReader.read(SAXReader.java:435)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1490)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:89)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:69)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:97)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:330)
at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:618)
...
How to reproduce:
- Start SOA-P 4.3 CP04
- download and unzip reproducer.zip
- copy jbpm.1.cfg.xml and jbpm.2.cfg.xml to <SOA_HOME>/jbossas/server/<config>/deploy/jbpm.esb
- cd ProcessDefinitions
- modify build.properties
- ant deploypar
- cd ..
- cd ProcessCallWS
- modify build.properties
- ant deploy
- ant run
# jbpm.1.cfg.xml and jbpm.2.cfg.xml have same contents as this is a test reproducer
Analysis:
As the context classloader is ProcessClassLoader in action handler execution, JbpmContext.getGraphSession() -> org.hibernate.cfg.Configuration.configure() let ProcessClassLoader find resources, but ProcessClassLoader invokes JbpmContext.getGraphSession() recursively.
Once DbPersistenceServiceFactory builds SessionFactory, the loop won't happen.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira