How to Start ProcessEngine of Activiti from Servlet
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 05:21 AM
Hello Experts,
I am new in Activiti and I got stuck in one issue since last two days.
I have configured Activiti Explore 5.12 in Mysql Database by changing the activiti-standalone-context.xml
And it is working fine.
But Now I have created one process and deployed that file in the Activiti Explorer.
And with the help of Servlet, I want to start the process.
So I written below code in the servlet.
But It gives me error as below, I am not getting as I configured explorer as mysql then why it is pointing to the H2 DB.
Please help. It's Urgent.
I am new in Activiti and I got stuck in one issue since last two days.
I have configured Activiti Explore 5.12 in Mysql Database by changing the activiti-standalone-context.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/activiti" /> <property name="username" value="root" /> <property name="password" value="root" /> <property name="defaultAutoCommit" value="false" /> </bean>
And it is working fine.
But Now I have created one process and deployed that file in the Activiti Explorer.
And with the help of Servlet, I want to start the process.
So I written below code in the servlet.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub PrintWriter out = response.getWriter(); System.out.println("Inside DO GET()"); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RuntimeService runtimeService = processEngine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("expenseProcess"); out.println("Started Process instance id " +processInstance.getProcessInstanceId()); }
But It gives me error as below, I am not getting as I configured explorer as mysql then why it is pointing to the H2 DB.
013-03-22 14:39:03 INFO [http-9090-1 ] - o.s.b.f.x.XmlBeanDe~ - Loading XML bean definitions from resource loaded through InputStreamInside DO GET()2013-03-22 14:39:04 ERROR [http-9090-1 ] - o.a.c.c.C.[.[.[.[He~ - Servlet.service() for servlet HelloWorldTest threw exceptionorg.apache.ibatis.datasource.DataSourceException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: org.h2.Driver at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.initializeDriver(UnpooledDataSource.java:179) at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:57) at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:349) at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:55) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDatabaseType(ProcessEngineConfigurationImpl.java:586) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:548) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:393) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:371) at com.hersheys.test.HelloWorldTest.doGet(HelloWorldTest.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 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:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619)Caused by: java.lang.ClassNotFoundException: org.h2.Driver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.initializeDriver(UnpooledDataSource.java:173) … 22 more
Please help. It's Urgent.
Labels:
- Labels:
-
Archive
8 REPLIES 8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 05:41 AM
I'm not sure about that but it seems default process engine configuration doesn't see you mysql configuration, as user guide says:
You are using Spring so you need to get process engine that way. You can look at spring support.
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine()
This will look for an activiti.cfg.xml file on the classpath and construct an engine based on the configuration in that file.
You are using Spring so you need to get process engine that way. You can look at spring support.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 05:55 AM
This will look for an activiti.cfg.xml file on the classpath and construct an engine based on the configuration in that file.
can you please elaborate where I have to put the activiti.cfg.xml file.
Whether I have to put in the apache-tomcat-6.0.30\webapps\activiti-explorer\WEB-INF\classes ?
And also can please put the activiti.cfg.xml file here.
And one more thing, why it is taking configuration from batis ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 07:30 AM
Please help
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 08:38 AM
Can you share your project?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 09:24 AM
This will look for an activiti.cfg.xml file on the classpath and construct an engine based on the configuration in that file.
can you please elaborate where I have to put the activiti.cfg.xml file.
Whether I have to put in the apache-tomcat-6.0.30\webapps\activiti-explorer\WEB-INF\classes ?
And also can please put the activiti.cfg.xml file here.
And one more thing, why it is taking configuration from batis ?
1. Create a maven project.
2. Put activiti.cfg.xml OR your spring config file to the resources. You can find both way of doing this in examples in Activiti.
3. You are good to go.
4. About ibatis, creators of Activiti can answer this.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2013 11:36 AM
The default datasource is an iBatis version. It gets the jdbc-parameters passed through from the process-engine configuration, which is defined in the spring-context file or activiti.cfg.xml file you're using.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2015 04:58 AM
hi, i am new in activiti.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2015 12:58 PM
Welcome to Activiti!

