Upgrading 6.1.0 to 6.1.1: Could not read IDM Mybatis configuration file


#1

I have a Spring Boot application using 6.1.0 and I thought I’d upgrade it to 6.1.1. I changed the version of flowable-spring-boot-starter-basic and flowable-spring-boot-starter-jpa’s version to 6.1.1 in my pom.

Now I see this on startup:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.flowable.engine.common.api.FlowableException: Could not read IDM Mybatis configuration file
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1634) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:317) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	... 66 common frames omitted
Caused by: org.flowable.engine.common.api.FlowableException: Could not read IDM Mybatis configuration file
	at org.flowable.engine.cfg.AbstractEngineConfigurator.registerCustomMybatisMappings(AbstractEngineConfigurator.java:105) ~[flowable-engine-6.1.1.jar:6.1.1]
	at org.flowable.engine.cfg.AbstractEngineConfigurator.beforeInit(AbstractEngineConfigurator.java:50) ~[flowable-engine-6.1.1.jar:6.1.1]
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.configuratorsBeforeInit(ProcessEngineConfigurationImpl.java:1424) ~[flowable-engine-6.1.1.jar:6.1.1]
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:856) ~[flowable-engine-6.1.1.jar:6.1.1]
	at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:832) ~[flowable-engine-6.1.1.jar:6.1.1]
	at org.flowable.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:68) ~[flowable-spring-6.1.1.jar:6.1.1]
	at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:57) ~[flowable-spring-6.1.1.jar:6.1.1]
	at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32) ~[flowable-spring-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
	... 75 common frames omitted
Caused by: java.net.UnknownHostException: mybatis.org
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ~[na:1.8.0_131]
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_131]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_131]
	at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_131]
	at java.net.Socket.connect(Socket.java:538) ~[na:1.8.0_131]
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[na:1.8.0_131]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[na:1.8.0_131]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[na:1.8.0_131]
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:242) ~[na:1.8.0_131]
	at sun.net.www.http.HttpClient.New(HttpClient.java:339) ~[na:1.8.0_131]
	at sun.net.www.http.HttpClient.New(HttpClient.java:357) ~[na:1.8.0_131]
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202) ~[na:1.8.0_131]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138) ~[na:1.8.0_131]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032) ~[na:1.8.0_131]
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966) ~[na:1.8.0_131]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546) ~[na:1.8.0_131]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) ~[na:1.8.0_131]
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) ~[na:1.8.0_131]
	at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[na:1.8.0_131]
	at org.flowable.engine.cfg.AbstractEngineConfigurator.registerCustomMybatisMappings(AbstractEngineConfigurator.java:98) ~[flowable-engine-6.1.1.jar:6.1.1]
	... 83 common frames omitted

The machine hosting this application does not have internet access (and this cannot change) – is there a way to get around this new network access requirement?

Thanks!


Flowable 6.1.2 released
#2

Sadly … you have hit a bug due to a recent refactoring in how the engines boot up and how they load their Mybatis mapping files (in this case the idm engine/process engine).

A fix for this has been pushed: https://github.com/flowable/flowable-engine/commit/7338015dc8aadc984ff9dd4ad3385b6a7b4ace6f

If you want to run 6.1.1:

If you are not using anything from the IDM engine (users, groups, etc), you can disable the IDM engine by setting the disableIdmEngine property to true. In Spring Boot you’ll probably need a org.flowable.spring.SpringProcessEngineConfiguration.ProcessEngineConfigurationConfigurer bean to do that.

Otherwise it’s a bit trickier: in the same ProcessEngineConfigurationConfigurer bean you’ll need to get the list of configurators via the allConfigurators property and replace the IdmEngineConfigurator with a customized version where the fix of the above commit is applied.


#3

Hi,

We’ve released a new 6.1.2 version to fix the issue you reported.
Thanks for the quick test!

Best regards,

Tijs


#4

Is it compatible with weblogic 11g?

The problem occurred in my weblogic 10.3.5 environment, with JDK 8.
My version is Flowable 6.2.1.
I think the key difference of the stacktrace is
at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:163)

 Caused By: java.net.UnknownHostException: mybatis.org
at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at weblogic.net.http.HttpClient.openServer(HttpClient.java:309)
at weblogic.net.http.HttpClient.openServer(HttpClient.java:425)
at weblogic.net.http.HttpClient.New(HttpClient.java:252)
at weblogic.net.http.HttpURLConnection.getHttpClient(HttpURLConnection.java:204)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:426)
at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:37)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:163)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at org.flowable.engine.common.AbstractEngineConfigurator.registerCustomMybatisMappings(AbstractEngineConfigurator.java:106)

#6

The same problem occured on weblogic 12.1.3, again.
Has Flowable 6.2.1 ever been tested on Weblogic ?

For my issue, I think the EngineConfigurator should be able to customized, allowing users to define his own DocumentBuilderFactory. Is it possible?


#7

Problem Solved By Doing This :wink:

@Bean
public ProcessEngineConfigurationConfigurer processEngineConfigurationConfigurer() {
	return cfg -> {
		cfg.setIdmEngineConfigurator(new WeblogicSpringIdmEngineConfigurator());
	};
}

class WeblogicSpringIdmEngineConfigurator extends SpringIdmEngineConfigurator {
@Override
protected void registerCustomMybatisMappings(AbstractEngineConfiguration engineConfiguration) {
	String cfgPath = getMybatisCfgPath();
	if (cfgPath != null) {
		Set<String> resources = new HashSet<>();

		ClassLoader classLoader = engineConfiguration.getClassLoader();
		if (classLoader == null) {
			classLoader = this.getClass().getClassLoader();
		}

		try (InputStream inputStream = classLoader.getResourceAsStream(cfgPath)) {
			DocumentBuilderFactory docBuilderFactory = createDocumentBuilderFactory();
			DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
			docBuilder.setEntityResolver(new XMLMapperEntityResolver());// TELL THE DOCUMENT BUILDER HOW TO RESOLVE THE XML ENTITY.
			Document document = docBuilder.parse(inputStream);
			NodeList nodeList = document.getElementsByTagName("mapper");
			for (int i = 0; i < nodeList.getLength(); i++) {
				Node node = nodeList.item(i);
				resources.add(node.getAttributes().getNamedItem("resource").getTextContent());
			}
		} catch (IOException e) {
			throw new FlowableException("Could not read IDM Mybatis configuration file", e);
		} catch (ParserConfigurationException | SAXException e) {
			throw new FlowableException("Could not parse Mybatis configuration file", e);
		}

		if (engineConfiguration.getCustomMybatisXMLMappers() == null) {
			engineConfiguration.setCustomMybatisXMLMappers(resources);
		} else {
			engineConfiguration.getCustomMybatisXMLMappers().addAll(resources);
		}
	}
}
}

#8

Problem solved while my source code is getting ugly. :flushed:

I’ve considered several design petterns like bridge and adapter, still not working.
Any way to make it better?