views:

101

answers:

2

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>

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

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>

I think that the problem that the JAR's are not packaged with the draft. Do you have an idea how to fix it?

A: 

Both org.springframework.web.context.ContextLoaderListener and org.springframework.web.context.request.RequestContextListener are present in the spring-web package, at least on version 2.5 which is the most common.

Also, make sure you're including the following in your pom.xml

    <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring</artifactId>
         <version>${your.spring.version}</version>
    </dependency> 
StudiousJoseph
in fact I'm using Spring 3.0.3 and there is more spring.jar, this file is divided into several modulesI include "org.springframework.Spring-web.jar" ..but the problem that files jars are not deployed in WEB-INF/lib and I think they are not packaged with the project and it is probably the problem
A: 

And I have added all the spring dependencies using Maven, but when I run the project I receive the following error messages (...)

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?

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

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).

I think that the problem that the JAR's are not packaged with the draft. Do you have an idea how to fix it?

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?

Pascal Thivent
Thnak you for the replyregarding maven, I use m2eclipse and when I do mvn: install I receive the message BUILD SUCCESSFUL.But when I run the web project i receive errors messages indicating that some classes does not exists although they are included in the jars.So I found that Eclipse does not deploy the dependenciesSo I found that Eclipse does not deploy the dependencieseven the jar of the project does not contains any jars and it has a small size (18 kb)
@user405458: As I wrote, does the war created by maven (in target) looks ok? That's the first thing to confirm.
Pascal Thivent