无法初始化类org.springframework.faces.webflow.JsfRuntimeInformation

时间:2014-09-20 15:27:37

标签: eclipse spring maven

在webflow-config.xml中的Maven项目中我在webflow-config.xml

中遇到以下错误
Error occured processing XML 'Could not initialize class org.springframework.faces.webflow.JsfRuntimeInformation'.

这是我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example.j2eeapp</groupId>
  <artifactId>j2eeapplication</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>J2EE Applications Example</name>

  <build>
  <plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
    </plugin>
  </plugins>
</build>

<repositories>
        <repository>
                <id>prime-repo</id>
                <name>PrimeFaces Maven Repository</name>
                <url>http://repository.primefaces.org</url>
        </repository>
  </repositories>


  <dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.3.6.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>5.1.2.Final</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12-beta-1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-webflow</artifactId>
        <version>2.4.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-faces</artifactId>
        <version>2.4.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>4.1.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.1.0</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.8-02</version>
    </dependency>
    <dependency>
        <groupId>com.sun.facelets</groupId>
        <artifactId>jsf-facelets</artifactId>
        <version>1.1.13</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.8-02</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>20030821.193421</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.7</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>4.1.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>2.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.2.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.2.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.0</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.6.Final</version>
    </dependency>
  </dependencies>
</project>

和webflow-config.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:webflow="http://www.springframework.org/schema/webflow-config"
           xmlns:faces="http://www.springframework.org/schema/faces"
           xsi:schemaLocation="
                        http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/webflow-config
                        http://www.springframework.org/schema/webflow-config/spring-webflow-config.xsd
                        http://www.springframework.org/schema/faces
                        http://www.springframework.org/schema/faces/spring-faces.xsd">


        <bean id="jpaFlowExecutionListener" class="org.springframework.webflow.persistence.JpaFlowExecutionListener">
                <constructor-arg ref="entityManagerFactory" />
                <constructor-arg ref="transactionManager" />
        </bean>

        <bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />

        <webflow:flow-executor id="flowExecutor">
                <webflow:flow-execution-listeners>
                        <webflow:listener ref="jpaFlowExecutionListener" />
                        <webflow:listener ref="facesContextListener"/>
                </webflow:flow-execution-listeners>
        </webflow:flow-executor>                        

        <webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/flows">
                <webflow:flow-location-pattern value="/**/*-flow.xml" />
        </webflow:flow-registry>        

        <faces:flow-builder-services id="facesFlowBuilderServices" development="true" />

        <faces:resources />



        <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
                <property name="order" value="1"/>
                <property name="flowRegistry" ref="flowRegistry" />
                <property name="defaultHandler">
                        <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
                </property>
        </bean>

        <bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
                <property name="flowExecutor" ref="flowExecutor" />
        </bean>  

                <bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
                <property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
                <property name="prefix" value="/WEB-INF/" />
                <property name="suffix" value=".xhtml" />
        </bean>

        <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />     

</beans>

此错误与行<faces:resources />

有关

我是这个主题的新手,我不知道该怎么做。

错误日志:

  

java.lang.NoClassDefFoundError:javax / el / ELContext at   java.lang.Class.getDeclaredMethods0(Native Method)at   java.lang.Class.privateGetDeclaredMethods(Unknown Source)at   java.lang.Class.getDeclaredMethods(未知来源)at   org.springframework.util.ReflectionUtils.findMethod(ReflectionUtils.java:159)     在   org.springframework.util.ReflectionUtils.findMethod(ReflectionUtils.java:141)     在   org.springframework.faces.webflow.JsfRuntimeInformation。(JsfRuntimeInformation.java:73)     在   org.springframework.faces.config.ResourcesBeanDefinitionParser.parse(ResourcesBeanDefinitionParser.java:52)     在   org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)     在   org.springframework.ide.eclipse.beans.core.internal.model.namespaces.DelegatingNamespaceHandlerResolver $ ElementTrackingNamespaceHandler.parse(DelegatingNamespaceHandlerResolver.java:177)     在   org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1424)     在   org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig $ ErrorSuppressingBeanDefinitionParserDelegate.parseCustomElement(BeansConfig.java:1403)     在   org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1414)     在   org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:187)     在   org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig $ ToolingFriendlyBeanDefinitionDocumentReader.doRegisterBeanDefinitions(BeansConfig.java:1333)     在   org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110)     在   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)     在   org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig $ 2.registerBeanDefinitions(BeansConfig.java:406)     在   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)     在   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)     在   org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig $ 2.loadBeanDefinitions(BeansConfig.java:390)     在   org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)     在   org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig $ 3.call(BeansConfig.java:449)     在   org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig $ 3.call(BeansConfig.java:1)     在java.util.concurrent.FutureTask.run(未知来源)at   java.util.concurrent.Executors $ RunnableAdapter.call(Unknown Source)     在java.util.concurrent.FutureTask.run(未知来源)at   java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)at   java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知来源)at   java.lang.Thread.run(未知来源)引起:   java.lang.ClassNotFoundException:javax.el.E​​LContext at   java.net.URLClassLoader $ 1.run(未知来源)at   java.net.URLClassLoader $ 1.run(未知来源)at   java.security.AccessController.doPrivileged(Native Method)at   java.net.URLClassLoader.findClass(未知来源)at   java.lang.ClassLoader.loadClass(未知来源)at   java.lang.ClassLoader.loadClass(未知来源)... 29更多

1 个答案:

答案 0 :(得分:2)

我解决了这个问题。弹簧面2.4.1。 <faces:resources />不是必需的。我的webflow-config.xml和application-context.xml配置错误。弹簧面2.4.1的配置配置,你可以在这里找到:

Documentation

在这里:

13.3. Upgrading from Spring Web Flow 2.3