Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:18:18+00:00 2026-06-17T16:18:18+00:00

I have following configuration web.xml: <!DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN

  • 0

I have following configuration
web.xml:

    <!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >



<web-app>

  <servlet>
    <servlet-name>minapp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>minapp</servlet-name>
    <url-pattern>hello.htm</url-pattern>
  </servlet-mapping>

   <servlet>
    <servlet-name>register</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>register</servlet-name>
    <url-pattern>/register/*</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>
      index.jsp
    </welcome-file>
  </welcome-file-list>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
</web-app>

applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="myDataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">

        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/minapp" />
        <property name="username" value="root" />
        <property name="password" value="verysecret" />
    </bean>


    <bean id="myUserDAO" class="no.java.UserDAOImpl">
        <property name="DataSource" ref="myDataSource"/>
    </bean>

    <bean name="/register/register.htm" class="no.java.RegistrationController" >
        <property name="UserDAO" ref="myUserDAO" />
    </bean>

</beans>

setter for RegistrationController

private UserDAO userDAO;

public void setUserDAO(UserDAO userDAO) {
    System.out.println("dao set");
    if (userDAO == null){

        System.out.println("dao null");
    }
    this.userDAO = userDAO;
}

setter for UserDAOImpl:

private DataSource dataSource;

    public void setDataSource(DataSource source){
        System.out.println("data source setter called");
        this.dataSource=source;

    }

And neither the RegistrationController setter nor the UserDAOImpl setter are called.
I have a feeling that i might have misplaced the configuration, but due to the complexity of Spring documentation i cant get what i have done wrong.
as far as i understand the contextConfigLocation should point spring to the applicationContext.xml , and that file should do some magic in order to setup the database connection, but it does not.
I’d be very grateful for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:18:20+00:00Added an answer on June 17, 2026 at 4:18 pm

    You need to add the context loader to your web.xml also, to fire up the ApplicationContext independant of the Dispatcher Servlets.

    <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>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In web.xml I have the following: <servlet> <description>JAX-WS endpoint - EARM</description> <display-name>jaxws-servlet</display-name> <servlet-name>jaxws-servlet</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
I have the following configuration file for NHibernate : <?xml version=1.0 encoding=utf-8 ?> <hibernate-configuration
I have the following log4j.xml configuration: <log4j:configuration> <appender name = CONSOLE class = org.apache.log4j.ConsoleAppender>
I have the following virtual host configuration <VirtualHost petyo.net:443> ServerAdmin m@petyo.net DocumentRoot /home/ren/public/ <Directory
In my web.xml I have the following mapping <servlet-mapping> <servlet-name>mySite</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>mySite</servlet-name>
I have the following in my web.config: <?xml version=1.0 encoding=utf-8?> <!-- For more information
Most tutorials propose a default JSF configuration similar to the following web.xml: <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
I have a Java web application that currently uses Log4J for logging. I'd like
I'm using sprint 3.1 profiles and have the following code in my web.xml <context-param>
I have following web.xml. my jsf tags are rendered fine outsite folder /Pages but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.