按照网上找来的资料搭建JBPM4.2的环境,写了个测试类,抛出异常如下:
17:23:10,421 INF | [DefaultCommandService] exception while executing command [email=org.jbpm.pvm.internal.cmd.DeployCmd@dfe303]org.jbpm.pvm.internal.cmd.DeployCmd@dfe303[/email]
java.lang.NullPointerException
at com.microsoft.jdbc.sqlserver.tds.TDSRPCParameter.initializeUserParam(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.addUserParametersToRPC(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2275)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2688)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java
at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java
at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java
at org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java
at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:141)
at org.jbpm.pvm.internal.repository.ProcessDeployer.checkKey(ProcessDeployer.java:134)
at org.jbpm.pvm.internal.repository.ProcessDeployer.deploy(ProcessDeployer.java
at org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java
at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java
at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java
at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java
at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java
at test.config.ServicesTest.testObtainServicesAndDeployProcess(ServicesTest.java
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
### EXCEPTION ###########################################
17:23:10,421 FIN | [HibernateSessionResource] ----- rolling back hibernate tx 11595237 --测试代码如下:
Configuration configuration = new Configuration();
    ProcessEngine processEngine = configuration.buildProcessEngine();
   
    RepositoryService repositoryService = processEngine.getRepositoryService();
    ExecutionService executionService = processEngine.getExecutionService();
    TaskService taskService = processEngine.getTaskService();
    HistoryService historyService = processEngine.getHistoryService();
    ManagementService managementService = processEngine.getManagementService();
    
    // 开始部署一个新的流程文件
    String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("test.jpdl.xml").deploy();
    repositoryService.deleteDeployment(deploymentId);我把JBPM.jar和JBPM lib里的jar包导入了,也导入了SQL驱动,
jbpm.hibernate.cfg.xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
  
     <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
     <property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
     <property name="hibernate.connection.url">jdbc:microsoft:sqlserver://localhost:1433;databaseName=JBPM4</property>
     <property name="hibernate.connection.username">sa</property>
     <property name="hibernate.connection.password">sa</property>
     <property name="hibernate.hbm2ddl.auto">create-drop</property>
     <property name="hibernate.format_sql">true</property>
     
     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />
     <mapping resource="jbpm.history.hbm.xml" />
     <mapping resource="jbpm.task.hbm.xml" />
     <mapping resource="jbpm.identity.hbm.xml" />
     
  </session-factory>
</hibernate-configuration>

解决方案 »

  1.   

    jbpm 好像不支持sql server。
      

  2.   

    不会吧  jbpm和hibernate结合的 hibernate有什么不支持的?
      

  3.   

    说实话,我也正在用jbpm,没办法课题要求。
    至少在jbpm的安装目录(\jbpm-4.3\install\jdbc)中没有针对sqlserver的文件,我记得前几天看过官方的文档,也没提到支持sqlserver。jbpm令人郁闷死啦,非得用jre。如果楼主遇到构建processEngine出现空指针异常的问题,注意看jbpm提供的examples。