我整了2天了,搭建activit

南无名 发布于 2015/04/20 09:15
阅读 1K+
收藏 0
这是控制台输出信息:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:151)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1514)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:252)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:354)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1094)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:989)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
        
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
        at org.activiti.engine.impl.db.DbSqlSession.dbSchemaUpdate(DbSqlSession.java:770)
        
四月 20, 2015 8:48:43 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class com.core.mvc.ContextListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:151)


这是spring的配置文件 

<?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:tx="http://www.springframework.org/schema/tx"
        xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"

        xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
        http://www.springframework.org/schema/context
    http://www.springframework.org/s ... ing-context-3.2.xsd
        http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">

        <!-- 自定义SpringConfig配置类 -->
        <bean id="springConfig" class="com.core.config.SpringConfig">
                <property name="printStackLog" value="true" />
                <property name="outCGLIBCall" value="false" />
        </bean>
        <!-- 自动扫描包名 -->
        <aop:aspectj-autoproxy />
        <context:component-scan base-package="com.app,com.core" />
        
        <!-- 视图解释类 -->
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                <property name="prefix" value="" />
                <property name="suffix" value="" />
                <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
        </bean>

        <!-- 注解请求映射  -->
        <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
                <property name="messageConverters">
                        <list>
                                <ref bean="byteArray_hmc" />
                                <ref bean="string_hmc" />
                                <ref bean="resource_hmc" />
                                <ref bean="source_hmc" />
                                <ref bean="xmlAwareForm_hmc" />
                                <ref bean="jaxb2RootElement_hmc" />
                                <ref bean="jackson_hmc" />
                        </list>
                </property>
        </bean>
        <bean id="byteArray_hmc" class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
        <bean id="string_hmc" class="org.springframework.http.converter.StringHttpMessageConverter" />
        <bean id="resource_hmc" class="org.springframework.http.converter.ResourceHttpMessageConverter" />
        <bean id="source_hmc" class="org.springframework.http.converter.xml.SourceHttpMessageConverter" />
        <bean id="xmlAwareForm_hmc" class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter" />
        <bean id="jaxb2RootElement_hmc" class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" />
        <bean id="jackson_hmc" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
        
        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" >
          
        </bean>

        <!-- 注入兰截器 -->
        <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
                <property name="interceptors">
                        <list>
                                <bean class="com.core.mvc.MyPermissionsInteceptor" />
                        </list>
                </property>
        </bean>

        <!-- 总错误处理 -->
        <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
                <property name="defaultErrorView">
                        <value>/webpage/error/error.jsp</value>
                </property>
                <property name="defaultStatusCode">
                        <value>500</value>
                </property>
                <property name="warnLogCategory">
                        <value>org.springframework.web.servlet.handler.SimpleMappingExceptionResolver</value>
                </property>
        </bean>

        <!-- 工具类,用来得到spring中的bean -->
        <bean id="springContextHolder" class="com.core.mvc.SpringContextHolder" />

        <!-- 对静态资源文件的访问-->
        <mvc:default-servlet-handler />


        <!-- 引入数据库连接池配置参数文件开始 -->
        <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                <property name="location">
                        <value>classpath:jdbc.properties</value>
                </property>
        </bean>

        <!-- 数据源 ,DBCP连接池-->
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
                <property name="driverClassName" value="${jdbc.driverClassName}" />
                <property name="url" value="${jdbc.url}" />
                <property name="username" value="${jdbc.username}" />
                <property name="password" value="${jdbc.password}" />
                <property name="initialSize" value="${jdbc.initialSize}" />
                <property name="maxActive" value="${jdbc.maxActive}" />
                <property name="maxIdle" value="${jdbc.maxIdle}" />
                <property name="maxWait" value="${jdbc.maxWait}" />
                <property name="poolPreparedStatements" value="${jdbc.poolPreparedStatements}" />
        </bean>

        <!-- JDBC模板 -->
        <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
                <property name="dataSource" ref="dataSource" />
        </bean>

        <!-- 事务管理器 -->
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
                <property name="dataSource" ref="dataSource" />
        </bean>

        <!-- 用注解来实现事务管理 -->
        <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
        
        <!-- 引入的activiti配置文件 -->
    <import resource="classpath:activiti.cfg.xml"/>
</beans>

这是activiti的配置文件
<beans xmlns="http://www.springframework.org/schema/beans" 
       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">

<!-- Activiti处理引擎的配置,交由Spring管理 -->
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
                  
                  <!-- 配置数据源,和系统使用同一个数据源 -->
                  <property name="dataSource" ref="dataSource" />
                  <property name="databaseSchemaUpdate" value="true" />
                  <property name="jobExecutorActivate" value="false" />
                  <!-- 统一的事务管理 -->
                  <property name="transactionManager" ref="transactionManager" />
                  <property name="activityFontName"  value="宋体" />
                  <property name="labelFontName"  value="宋体" />
  </bean>

  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
          <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>
  <!-- 定义Activiti主要Service -->
        <bean id="repositoryService" factory-bean="processEngine"
                factory-method="getRepositoryService" />
        <bean id="runtimeService" factory-bean="processEngine"
                factory-method="getRuntimeService" />
        <bean id="taskService" factory-bean="processEngine"
                factory-method="getTaskService" />
        <bean id="historyService" factory-bean="processEngine"
                factory-method="getHistoryService" />
        <bean id="managementService" factory-bean="processEngine"
                factory-method="getManagementService" />
        <bean id="formService" factory-bean="processEngine"
                factory-method="getFormService" />
        <bean id="identityService" factory-bean="processEngine"
                factory-method="getIdentityService" />
</beans>
谢谢 大侠 !我是初学activiti对框架搭建也不会很熟悉 ,求大侠指点
加载中
返回顶部
顶部