Announcement Announcement Module
Collapse
No announcement yet.
Application Scope beans are not found by Servlet Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Application Scope beans are not found by Servlet

    Hello,

    it seems that the beans from the Application scope are not available to the servlet and I wonder why. This is what I did:

    Snippet of web.xml:

    <servlet>
    <servlet-name>context</servlet-name>
    <servlet-class>
    org.springframework.web.context.ContextLoaderServl et
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>


    Snippet of /WEB-INF/applicationContext.xml:

    <bean id="nodeFormValidator"
    class="de.galt.sltreeng.validators.NodeFormValidat or"/>

    Snippet of controller bean definition in the servlet.xml:

    <property name="validator">
    <ref bean="nodeFormValidator"/>
    </property>

    On startup, an exception is thrown, that the validator bean is not found. When I define the validator bean in the servlet.xml everything works fine.

    I would however like to be able to put all my delegate(s), the validators and some other applicationwide used beans in the application context.

    Can anybody help?

    Greetings

    Michael Kastner

  • #2
    Michael --

    could it be that you forgot to add the contextConfigLocation to your web.xml?

    Code:
    <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>
               /WEB-INF/applicationContext.xml 
    </param-value>
    </context-param>
    Rgrds, T.

    Comment

    Working...
    X