cancel
Showing results for 
Search instead for 
Did you mean: 

Error while building ibatis SqlSessionFactory: null when integrate activiti with osgi

yava
Champ in-the-making
Champ in-the-making
I have made activiti project with simple business process. it has been running well,
then I try to put it in OSGI (of course with a few changes). but I get "Error while building ibatis SqlSessionFactory: null" (complete stacktrace is attached)

I am sure the problem was not from camel route, because it has been entering my processor.

here are my activiti-context :

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
   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
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

   <bean id="processEngineConfiguration"
      class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
      <!– Database configurations –>
      <property name="databaseType" value="mysql" />
      <property name="jdbcUrl"
         value="jdbc:mysql://localhost:3306/activiti?autoReconnect=true" />
      <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
      <property name="jdbcUsername" value="root" />
      <property name="jdbcPassword" value="test" />

      <property name="databaseSchemaUpdate" value="true" />
      <property name="mailServerHost" value="localhost" />
      <property name="mailServerPort" value="5025" />
      <property name="jobExecutorActivate" value="false" />
   </bean>

   <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
      <property name="processEngineConfiguration" ref="processEngineConfiguration" />
   </bean>

</beans>


and here is my processor :

public class HelloWorldProcessor implements Processor {
   
    private Logger log = LoggerFactory.getLogger(HelloWorldProcessor.class);

    @Override
    public void process(Exchange exchange) throws Exception {
        ProcessEngine processEngine = ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource(
                        "activiti-context.xml").buildProcessEngine();

        RepositoryService repositoryService = processEngine
                .getRepositoryService();
        RuntimeService runtimeService = processEngine.getRuntimeService();

        repositoryService.createDeployment().addClasspathResource("hello.bpmn")
                .deploy();

        runtimeService.startProcessInstanceByKey("helloWorld");
    }

}


I have put mysql jar in my osgi (complete osgi list attached), i dont know why mybatis stacktrace shown in my error message.
5 REPLIES 5

mramirez1
Champ in-the-making
Champ in-the-making
Hello…
I have a same problem please help us….

mramirez1
Champ in-the-making
Champ in-the-making
Here my Stack Trace
<blockcode>
8/01/2014 05:51:53 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [activiti-xml.xml]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/mramirez/Proyecto%20Activiti/Libs-Project/slf4j-1.7.5/slf4j-jdk14-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/mramirez/Proyecto%20Activiti/Libs-Project/slf4j-1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
Exception in thread "main" 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 com.bpm.koghi.Prueba.main(Prueba.java:20)
Caused 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)
… 3 more
Caused by: java.net.UnknownHostException: mybatis.org
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:208)
at sun.net.www.http.HttpClient.New(HttpClient.java:291)
at sun.net.www.http.HttpClient.New(HttpClient.java:310)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:676)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1314)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1281)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1191)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1087)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1000)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:134)
… 6 more
</blockcode>

Here Activiti XML
<blockcode>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx
    xmlnsSmiley Tongue="http://www.springframework.org/schema/p"
    xsi:schemaLocation="
            http://www.springframework.org/schema/beans     
            http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
            http://www.springframework.org/schema/tx 
            http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-4.0.xsd">
           


<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<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="12345678" />
<property name="databaseSchemaUpdate" value="true"/>
</bean>

<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>

<bean id="activitiRepositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="activitiRuntimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
<bean id="activitiTaskService" factory-bean="processEngine" factory-method="getTaskService" />
<bean id="activitiHistoryService" factory-bean="processEngine" factory-method="getHistoryService" />
<bean id="activitiManagementService" factory-bean="processEngine" factory-method="getManagementService" />


</beans>
</blockcode>

And my processor

<blockcode>
package com.bpm.koghi;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

public class Prueba {

/**
  * @param args
  */
public static void main(String[] args) {
  // TODO Auto-generated method stub
 
   // Create Activiti process engine
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti-xml.xml").buildProcessEngine();
      //ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration().buildProcessEngine();
   
    // Get Activiti services
    RepositoryService repositoryService = processEngine.getRepositoryService();
    RuntimeService runtimeService = processEngine.getRuntimeService();

    // Deploy the process definition
    repositoryService.createDeployment().addClasspathResource("diagrams/FinancialReport.bpmn").deploy();

    // Start a process instance
    runtimeService.startProcessInstanceByKey("myProcess");
    TaskService taskService=processEngine.getTaskService();
   Task task=taskService.createTaskQuery().taskAssignee("kermit").singleResult();
   System.out.println(task.getName());
 
}
 
 

}
</blockcode>

frederikherema1
Star Contributor
Star Contributor
Seems like the XML-parser is trying to resolve the XSD's for myBatis…

Ok, but how i can resolve? i not understand, excuse me, but i'm new with activiti.
Please can you help me?.

jbarrez
Star Contributor
Star Contributor
Is this computer connected with the internet? Or behind a corporare firewall?

Seems like it is trying to validate the XSD with the online xsd and it can't reach the url.