cancel
Showing results for 
Search instead for 
Did you mean: 

Error while building ibatis SqlSessionFactory: Error creating document instance. Cause: java.net.UnknownHostException:

hardik_thakkar1
Champ in-the-making
Champ in-the-making
Hello,

I am currently facing issue with calling activiti from web application. I am getting below exception. I explored activiti forums for this issue. I could not find any concrete resolution. I am already connected to internet so network issue can not be main cause of this issue.

Any help on this would be much appreciated.

PS - If I run this program standalone then it is working fine. But when I run it in web application, it fails.

6 [http-8080-1] DEBUG org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl  - database product name: 'MySQL'
6 [http-8080-1] DEBUG org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl  - using database type: mysql
6 [http-8080-1] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Returned connection 29585115 to pool.
0 [http-8080-1] ERROR org.activiti.engine.ProcessEngines  - Exception while initializing process engine: Error while building ibatis SqlSessionFactory: Error creating document instance.  Cause: java.net.UnknownHostException: mybatis.org
.activiti.engine.ActivitiException: Error while building ibatis SqlSessionFactory: Error creating document instance.  Cause: java.net.UnknownHostException: mybatis.org
     at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initSqlSessionFactory(ProcessEngineConfigurationImpl.java:649)
     at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:386)
     at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:362)
     at org.activiti.engine.ProcessEngines.buildProcessEngine(ProcessEngines.java:194)
     at org.activiti.engine.ProcessEngines.initProcessEnginFromResource(ProcessEngines.java:167)
     at org.activiti.engine.ProcessEngines.init(ProcessEngines.java:98)
     at org.activiti.engine.ProcessEngines.getProcessEngine(ProcessEngines.java:224)
     at org.activiti.engine.ProcessEngines.getDefaultProcessEngine(ProcessEngines.java:217)
     at com.rbos.workflow.main.FinancialApp.executeWorkflow(FinancialApp.java:29)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
     at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvide
ava:185)
     at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
     at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
     at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
     at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
     at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
     at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
     at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
     at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
     at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
     at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
     at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
     at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Thread.java:619)
sed by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: java.net.UnknownHostException: mybatis.org
     at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:136)
     at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:32)
     at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:47)
     at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initSqlSessionFactory(ProcessEngineConfigurationImpl.java:640)
     … 39 more
sed by: java.net.UnknownHostException: mybatis.org
     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
10 REPLIES 10

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Could you post your process engine configuration?

Regards
Martin

hardik_thakkar1
Champ in-the-making
Champ in-the-making
Please find as below:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
 
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti" />
    <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
    <property name="jdbcUsername" value="root" />
    <property name="jdbcPassword" value="activiti" />
   
    <property name="databaseSchemaUpdate" value="true" />
   
    <property name="jobExecutorActivate" value="false" />
   
    <property name="mailServerHost" value="mail.my-corp.com" />
    <property name="mailServerPort" value="5025" />   
  </bean>

</beans>

hardik_thakkar1
Champ in-the-making
Champ in-the-making
It seems there is some problem in posting XMLs. Please find attached config in text format.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Hardik,

Are you sure that web app is using exactly the same config as standalone app?

Regards
Martin

hardik_thakkar1
Champ in-the-making
Champ in-the-making
Yes I have verified under war which is deployed to container. It uses same config what I posted here.

jbarrez
Star Contributor
Star Contributor

hardik_thakkar1
Champ in-the-making
Champ in-the-making
I am connected to internet. I am using my company's network.

As per solution mentioned on above link states that we need to add below code in our DocumentBuilderFactory.

dbFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);

How can we amend activiti code? I also tried with one approach here.

Download DTD manually and place them on classpath and amend DTD paths in every XML. But it doesn't seem feasible solution.

And strange thing here is that, if I run this program in standalone mode then it works fine. But when I run from web application, it fails. So there should not be network or firewall issue.

Please help me. My current project is stuck due to this.

jbarrez
Star Contributor
Star Contributor
No, you can't add that to activiti without effectively creating a custom version.

It must be a network issue, can't be anything else. Is this machine running behind a proxy?
I've got no clue about your network topology though … so it can be pretty much anything.

nikunj
Champ in-the-making
Champ in-the-making
Well what was the solution to this problem ?. I dont see any soluiton as such ? Can any one please explain ?