Search code examples
javaspringhibernatemavennetbeans-8

Servlet-Context not found : Spring 4 Hibernate 4 Maven JSF PrimeFaces in NetBeans


To Start : - I am a very very beginner in J2e, And this combination is almost perfect for a powerfull application, but is also perfect to blow a J2e starter. - I searched for MANY answers and NO, none corrected this.

It is as simple as this : - I repeated creating the app 8 times between Netbeans 8 and Eclipse Mars, I have all depedencies. The problem is with Servlet-Context. Tomcat throws a FileNotFound Error and once I remove this :

    <listener>
   <listener-class>
           org.springframework.web.context.ContextLoaderListener
   </listener-class>
 </listener>
 <listener>
   <listener-class>
           org.springframework.web.context.request.RequestContextListener
   </listener-class>
</listener>

it works BUT shows not data from Database, (My whole app now is about showing user id with id = 1 on Database.)

The error in Tomcat :

    org.apache.catalina.core.StandardContext.listenerStart Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
 org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

Can anyone please Help ?


Solution

  •      <listener>
       <listener-class>
               org.springframework.web.context.request.RequestContextListener
       </listener-class>
    </listener>
    

    Removing this does the job. Spring 4 Problem.