问题描述
为了将JSF与Spring集成,我在web.xml
中添加了以下几行:
To integrate JSF with Spring I have added these lines in web.xml
:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.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>
并且我已经使用Maven添加了所有spring依赖项,但是当我运行项目时,我收到以下错误消息:
And I have added all the spring dependencies using Maven, but when I run the project I receive the following error messages:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
当我浏览文件夹/WEB-INF/lib
时,尽管在pom.xml
中声明了依赖关系,但没有找到JAR文件.
When I took a glance at the folder /WEB-INF/lib
I have found no JAR files, although dependencies are declared in the pom.xml
.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
我认为JAR文件未与草稿包装在一起的问题.你有解决的办法吗?
I think that the problem that the JAR's are not packaged with the draft.Do you have an idea how to fix it?
推荐答案
您如何运行项目?您使用m2eclipse吗?您是如何创建项目的?您是否将现有的Maven项目导入Eclipse?
How do you run the project? Do you use m2eclipse? How did you create the project? Did you import an existing Maven project into Eclipse?
依赖关系看起来不错,但是...什么是WEB-INF/lib
文件夹?到底在哪里? AFAIK,m2eclipse不会真正将罐子部署"到WEB-INF/lib
中(但是它将创建一个包含它们的自定义类路径).
The dependencies looks fine but... What WEB-INF/lib
folder? Where exactly? AFAIK, m2eclipse won't really "deploy" the jars into WEB-INF/lib
(but it will create a custom class path including them).
我不确定我是否理解你的意思.运行mvn install
会得到什么?战争看起来还好吗?您可以显示您的pom.xml
吗?
I'm not sure I understood what you mean. What do you get when running mvn install
? Does the war look ok? Could you actually show your pom.xml
?
这篇关于Eclipse不会将jar部署到WEB-INF/lib目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!