cancel
Showing results for 
Search instead for 
Did you mean: 

Activit without Spring

omni_ok
Champ in-the-making
Champ in-the-making
Can someone help me on following points?

1. I need to implement Activiti without Spring. I want to use simple Servet-JSP code. However, I could not find much help on this.

2. Using simple Servlet-JSP code, I am getting the following exception related to slf4j

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
       at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
       at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
       at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
       at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
       at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
       at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.<clinit>(ProcessEngineConfigurationImpl.java:219)
       at org.activiti.engine.ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration(ProcessEngineConfiguration.java:197)
       at com.activiti.Servlet1.doPost(Servlet1.java:40)
       at com.activiti.Servlet1.doGet(Servlet1.java:25)
       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:852)
       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(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       … 23 more
Feb 26, 2014 12:32:35 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Servlet1 threw exception
java.lang.ClassNotFoundException: org.apache.log4j.Level
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
       at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
       at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
       at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
       at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
       at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.<clinit>(ProcessEngineConfigurationImpl.java:219)
       at org.activiti.engine.ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration(ProcessEngineConfiguration.java:197)
       at com.activiti.Servlet1.doPost(Servlet1.java:40)
       at com.activiti.Servlet1.doGet(Servlet1.java:25)
       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:852)
       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(Unknown Source)


3. Last point : Configuring MYSQL database. I have put the MYSQL jar files in web-app/lib of my application and configured the db.properties file. Also the new MYSQL JDBC connection is mentioned in my code. However,  I cannot proceed without the resolving the above exception. How do I verify if MYSQL is configured correctly with Activiti.

Thank you in advance !!!
14 REPLIES 14

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi

1. I need to implement Activiti without Spring. I want to use simple Servet-JSP code. However, I could not find much help on this.

Activiti engine does not depend on spring (only spring beans as you can see).

[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.activiti:activiti-engine:jar:5.15-SNAPSHOT
[INFO] +- org.activiti:activiti-bpmn-converter:jar:5.15-SNAPSHOT:compile
[INFO] |  \- org.activiti:activiti-bpmn-model:jar:5.15-SNAPSHOT:compile
[INFO] |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.9:compile
[INFO] +- org.apache.commons:commons-email:jar:1.2:compile
[INFO] |  +- javax.mail:mail:jar:1.4.1:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- org.mybatis:mybatis:jar:3.2.2:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:3.2.7.RELEASE:compile
[INFO] +- junit:junit:jar:4.11Smiley Tonguerovided
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3Smiley Tonguerovided
[INFO] +- org.codehaus.groovy:groovy-all:jar:2.1.3Smiley Tonguerovided
[INFO] +- org.drools:drools-core:jar:5.5.0.FinalSmiley Tonguerovided
[INFO] |  +- org.mvel:mvel2:jar:2.1.3.FinalSmiley Tonguerovided
[INFO] |  +- org.drools:knowledge-api:jar:5.5.0.FinalSmiley Tonguerovided
[INFO] |  \- org.drools:knowledge-internal-api:jar:5.5.0.FinalSmiley Tonguerovided
[INFO] +- org.drools:drools-compiler:jar:5.5.0.FinalSmiley Tonguerovided
[INFO] |  +- org.antlr:antlr-runtime:jar:3.3Smiley Tonguerovided
[INFO] |  +- org.antlr:antlr:jar:3.3Smiley Tonguerovided
[INFO] |  +- org.antlr:stringtemplate:jar:3.2.1Smiley Tonguerovided
[INFO] |  +- antlr:antlr:jar:2.7.7Smiley Tonguerovided
[INFO] |  +- org.eclipse.jdt.core.compiler:ecj:jar:3.5.1Smiley Tonguerovided
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.4.1Smiley Tonguerovided
[INFO] |     +- xmlpull:xmlpull:jar:1.1.3.1Smiley Tonguerovided
[INFO] |     \- xpp3:xpp3_min:jar:1.1.4cSmiley Tonguerovided
[INFO] +- javax.persistenceSmiley Tongueersistence-api:jar:1.0Smiley Tonguerovided
[INFO] +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1Smiley Tonguerovided
[INFO] +- com.h2database:h2:jar:1.3.170:test
[INFO] +- org.mockito:mockito-core:jar:1.8.2:test
[INFO] |  \- org.objenesisSmiley Surprisedbjenesis:jar:1.0:test
[INFO] +- org.apache.openjpaSmiley Surprisedpenjpa:jar:1.2.2:test
[INFO] |  +- net.sourceforge.serp:serp:jar:1.13.1:test
[INFO] |  +- commons-lang:commons-lang:jar:2.1:test
[INFO] |  +- commons-collections:commons-collections:jar:3.2:test
[INFO] |  +- commons-pool:commons-pool:jar:1.3:test
[INFO] |  +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.0.1:test
[INFO] |  \- org.apache.geronimo.specs:geronimo-jpa_3.0_spec:jar:1.0:test
[INFO] +- org.subethamail:subethasmtp-wiser:jar:1.2:test
[INFO] |  \- org.subethamail:subethasmtp-smtp:jar:1.2:test
[INFO] +- mysql:mysql-connector-java:jar:5.1.27:test
[INFO] +- postgresqlSmiley Tongueostgresql:jar:9.0-801.jdbc4:test
[INFO] +- net.sourceforge.jtds:jtds:jar:1.3.0:test
[INFO] +- com.fasterxml.uuid:java-uuid-generator:jar:3.1.3Smiley Tonguerovided
[INFO] |  \- log4j:log4j:jar:1.2.13Smiley Tonguerovided
[INFO] +- commons-io:commons-io:jar:2.0.1:test
[INFO] +- joda-time:joda-time:jar:2.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.2:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.2:test
[INFO] \- org.codehaus.btm:btm:jar:2.1.3:test
[INFO]    \- javax.transaction:jta:jar:1.1:test


How to get it running: Create ProcessEngineConfiguration and build process engine from it.

2. Using simple Servlet-JSP code, I am getting the following exception related to slf4j

libraries in the classpath are missing

[INFO] +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.2:compile


3. Last point :

try and post exception.

Regards
Martin

omni_ok
Champ in-the-making
Champ in-the-making
Thanks we could proceed with your suggestion.
I use "ibatis-sqlmap-3.0-beta-10.jar" and get the following exception:
   java.lang.ClassCastException: org.apache.ibatis.logging.slf4j.Slf4jImpl cannot be cast to org.apache.ibatis.logging.Log

I also tried using "mybatis-3.0.4.jar", but had some other exception.

martin_grofcik
Confirmed Champ
Confirmed Champ
activiti-egine dependency is org.mybatis:mybatis:jar:3.2.2:compile. Did you try this one?

omni_ok
Champ in-the-making
Champ in-the-making
Yes Thanks Martin. It worked. However, the MYSQL exception still persists.
I have mentioned the following code:

ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()                                  .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)                                  .setJdbcUrl("jdbc:mysql://localhost:3306/activiti?autoReconnect=true&user=root&password=root")                                  .setJobExecutorActivate(true) .buildProcessEngine();


The exception here is :
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'activiti'

However, when I write the same jdbc connection URL in a standalone Java program, it works!
The db.properties file (placed in "apache-tomcat-6.0.26\webapps\activiti-explorer.war\WEB-INF\classes") is alsoconfigured to MYSQL database.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Access denied for user
for me it seems like my SQL configuration issue.

Regards
Martin

omni_ok
Champ in-the-making
Champ in-the-making
I have done with with MYSQL connection now. I just changed the above code to the following:

ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()                             .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)                             .setJdbcUrl("jdbc:mysql://localhost:3306/activiti").setJdbcPassword("root").setJdbcUsername("root")                             .setJobExecutorActivate(true).buildProcessEngine();

However, I am getting a new exception.
The code written is:

RepositoryService repositoryService =processEngine.getRepositoryService();
RuntimeService runtimeService =processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("vacationRequest");

For this code the exception is:
org.activiti.engine.ActivitiIllegalArgumentException: unknown type 'user' approver
       at org.activiti.engine.impl.form.FormTypes.parseFormPropertyType(FormTypes.java:55)
       at org.activiti.engine.impl.form.DefaultFormHandler.parseConfiguration(DefaultFormHandler.java:61)
       at org.activiti.engine.impl.form.DefaultStartFormHandler.parseConfiguration(DefaultStartFormHandler.java:34)
       at org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler.createStartFormHandlers(StartEventParseHandler.java:79)
       at org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler.executeParse(StartEventParseHandler.java:53)
       at org.activiti.engine.impl.bpmn.parser.handler.StartEventParseHandler.executeParse(StartEventParseHandler.java:35)
       at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:79)
       at org.activiti.engine.impl.bpmn.parser.handler.AbstractFlowNodeBpmnParseHandler.parse(AbstractFlowNodeBpmnParseHandler.java:27)
       at org.activiti.engine.impl.bpmn.parser.handler.AbstractActivityBpmnParseHandler.parse(AbstractActivityBpmnParseHandler.java:35)
       at org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers.parseElement(BpmnParseHandlers.java:73)
       at org.activiti.engine.impl.bpmn.parser.BpmnParse.processFlowElements(BpmnParse.java:407)
       at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.transformProcess(ProcessParseHandler.java:82)
       at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.executeParse(ProcessParseHandler.java:44)
       at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.executeParse(ProcessParseHandler.java:30)
       at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:79)
       at org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers.parseElement(BpmnParseHandlers.java:73)
       at org.activiti.engine.impl.bpmn.parser.BpmnParse.transformProcessDefinitions(BpmnParse.java:367)
       at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:190)
       at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:86)
       at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:42)
       at org.activiti.engine.impl.persistence.deploy.DeploymentManager.resolveProcessDefinition(DeploymentManager.java:95)
       at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedLatestProcessDefinitionByKey(DeploymentManager.java:69)
       at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:64)
       at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:36)
       at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
       at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
       at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
       at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
       at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
       at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:56)
       at com.activiti.Servlet1.doPost(Servlet1.java:96)
       at com.activiti.Servlet1.doGet(Servlet1.java:32)
       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:852)
       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(Unknown Source)

Please help on this!

martin_grofcik
Confirmed Champ
Confirmed Champ
the issue is on your process definition. (form property type user is not supported)

omni_ok
Champ in-the-making
Champ in-the-making
The process definition is "vacationRequest" which is provided in Activiti 5.14 by default. I have not created this process definition. I want to check, how can we invoke a process from a simple Servlet-JSP application.

martin_grofcik
Confirmed Champ
Confirmed Champ
vacationRequest uses form types which are configured in activiti-explorer. Your configuration does not support these form types.
Try simple process start->userTask->end