Announcement Announcement Module
Collapse
No announcement yet.
Spring3 + Struts2 + Hibernate3 Integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring3 + Struts2 + Hibernate3 Integration

    I am new to Spring, I am trying to integrate Spring3 and Struts2 along with Hibernate 3.

    When i deploy my application into tomcat, i am getting the below exception.

    INFO: Initializing Spring root WebApplicationContext
    Jul 22, 2012 6:40:31 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    org.springframework.beans.factory.BeanDefinitionSt oreException: 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]
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:341)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:302)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:174)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:209)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:180)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)



    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

    <display-name>Rediminds :: Spring3-Struts2-Hibernate3</display-name>

    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.Stru tsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>
    </web-app>


    I have the applicationContext.xml with all the spring beans and hibernate related configuration in resources folder of my application's pom structure. when the war is deployed in tomcat the applicationcontext.xml is under WEB-INF/classes folder.

    Please suggest me about this error.

  • #2
    Originally posted by dh_krishna View Post
    I am new to Spring, I am trying to integrate Spring3 and Struts2 along with Hibernate 3.

    When i deploy my application into tomcat, i am getting the below exception.

    [I]INFO: Initializing Spring root WebApplicationContext
    Jul 22, 2012 6:40:31 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    org.springframework.beans.factory.BeanDefinitionSt oreException: 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]
    at

    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>
    </web-app>


    Please suggest me about this error.
    You either need to put it on default location, WEB-INF/applicationContext.xml or define alternative locations in your web.xml, e.g.

    <context-param>
    * * <param-name>contextConfigLocation</param-name>
    * * <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

    <listener>
    * * <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
    </listener>

    Hope that helps!

    Comment


    • #3
      I already have applicationContext in place

      I am getting the exception when the applicationContext.xml is in WEB-INF folder in the server's exploded war.

      Comment


      • #4
        Originally posted by dh_krishna View Post
        I am getting the exception when the applicationContext.xml is in WEB-INF folder in the server's exploded war.
        What is the exception?
        What is the location of your applicationContext.xml file?
        Did you try renaming the name of the file, and configuring it in web.xml file (just to play and to see that the names are picked up by the context loader)?

        Comment

        Working...
        X