- 浏览: 308494 次
- 性别:
- 来自: 成都
文章分类
- 全部博客 (118)
- VS2008 (2)
- JAVA (34)
- AJAX (1)
- C# (1)
- Flex (16)
- FMS (6)
- SQLSERVER (1)
- ORACLE (1)
- Quartz (1)
- struts2 (1)
- java数据结构 (1)
- java设计模式 (3)
- JSF (0)
- web (2)
- jbpm4 (4)
- J2EE (1)
- webservice (2)
- javascript (8)
- spring (3)
- lucene (0)
- linux (9)
- ibatis (1)
- JPA (2)
- 外挂 (0)
- VB (0)
- Hibernate (1)
- OSGI (8)
- EXT (4)
- Maven (1)
- SpringSecurity (0)
- activiti (0)
- 项目开发 (0)
- 项目管理 (7)
- android (0)
- FFMPEG (1)
- C (2)
- eclipse (1)
最新评论
-
默默得守候在你的身边:
给力
java与Delphi写的dll交互 -
默默得守候在你的身边:
java与Delphi写的dll交互 -
fuguitong:
[url][url][url][url][url][url][ ...
doc转swf -
baidu_25402161:
到结束的时候一直 Can't delete processIn ...
一个请假单流程的实现(struts2.1.8+spring2.5+hibernate3集成jbpm4.3) -
lohaoo1:
nice!
java面包屑导航制作
先说明这个只是一个例子而已,简单的介绍了一些写法,你真的理解了以后完全可以写出比这个更好的代码来。
网上随便找了个请假的流程图,在此先谢谢提供图片的人:
使用jbpm工具画出流程图,中文好像是乱码,所以改为英文:
leave.jpdl.xml内容:
<?xml version="1.0" encoding="UTF-8"?> <process name="leave" xmlns="http://jbpm.org/4.3/jpdl"> <start g="159,47,48,48" name="start1"> <transition to="exclusive1"/> </start> <decision expr="#{job}" g="161,152,48,48" name="exclusive1"> <transition g="42,179:43,-27" name="isChief" to="boosApprove"/> <transition g="316,175:-83,-23" name="isnotChief" to="chiefApprove"/> </decision> <state g="-3,220,92,52" name="boosApprove"> <transition g="47,340:" to="sendEmail"/> </state> <state g="270,214,92,52" name="chiefApprove"> <transition to="exclusive2"/> </state> <decision expr="#{day}" g="160,219,48,48" name="exclusive2"> <transition g="-2,-20" name="gt10" to="boosApprove"/> <transition g="186,323:12,-47" name="le10" to="sendEmail"/> </decision> <end g="171,410,48,48" name="end"/> <state g="146,313,92,52" name="sendEmail"> <transition to="end"/> </state> </process>
分析之后,有如下一些表:
用户user_
角色role_(简化到user_)
请假单leave_
假设有这么几个用户:
陈均 --普通员工
唐平 --级别最高的,BOOS,老板
胡杰 --级别比较高的,chief主管
张小 --普通员工
用户测试数据:
INSERT INTO `user_` VALUES ('9', '陈均', '普通员工'); INSERT INTO `user_` VALUES ('10', '胡杰', '主管'); INSERT INTO `user_` VALUES ('11', '唐平', '老板'); INSERT INTO `user_` VALUES ('12', '张小', '普通员工');
现在集成jbpm4.3,hibernate3,spring2.5,struts2.1.8。
系统初步设计如图:
1.因为jbpm里面带有hibernate,所以创建web项目后,导入jbpm-4.3\lib下的所有包,导入jbpm-4.3\jbpm.jar,
把jbpm4.3\lib\下面得juel.jar,juel-engine.jar,juel-impl.jar放到tomcat的lib下面。导入spring2.5的jar,导入struts2.1.8所需jar包。以下jar包不是最简,有些不是必须的。
spring2.5所需jar包清单:
aspectjrt.jar
aspectjweaver.jar
cglib-nodep-2.1_3.jar
common-annotations.jar
commons-logging.jar
log4j-1.2.15.jar
spring.jar
spring-webmvc-struts.jar
------------------------------------
struts2.1.8所需jar包清单:
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemarker-2.3.15.jar
ognl-2.7.3.jar
struts2-core-2.1.8.1.jar
struts2-dojo-plugin-2.1.8.1.jar
struts2-spring-plugin-2.1.8.1.jar
xwork-core-2.1.6.jar
-----------------------------------
数据库和数据源所需jar包:
c3p0-0.9.1.2.jar
mysql-connector-java-5.1.7-bin.jar
找到jbpm-4.3\install\src\cfg\jbpm\下的spring.jbpm.cfg.xml文件,放入项目的src处,改名为jbpm.cfg.xml.
在项目src下面创建applicationContext.xml配置文件,内容如下:
<?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:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <!-- 开启注解配置 --> <context:annotation-config /> <!-- 对指定的包进行组件扫描 --> <context:component-scan base-package="org.forever.leave" /> <!-- 配置数据源,导入c3p0-0.9.1.2.jar,mysql-connector-java-5.1.7-bin.jar --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"> <value>com.mysql.jdbc.Driver</value> </property> <property name="jdbcUrl"> <value>jdbc:mysql://localhost:3306/jbpmdb</value> </property> <property name="user"> <value>root</value> </property> <property name="password"> <value>root</value> </property> </bean> <!-- 集成hibernate配置 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties" ref="hibernateProperties" /> <property name="mappingLocations"> <list> <value>classpath*:org/forever/leave/entities/*.hbm.xml</value> <value>classpath:jbpm.repository.hbm.xml</value> <!-- 以下几个jbpm.*.hbm.xml由jBPM自带 --> <value>classpath:jbpm.execution.hbm.xml</value> <value>classpath:jbpm.history.hbm.xml</value> <value>classpath:jbpm.task.hbm.xml</value> <value>classpath:jbpm.identity.hbm.xml</value> </list> </property> </bean> <bean name="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="properties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <!-- jbpm配置 --> <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" /> <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" /> <!-- 模板配置自己写的,不是必须的 --> <bean id="jbpmTemplate" class="org.forever.leave.jbpm.JbpmTemplate"> <property name="processEngine" ref="processEngine"></property> </bean> <!-- 数据层用的模板工具,不是必须的 --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 事务配置,必须 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 切面配置 --> <aop:config> <aop:pointcut expression="execution(* org.forever.leave.biz..*.*(..))" id="transactionPointcut" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut" /> </aop:config> <!-- 通知配置 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> </beans>
添加 log4j.properties文件;
模板类JbpmTemplate:
package org.forever.leave.jbpm; import java.util.List; import java.util.Map; import org.jbpm.api.Execution; import org.jbpm.api.ExecutionService; import org.jbpm.api.HistoryService; import org.jbpm.api.ManagementService; import org.jbpm.api.ProcessEngine; import org.jbpm.api.ProcessInstance; import org.jbpm.api.RepositoryService; import org.jbpm.api.TaskService; import org.jbpm.api.task.Task; /** * jbpm模板类(初步实现) * * @author Administrator * */ public class JbpmTemplate { /** * 部署流程到数据库 * * @param resourceName * 资源文件名字 比如(org/forever/jbpm/jpdl/process.jpdl.xml) * @return 返回流程定义id(格式:key-version) */ public String Deploy(String resourceName) { return repositoryService.createDeployment().addResourceFromClasspath( resourceName).deploy(); } /** * 创建一个新的流程实例 * * @param processDefinitionKey * (process.jpdl.xml中process标签的key) * @param processInstanceKey * (用户给的key,比如一个请假单的id) * @return 流程实例 */ public ProcessInstance addProcessInstance(String processDefinitionKey, String processInstanceKey) { return executionService.startProcessInstanceByKey(processDefinitionKey, processInstanceKey); } /** * 创建一个新的流程实例 * @param processDefinitionKey(process.jpdl.xml中process标签的key) * @param variables 该流程实例要用到的变量 * @param processInstanceKey(用户给定的业务key) * @return */ public ProcessInstance addProcessInstance( String processDefinitionKey, Map<String, ?> variables, String processInstanceKey){ return executionService.startProcessInstanceByKey(processDefinitionKey, variables, processInstanceKey); } /** * 提交任务 * @param taskId 任务id */ public void completeTask(String taskId){ taskService.completeTask(taskId); } /** * 将任务流转到指定名字的流程中去 * @param taskId * @param outcome */ public void completeTask(String taskId,String outcome){ taskService.completeTask(taskId, outcome); } /** * 根据key获取流程实例(这里我使用的uuid) * * @param key * (对应于数据库表jbpm4_execution中的KEY_字段) * @return 返回查找到得流程实例,没有返回null */ public ProcessInstance getProcessInstance(String key) { return executionService.createProcessInstanceQuery() .processInstanceKey(key).uniqueResult(); } /** * 根据executionId获取指定的变量值 * @param executionId * @param variableName * @return */ public Object getVariableByexecutionId(String executionId,String variableName){ return executionService.getVariable(executionId, variableName); } /** * 根据任务id获取指定变量值 * @param taskId * @param variableName * @return */ public Object getVariableByTaskId(String taskId,String variableName){ return taskService.getVariable(taskId, variableName); } /** * 获取指定用户名字的任务 * @param userId * @return */ public List<Task> findPersonalTasks(String userId){ return taskService.findPersonalTasks(userId); } /** * 根据任务id获取任务 * @param taskId * @return */ public Task getTask(String taskId) { return taskService.getTask(taskId); } /** * 根据流程实例id获取 * @param executionId * @return */ public Execution findExecutionById(String executionId) { return executionService.findExecutionById(executionId); } /** * 彻底删除文件的部署 * * @param deploymentId流程定义id */ public void deleteDeploymentCascade(String deploymentId) { repositoryService.deleteDeploymentCascade(deploymentId); } public JbpmTemplate() { } public JbpmTemplate(ProcessEngine processEngine) { this.processEngine = processEngine; repositoryService = processEngine.getRepositoryService(); executionService = processEngine.getExecutionService(); taskService = processEngine.getTaskService(); historyService = processEngine.getHistoryService(); managementService = processEngine.getManagementService(); } private ProcessEngine processEngine; private RepositoryService repositoryService = null; private ExecutionService executionService = null; private TaskService taskService = null; private HistoryService historyService = null; private ManagementService managementService = null; public ProcessEngine getProcessEngine() { return processEngine; } public void setProcessEngine(ProcessEngine processEngine) { this.processEngine = processEngine; System.out.println(processEngine); repositoryService = processEngine.getRepositoryService(); executionService = processEngine.getExecutionService(); taskService = processEngine.getTaskService(); historyService = processEngine.getHistoryService(); managementService = processEngine.getManagementService(); } //省略get和set方法 }
创建测试类Test:
import java.util.UUID; import org.forever.leave.jbpm.JbpmTemplate; import org.jbpm.api.ProcessInstance; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Test { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml"); JbpmTemplate jbpmTemplate = (JbpmTemplate) context .getBean("jbpmTemplate"); System.out.println(jbpmTemplate); jbpmTemplate.Deploy("org/forever/leave/jbpm/jpdl/leave.jpdl.xml"); UUID uuid = UUID.randomUUID(); } }
控制台输出没有报错说明jbpm和spring初步集成成功;
访问http://localhost:8080/leave/user/queryList.action获取到用户列表信息,说明集成成功。
项目中需要修改mysql方言为org.hibernate.dialect.MySQLInnoDBDialect,事务service改为biz,刚发现的,呵呵
下一步进行业务的实现。
未完
因为朋友需要,所以对其进行了简单的实现:
在实现中发现集成的时候,如果你用mysql数据库,请设置你的方言为:org.hibernate.dialect.MySQLInnoDBDialect
先看一哈这个实现了简单业务的一个图,在此用的中文,也是网上找的,呵呵,我都变懒了哈:
对应xml文件:
<?xml version="1.0" encoding="UTF-8"?> <process key="leave" name="leave" xmlns="http://jbpm.org/4.3/jpdl"> <start g="201,14,48,48" name="开始"> <transition g="-42,-10" name="请假" to="填写请假单"/> </start> <task assignee="writerForm" g="178,87,92,52" name="填写请假单"> <transition g="-97,2" name="判断是不是经理" to="是不是经理"/> </task> <decision expr="#{manager}" g="204,158,48,48" name="是不是经理"> <transition g="-23,-11" name="否" to="经理审核"/> <transition g="14,-11" name="是" to="老板审批"/> </decision> <task assignee="#{username}" g="103,252,92,52" name="经理审核"> <transition g="150,450:10,-21" name="经理批准" to="结束"/> <transition g="-22,-22" name="请假天数>5" to="老板审批"/> <transition g="-61,-1" name="经理不批准" to="终止"/> <transition g="149,114:-55,82" name="经理驳回" to="填写请假单"/> </task> <!-- 这里只有一个老板,所以写死了,如果有多个老板,写法同上,业务就会改变 --> <task assignee="张杰" g="278,251,92,52" name="老板审批"> <transition g="326,450:-58,-24" name="老板批准" to="结束"/> <transition g="7,0" name="老板不批准" to="终止"/> <transition g="323,114:13,61" name="老板驳回" to="填写请假单"/> </task> <end g="219,429,48,48" name="结束" state="confirm"/> <end g="220,360,48,48" name="终止" state="dissent"/> </process>
写了个经理审批的测试类过程:
package org.forever.leave.biz.test; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.forever.leave.entities.Leave; import org.forever.leave.entities.User; import org.jbpm.api.ProcessInstance; import org.jbpm.api.task.Task; import org.junit.Test; //请假测试 //运行顺序 //testDeploy() //testCresteLeave() //testStart() //testGetTask() //testGetLeave() public class LeaveTest extends BaseTest{ //部署流程 @Test public void testDeploy(){ String resourceName ="org/forever/leave/jbpm/jpdl/leave.jpdl.xml"; jbpmTemplate.Deploy(resourceName); } //新建请假单 @Test public void testCresteLeave(){ //现假设用户陈均登陆了系统,然后进行请假 String loginName = "cj";//登陆者 String password = "cj";//登陆密码 User user = userDao.get(loginName,password); //status=新建,就是未提交的 UUID uuid = UUID.randomUUID(); Leave leave = new Leave(user, 3,new Date(),"新建", "生病了"); leave.setLeaveId(uuid.toString()); //保存到数据库 leaveDao.save(leave); } // 启动流程实例,提交请假申请 //注意(如果要对该测试类成功测试,首先确保存在juel-engine.jar,juel-impl.jar,juel.jar) //部署到tomcat里面的时候就把juel.jar,juel-engine.jar,juel-impl.jar放到tomcat的lib下面 @Test public void testStart() { //进行业务流转所需的变量 String loginName = "cj";//登陆者 String password = "cj";//登陆密码 User user = userDao.get(loginName,password); // 3.启动流程实例,绑定业务key,key最好是唯一的 List<?> list = leaveDao.findByUserLeave(user.getUserId());//该用户可能有多次请假的记录 //假设用户选择的是index=0的那个请假单 Leave leave = (Leave)list.get(0); String position = user.getPosition();//用户的职位 Map<String, Object> variables = new HashMap<String, Object>();//流程中要用到的变量信息 variables.put("leaveId",leave.getLeaveId());//存放该实例的请假单 if("员工".equals(position)){//如果是员工请假 variables.put("manager", "否"); variables.put("username","胡杰");//指定一个经理进行审批 }else if("经理".equals(position)){//如果是经理请假 variables.put("manager", "是"); //只有一个boos,所以在xml中指定了,在此就不用指定了 } //此时就获取到了该请假单的id //通过该leaveId来绑定一个流程实例 ProcessInstance processInstance = jbpmTemplate.addProcessInstance("leave",variables, leave.getLeaveId()); //该表单到时候是在web页面进行申请时填写好的 System.out.println("请假单已填写:" + processInstance.isActive("填写请假单")); String taskId = jbpmTemplate.findPersonalTasks("writerForm").get(0).getId(); //让任务向下流转,提交任务 jbpmTemplate.completeTask(taskId); } //获取任务集合 @Test public void testGetTask(){ //经理登陆系统,获取审批任务 String username = "胡杰"; List<Leave> leaves = new ArrayList<Leave>();//该经理可能对多个请假单审批,该集合提供给页面使用的 List<Task> list = jbpmTemplate.findPersonalTasks(username); if(list.size()==0){ System.out.println(username + "没有任务........."); } else{ for (Task task : list) { System.out.println("任务名字:" + task.getName()); System.out.println("任务参与者:" + task.getAssignee()); String taskId = task.getId(); String leaveId = (String) jbpmTemplate.getVariableByTaskId(taskId, "leaveId"); Leave leave = leaveDao.findbyIdLeave(leaveId); leave.setTaskId(taskId); leaves.add(leave); } } //页面显示,并全部通过审批 for (Leave leave : leaves) { System.out.println(leave); //批准流程 ProcessInstance processInstance = jbpmTemplate.getProcessInstance(leave.getLeaveId()); String taskId = leave.getTaskId(); int day = leave.getDay();//请假天数 if(day>5 && true){//如果大于5天,并且经理批准,也要提交给boos审核 jbpmTemplate.completeTask(taskId, "请假天数>5"); }else{//直接通过,既让任务流转到结束 jbpmTemplate.completeTask(taskId,"经理批准"); } System.out.println("审批结果:" + processInstance.getState()); leave.setStatus("通过"); leaveDao.update(leave);//更新结果 } } //获取指定用户的请假单集合 @Test public void testGetLeave(){ //进行业务流转所需的变量 String loginName = "cj";//登陆者 String password = "cj";//登陆密码 User user = userDao.get(loginName,password); //页面显示用 List<?> list = leaveDao.findByUserLeave(user.getUserId()); for (Object object : list) { System.out.println(object); //是否已经申请 //已经提交的请假单不能进行删除操作(所以慎重,呵呵) //新建状态的请假单可以进行删除操作 } } }
web版的我截几个效果图,具体过程你们下载来感受吧:
login.jsp登陆页面http://localhost:90/leave/login.jsp:第一次需要部署一哈
普通员工登陆用户名和密码为cj:
经理用户名和密码为hj,登陆后如图:
老板的用户名和密码zxp,进去后如图:
项目里面带有数据库脚本。jar自己加哈,有什么问题,欢迎交流
- leave_集成完成_.rar (51.8 KB)
- 下载次数: 1430
- leave_业务实现版_20100425.rar (126.5 KB)
- 下载次数: 1720
评论
Can't delete processInstance leave.8ad081eb543d2d5a01543d2e409c0001: no processInstance found for the given id
这个错误。不知道怎么回事
2012-10-17 23:37:10 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 0, SQLState: 22001
2012-10-17 23:37:10 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Data truncation: Data truncated for column 'apply_time' at row 1
2012-10-17 23:37:10 org.hibernate.event.def.AbstractFlushingEventListener performExecutions
严重: Could not synchronize database state with session
org.hibernate.exception.DataException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:100)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy6.save(Unknown Source)
at org.forever.leave.web.action.LeaveAction.saveLeave(LeaveAction.java:39)
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.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:510)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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.sql.BatchUpdateException: Data truncation: Data truncated for column 'apply_time' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:648)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 91 more
这个错误是因为 leave/src/applicationContext.xml 里面没有配置
<bean id="leaveDao" class="org.forever.leave.dao.impl.LeaveDaoImpl">
</bean>
<bean id="leaveBiz" class="org.forever.leave.biz.impl.LeaveBizImpl" scope="prototype">
<property name="leaveDao"><ref bean="leaveDao"/></property>
</bean>
<bean id="userDao" class="org.forever.leave.dao.impl.UserDaoImpl">
</bean>
<bean id="userBiz" class="org.forever.leave.biz.impl.UserBizImpl" scope="prototype">
<property name="userDao"><ref bean="userDao"/></property>
</bean>
配置完后 把LeaveDaoImpl,UserDaoImpl 里面的 hibernateTemplate 有关的注掉,重写相关方法 就OK
Hibernate: select jobimpl0_.DBID_ as DBID1_8_, jobimpl0_.DBVERSION_ as DBVERSION3_8_, jobimpl0_.DUEDATE_ as DUEDATE4_8_, jobimpl0_.STATE_ as STATE5_8_, jobimpl0_.ISEXCLUSIVE_ as ISEXCLUS6_8_, jobimpl0_.LOCKOWNER_ as LOCKOWNER7_8_, jobimpl0_.LOCKEXPTIME_ as LOCKEXPT8_8_, jobimpl0_.EXCEPTION_ as EXCEPTION9_8_, jobimpl0_.RETRIES_ as RETRIES10_8_, jobimpl0_.PROCESSINSTANCE_ as PROCESS11_8_, jobimpl0_.EXECUTION_ as EXECUTION12_8_, jobimpl0_.CFG_ as CFG13_8_, jobimpl0_.SIGNAL_ as SIGNAL14_8_, jobimpl0_.EVENT_ as EVENT15_8_, jobimpl0_.REPEAT_ as REPEAT16_8_, jobimpl0_.CLASS_ as CLASS2_8_ from JBPM4_JOB jobimpl0_ where (jobimpl0_.LOCKOWNER_ is null) and jobimpl0_.RETRIES_>0 and jobimpl0_.STATE_<>'suspended' order by jobimpl0_.DUEDATE_ asc limit ?部署到tomcat时,不断出现以上两条语句?请问LZ是什么原因,谢谢?
我后来往上面看了看,说什么org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
信息: table not found: JBPM4_DEPLOYMENT
Hibernate: select jobimpl0_.DBID_ as DBID1_8_, jobimpl0_.DBVERSION_ as DBVERSION3_8_, jobimpl0_.DUEDATE_ as DUEDATE4_8_, jobimpl0_.STATE_ as STATE5_8_, jobimpl0_.ISEXCLUSIVE_ as ISEXCLUS6_8_, jobimpl0_.LOCKOWNER_ as LOCKOWNER7_8_, jobimpl0_.LOCKEXPTIME_ as LOCKEXPT8_8_, jobimpl0_.EXCEPTION_ as EXCEPTION9_8_, jobimpl0_.RETRIES_ as RETRIES10_8_, jobimpl0_.PROCESSINSTANCE_ as PROCESS11_8_, jobimpl0_.EXECUTION_ as EXECUTION12_8_, jobimpl0_.CFG_ as CFG13_8_, jobimpl0_.SIGNAL_ as SIGNAL14_8_, jobimpl0_.EVENT_ as EVENT15_8_, jobimpl0_.REPEAT_ as REPEAT16_8_, jobimpl0_.CLASS_ as CLASS2_8_ from JBPM4_JOB jobimpl0_ where (jobimpl0_.LOCKOWNER_ is null) and jobimpl0_.RETRIES_>0 and jobimpl0_.STATE_<>'suspended' order by jobimpl0_.DUEDATE_ asc limit ?部署到tomcat时,不断出现以上两条语句?请问LZ是什么原因,谢谢?
有的时候以 cj 登录不部署,在申请的时候报:
org.jbpm.api.JbpmException: expression '#{manager}' in decision '是不是经理\' returned unexisting outgoing transition name: 否
at org.jbpm.jpdl.internal.activity.DecisionExpressionActivity.execute(DecisionExpressionActivity.java:60)
at org.jbpm.jpdl.internal.activity.DecisionExpressionActivity.execute(DecisionExpressionActivity.java:42)
.......
这个错误。
如果登录时部署就没有这个问题。
望LZ解答一下!!
这只是一个例子哈。至于你想什么时候部署无所谓的哈。你完全可以按照你的意愿来哈。
有的时候以 cj 登录不部署,在申请的时候报:
org.jbpm.api.JbpmException: expression '#{manager}' in decision '是不是经理\' returned unexisting outgoing transition name: 否
at org.jbpm.jpdl.internal.activity.DecisionExpressionActivity.execute(DecisionExpressionActivity.java:60)
at org.jbpm.jpdl.internal.activity.DecisionExpressionActivity.execute(DecisionExpressionActivity.java:42)
.......
这个错误。
如果登录时部署就没有这个问题。
望LZ解答一下!!
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:935)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:404)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:735)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
at org.forever.leave.biz.test.Test.main(Test.java:11)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jbpmTemplat' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition
找不出jbpmTemplate和leaveBiz直接的关系
老板在审批 大于5天的员工 请求有个bug,
还是会去找“请假天数>5”,应该是“老板批准”
老板的审批和经理的分开就ok了。
呵呵,是那个意思就行了。里面的代码写的很死的。可以改进
老板在审批 大于5天的员工 请求有个bug,
还是会去找“请假天数>5”,应该是“老板批准”
老板的审批和经理的分开就ok了。
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.forever.leave.biz.impl.LeaveBizImpl] for bean with name 'leaveBiz' defined in file [E:\WorkSpace\Temp\leave\WebRoot\WEB-INF\classes\org\forever\leave\biz\impl\LeaveBizImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class org.forever.leave.biz.impl.LeaveBizImpl)
这么个错误,应该是JAR包或是环境的问题吧~楼主……能把jar包放出来吗?还有环境说一下,我的JDK1.5,tomcat5.5和6都有试过,都是这个错………………
这个是版本问题:因为我用的是1.6编译的,你把E:\WorkSpace\Temp\leave\WebRoot\WEB-INF\classes下面的删掉,重新编译就ok了
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.forever.leave.biz.impl.LeaveBizImpl] for bean with name 'leaveBiz' defined in file [E:\WorkSpace\Temp\leave\WebRoot\WEB-INF\classes\org\forever\leave\biz\impl\LeaveBizImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class org.forever.leave.biz.impl.LeaveBizImpl)
这么个错误,应该是JAR包或是环境的问题吧~楼主……能把jar包放出来吗?还有环境说一下,我的JDK1.5,tomcat5.5和6都有试过,都是这个错………………
相关推荐
由于最大上传被限制在 20M,所以只能分开上传。 分为:struts2.1.8 + spring 2.5 + ibatis 2 整合开发包_ _01部分 ...只要将这两个包全下载下来,就可以搭建struts2.1.8 + spring 2.5 + ibatis2整合开发的 包环境。
由于最大上传被限制在 20M,所以只能分开上传。 分为:struts2.1.8 + spring 2.5 + ibatis 2 整合开发包_ _01部分 ...只要将这两个包全下载下来,就可以搭建struts2.1.8 + spring 2.5 + ibatis2整合开发的 包环境。
"jBPM4.3+struts2.1.8+spring2.5整合" 这个标题表明我们将探讨一个基于Java的企业级应用开发集成框架。jBPM是业务流程管理(Business Process Management)的一个开源工具,版本4.3,用于管理和执行工作流和业务流程...
struts2.1.8+spring2.5+hibernate3.2+ext3.0框架整合笔记的最终版本,整合过程见于:http://blog.csdn.net/phoenixdsf/article/details/7645655
在"struts2.1.8+spring2.5+hibernate3.2+ext3.0框架整合笔记(二)"中,开发者可能关注以下几个关键点: 1. **Struts2与Spring的整合**: - 配置Struts2的`struts-plugin.xml`文件,导入Spring插件,使Struts2能够...
Struts2.1.8、Spring2.5和Hibernate3.3.2是经典的Java Web开发框架组合,常被称为"S2SH"。这个压缩包包含了这三个框架的核心库以及c3p0连接池的相关jar包,使得开发者能够在Java Web应用程序中实现MVC(Model-View-...
Struts2作为MVC框架负责控制流程,Spring2.5提供依赖注入和企业级服务,而Hibernate3.2则是持久层的解决方案,简化了数据库操作。 首先,让我们深入理解每个框架的核心功能: 1. **Struts2**:Struts2是一个强大的...
了解并掌握这些整合的关键点,对于开发一个基于Struts2、Spring和Hibernate的Java Web应用至关重要。在后续笔记中,预计会涉及更多关于Spring和Hibernate的配置,以及如何使用Ext3.0创建动态用户界面。这种整合方式...
Java代码生成工具是一种高效开发辅助软件,主要用于自动化生成基于Java技术栈的Web应用程序代码,尤其针对Struts2.1.8、Spring2.5和Hibernate3这三个经典框架的集成应用。这样的工具能够显著提高开发效率,减少手动...
Struts2.1.8+Spring2.5.6+Hibernate3.3.2是经典的Java Web开发框架组合,常被称为SSH。这三个框架协同工作,为开发者提供了强大的模型-视图-控制器(MVC)架构支持,使得企业级应用的开发更加高效和模块化。 Struts...
Struts2.1.8、JPA3.0(Hibernate实现)和Spring2.5是三个重要的Java开发框架,它们的整合为构建大型企业级应用提供了强大的支持。在这个压缩包中,包含了这些框架的核心库和其他相关依赖,方便开发者快速集成到自己...
这是一个基于老旧技术栈构建的中型BBS(Bulletin Board System,论坛)项目,采用的是Struts2.1.8作为MVC框架,JPA(Java Persistence API)3.0配合Hibernate实现数据持久化,Spring2.5进行依赖注入和业务逻辑管理,...
本软件生成Struts2.1.8,Spring2.5,Hibernate3代码。 生成实体类,Dao层,Biz层,Action,Jsp页面,struts.xml,applicationcontext.xml,hibernate.cfg.xml,web.xml。 支持关系映射。 若想更好的利用此软件加快开发效率...
Struts2.1.8、Hibernate3.2和Spring2.5是三个经典的Java开源框架,它们在企业级Web应用开发中被广泛使用。本文将详细介绍这三个框架的整合过程及核心概念,帮助开发者理解如何在实际项目中进行集成。 首先,Struts2...
Struts2.1.8、Spring2.5和Hibernate3是经典的Java企业级开发框架组合,通常被称为S2SH或SSH。这些框架协同工作,帮助开发者构建高效、可维护的Web应用程序。 Struts2作为MVC(模型-视图-控制器)框架,负责处理应用...
Struts2.1.8是Struts2的一个版本,它可能包含了一些特定的功能或修复了某些已知问题。 Spring框架是一个全面的后端解决方案,包括IOC(Inversion of Control,控制反转)和AOP(Aspect-Oriented Programming,面向...
struts2.1.8 + spring2.5.6(支持注解开发Annotations) + hibernate3.3.2(支持注解开发Annotations) + mysql-connector-java-5.1.7-bin.jar 精简完整版,测试可用
Struts2是用于处理MVC(Model-View-Controller)架构的框架,Spring是一个全面的后端管理框架,而Hibernate则是一个强大的对象关系映射(ORM)工具。下面我们将详细探讨这三个框架的整合过程以及它们如何协同工作。 ...
Struts2.1.8、Spring2.5.6与Hibernate3.3.2是Java Web开发中的三个重要框架,它们分别负责不同的职责,共同构建了一个功能强大的企业级应用架构。Struts2作为MVC(Model-View-Controller)框架,负责处理用户请求并...
标题 "Struts2.1.8+Spring3.0.2+hibernate3.5.1" 提供了一个经典的Java Web开发框架组合,其中包括了Struts2、Spring和Hibernate这三个核心组件。这个组合在过去的许多年里是企业级应用开发的首选,尤其在处理MVC...