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 7278749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:55:02+00:00 2026-05-28T22:55:02+00:00

javax.servlet.ServletException: Error creating bean with name ‘userService’ defined in class path resource [applicationContext.xml]: Cannot

  • 0
javax.servlet.ServletException: Error creating bean with name 'userService' defined in class path resource [applicationContext.xml]:
Cannot resolve reference to bean 'helloDao' while setting bean property 'helloDao';
nested exception is
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloDao' defined in class path resource [applicationContext.xml]: Initialization of bean failed;
nested exception is
    org.springframework.beans.InvalidPropertyException: Invalid property 'jdbcTemplate' of bean class [dao.HelloDaoImpl]: No property 'jdbcTemplate' found

I’m getting this exception again and again but could not find the reason yet..
I’m attaching my necessary files for making it more understandable..

[web.xml]

<web-app>
    <display-name>helloWorld</display-name>

    <listener>
        <listener-class>
            utils.listener.HelloContextListener
        </listener-class>
    </listener>

    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>
            org.apache.struts.action.ActionServlet
        </servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Struts Action Servlet Mapping -->
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.me</url-pattern>
    </servlet-mapping>


    <welcome-file-list>
        <welcome-file>/jsps/homepage.jsp</welcome-file>
    </welcome-file-list>
</web-app>

[struts-config.xml]

<struts-config>

    <form-beans>
        <form-bean name="formBean" type="ui.forms.UserRegisterForm"></form-bean>
    </form-beans>

    <global-forwards>
        <forward name="home" path="/jsps/homepage.jsp"></forward>
    </global-forwards>

    <action-mappings>
        <action path="/register" type="ui.actions.UserRegisterAction" name="formBean" validate="true" input="/jsps/homepage.jsp">
            <forward name="success" path="/jsps/infoadded.jsp"></forward>
            <forward name="error" path="/jsps/underConstruction.jsp"></forward>
            <forward name="error2" path="/jsps/userinfo.jsp"></forward>
    </action>

    <action path="/home" forward="/jsps/homepage.jsp"></action>
    </action-mappings>
</struts-config>

[applicationContext.xml]

<beans>

    <bean id="userService" class="service.UserServiceImpl" init-method="initialize">
        <property name="helloDao">
            <ref bean="helloDao"/>
        </property>
    </bean>

    <bean id="helloDao" class="dao.HelloDaoImpl">
        <property name="jdbcTemplate">
            <ref bean="jdbcTemplate"/>
        </property>
    </bean>

    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <constructor-arg>
            <ref bean="dataSource"/>
        </constructor-arg>
    </bean>

     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://localhost:3306/helloworld" />
      <property name="username" value="root" />
      <property name="password" value="" />
     </bean>


</beans>

[homepage.jsp]

<body>
    <form action="register.me" method="post">
    <pre>
    Name        :   <input type="text" name="userName" >
    Password    :   <input type="text" name="userPassword" >
                    <input type="submit" value="Click to Register">
    </pre>
    </form>
</body>

[all java classes]

public class UserRegisterAction extends Action {
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        RegisterUser user=new RegisterUser();
        UserRegisterForm form2=(UserRegisterForm)form;
        user.setM_userName(form2.getM_userName());
        user.setM_userPassword(form2.getM_userPassword());

        int i= ((IUserService)HelloServiceFactory.getUserServices()).addNewUser(user);
        if(i==1){
            return mapping.findForward("success");
        }
        else {
            request.setAttribute("Output", "Wrong Credentials");
            return mapping.findForward("error");
        }
        }
}

public class HelloContextListener implements ServletContextListener {

    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void contextInitialized(ServletContextEvent arg0) {

        ClassPathResource classPathResource=new ClassPathResource("applicationContext.xml");
        XmlBeanFactory beanFactory=new XmlBeanFactory(classPathResource);
        HelloServiceFactory.setBeanFactory(beanFactory);
    }

}

public class HelloServiceFactory {

    private static XmlBeanFactory beanFactory;

    public static XmlBeanFactory getBeanFactory() {
        return beanFactory;
    }

    public static void setBeanFactory(XmlBeanFactory beanFactory) {
        HelloServiceFactory.beanFactory = beanFactory;
    }

    public static IUserService getUserServices(){

        return (IUserService)getBeanFactory().getBean("userService");
    }
}

public class UserRegisterForm extends ActionForm {
    /**
     * 
     */

private static final long serialVersionUID = 1L;

private String m_userName;

private String m_userPassword;

public String getM_userName() {
        return m_userName;
    }

public void setM_userName(String m_userName) {
        this.m_userName = m_userName;
    }

public String getM_userPassword() {
        return m_userPassword;
    }

public void setM_userPassword(String m_userPassword) {
        this.m_userPassword = m_userPassword;
    }


}


public class UserServiceImpl implements IUserService {

    private IHelloDao m_dao;
    public IHelloDao getM_dao() {
        return m_dao;
    }
    public void setM_dao(IHelloDao m_dao) {
        this.m_dao = m_dao;
    }
    public void initialize() {

    }

    public int addNewUser(RegisterUser user) throws Exception {
        int stat=0;
        try {
            stat=m_dao.addNewUser(user);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return stat;
    }


}

public interface IUserService {

    public int addNewUser(RegisterUser user)throws Exception;
}

public class RegisterUser {

private static String m_userName;
private static String m_userPassword;
 public String getM_userName() {
        return m_userName;
    }
 public void setM_userName(String m_userName) {
        RegisterUser.m_userName = m_userName;
    }
 public String getM_userPassword() {
        return m_userPassword;
    }
 public void setM_userPassword(String m_userPassword) {
        RegisterUser.m_userPassword = m_userPassword;
    }
}

public class HelloDaoImpl implements IHelloDao{

    private JdbcTemplate template;
    public JdbcTemplate getTemplate() {
        return template;
    }
    public void setTemplate(JdbcTemplate template) {
        this.template = template;
    }

    public int addNewUser(RegisterUser user) throws Exception {
        Object []a={user.getM_userName(),user.getM_userPassword()};
        return template.update("insert into user(uName, uPasswordv) values (?,?)", a);
    }

}

public interface IHelloDao {
    public int addNewUser(RegisterUser user)throws Exception;
}

and what i got at the very bottom of the error page is

org.springframework.beans.InvalidPropertyException: Invalid property 'jdbcTemplate' of bean class [dao.HelloDaoImpl]: No property 'jdbcTemplate' found

to me it all looks well
but i believe perception of experts always works well so i’m eagerly looking for suggestion..
please do a little effort which can help me a lot
thanks in advance…

  • 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-05-28T22:55:02+00:00Added an answer on May 28, 2026 at 10:55 pm

    In your application context you have defined following dependency.

    <bean id="helloDao" class="dao.HelloDaoImpl">
        <property name="jdbcTemplate">
            <ref bean="jdbcTemplate"/>
        </property>
    </bean>
    

    You are probably missing setter for field jdbcTemplate in HelloDaoImpl. Please check.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error: javax.servlet.ServletException: bean not found within scope on a page with
Why do I keep getting this error: javax.servlet.ServletException: java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00904: PURCHASE_PRICE: invalid identifier As
Good day! I tried using JSTL in java but there's an error: exception javax.servlet.ServletException:
I get the following error: javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate()
spring-servlet.xml setting up theme beans: <bean id=themeSource class=org.springframework.ui.context.support.ResourceBundleThemeSource> <property name=basenamePrefix value=theme- /> // also
I am using a javax.servlet.http.HttpServletRequest to implement a web application. I have no problem
Why is javax.servlet.SingleThreadModel deprecated?
How can i check whether a package like javax.servlet.* exists or not in my
I want to write a JAR file that makes use of the javax servlet
Is it possible to derive the preferred language from a httpsession object (javax.servlet.http.HttpSession) ?

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.