我正在尝试将war文件部署到WildFly Full 10.0.0.Final(WildFly Core 2.0.10.Final)服务器中。 但我在启动时遇到以下错误
启动控制台消息:
Source Document: Source Document: file:/home/dsm/Development/wildfly/standalone/deployments/DSM.war/WEB-INF/faces-config.xml Cause: Class 'org.springframework.web.jsf.el.SpringBeanFacesELResolver' is missing a runtime dependency: java.lang.NoClassDefFoundError: Failed to link org/springframework/web/jsf/el/SpringBeanFacesELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): Failed to link org/springframework/beans/factory/access/el/SpringBeanELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): javax/el/ELResolver Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Source Document: file:/home/dsm/Development/wildfly/standalone/deployments/DSM.war/WEB-INF/faces-config.xml Cause: Class 'org.springframework.web.jsf.el.SpringBeanFacesELResolver' is missing a runtime dependency: java.lang.NoClassDefFoundError: Failed to link org/springframework/web/jsf/el/SpringBeanFacesELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): Failed to link org/springframework/beans/factory/access/el/SpringBeanELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): javax/el/ELResolver Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: Source Document: file:/home/dsm/Development/wildfly/standalone/deployments/DSM.war/WEB-INF/faces-config.xml Cause: Class 'org.springframework.web.jsf.el.SpringBeanFacesELResolver' is missing a runtime dependency: java.lang.NoClassDefFoundError: Failed to link org/springframework/web/jsf/el/SpringBeanFacesELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): Failed to link org/springframework/beans/factory/access/el/SpringBeanELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): javax/el/ELResolver Caused by: com.sun.faces.config.ConfigurationException: Source Document: file:/home/dsm/Development/wildfly/standalone/deployments/DSM.war/WEB-INF/faces-config.xml Cause: Class 'org.springframework.web.jsf.el.SpringBeanFacesELResolver' is missing a runtime dependency: java.lang.NoClassDefFoundError: Failed to link org/springframework/web/jsf/el/SpringBeanFacesELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): Failed to link org/springframework/beans/factory/access/el/SpringBeanELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): javax/el/ELResolver Caused by: java.lang.NoClassDefFoundError: Failed to link org/springframework/web/jsf/el/SpringBeanFacesELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): Failed to link org/springframework/beans/factory/access/el/SpringBeanELResolver (Module \"org.springframework.spring:main\" from local module loader @2471cca7 (finder: local module finder @5fe5c6f (roots: /home/dsm/Development/wildfly/modules,/home/dsm/Development/wildfly/modules/system/layers/base))): javax/el/ELResolver"}}
我的POM看起来像这样:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_3.0_spec</artifactId>
<version>1.0.5.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.14</version>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jpa</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.9.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.0.RELEASE</version>
</dependency></code>
And I've added this to my faces-config.xml:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_3.0_spec</artifactId>
<version>1.0.5.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.14</version>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- PrimeFaces -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jpa</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.9.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.0.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.0.RELEASE</version>
</dependency></code>
我已将aloso包含在我的jboss-deployment.xml中:
&LT;模块名称=&#34; javax.el.api&#34;插槽=#&34;主&#34;&GT;
为什么我要为类javax.el.ELResolver获取java.lang.NoClassDefFoundError?该类绝对包含在jar文件jboss-el-api_3.0_spec-1.0.5.Final.jar中,它是WildFly模块的一部分(system / layers / base / javax / el / api / main)。 即使我在我的pom中包含另一个javax-el依赖项,我也会遇到同样的错误。如果我使用&#34;提供&#34;没有区别或不。
这个问题是如何引起的?如何解决?请帮忙!
答案 0 :(得分:0)
看起来,我至少找到了部署问题的解决方案。
我必须编辑wildfly / modules / org / springframework / spring / main / module的module.xml。它必须包含以下两行:
&LT; module name =“javax.el.api”/&gt;
&LT; module name =“javax.faces.api”/&gt;
之后,Wildfly能够找到这些课程。
现在,将spring bean依赖注入jsf会按预期工作。