spring - Activiti JSF Spring

标签 spring jsf-2 activiti bpmn

我是初学者!
运行xhtml页面时---->错误:
XML 解析错误:未找到元素
第 1 行,第 1 列
!!!
我使用tomcat服务器
Spring-Activiti.xml:

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

    <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClass" value="org.h2.Driver"/>
        <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000"/>
        <property name="username" value="sa"/>
        <property name="password" value=""/>
    </bean>

    <bean id="transactionManager"
          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="databaseType" value="postgres"/>
        <property name="dataSource" ref="dataSource"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="databaseSchemaUpdate" value="true"/>
        <property name="deploymentResources"
                  value="classpath*:bookorder.spring.bpmn20.xml"/>
        <property name="history" value="audit"/>
        <property name="jobExecutorActivate" value="false"/>
    </bean>

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration"/>
    </bean>

    <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="order" class="activiti.OrderService"/>

</beans>


面孔配置:

<application>
        <variable-resolver>org.springframework.web.jsf.SpringBeanVariableResolver</variable-resolver>
        <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
        <variable-resolver>
            org.springframework.web.jsf.DelegatingVariableResolver
        </variable-resolver>
    </application>


web.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">

    <!-- ************************* Spring  Related *********************************** -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/Spring-Activiti.xml
        </param-value>
    </context-param>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>
    <!-- ************************* Faces Related  *********************************** -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
    <session-config>
        <session-timeout>
            20
        </session-timeout>
    </session-config>

</web-app>


我发现了一段导致错误的代码

 <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"/>


请帮助我!
他你

最佳答案

您的文件缺少 xml header :< ? xml 版本=“1.0”编码=“UTF-8”? > (删除问号前的空格)

关于spring - Activiti JSF Spring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24230700/

相关文章:

java - 如何在单元测试中使用自定义 Spring 作用域 (SpringJUnit4ClassRunner)

java - Spring @Configuration 和 <context :component-scan/>

javascript - 无法从 Spring Boot 过滤器在 http header 中发送 "Unauthorized"

jsf - JSF行动与结果属性

jquery - JSF 中的页面卸载事件处理

java - JSF 数据表根据选择填充行

java - 基于注解的Spring Activiti ProcessEngine

java - SPRING REST 中与父类的响应

spring-boot - 带有 spring-boot 1.5.x 支持的 Activiti 7

java - 使用 Spring MVC 部署 Web 应用程序