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

  • Home
  • SEARCH
  • 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 6471839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:16:17+00:00 2026-05-25T06:16:17+00:00

I have an XML configuration as follows: <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:aop=http://www.springframework.org/schema/aop xmlns:tx=http://www.springframework.org/schema/tx xmlns:context=http://www.springframework.org/schema/context xsi:schemaLocation=

  • 0

I have an XML configuration as follows:

    <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

   <context:component-scan base-package="bamAddressbook.service"/>
   <context:component-scan base-package="bamAddressbook.repository.addressbook"/>

And then in those packages I have the following classes:

@Service
public class BamService {
@Autowired
BamAddressbookDAO addressbookDao;

@Transactional
public void businessLogic() {
    Addressbook addressbook = new Addressbook();
    addressbookDao.makePeristent(addressbook);
}

}

@Repository
public class AddressbookDAOHibernate extends HibernateGenericDAO<Addressbook> implements BamAddressbookDAO {
@Override
public Addressbook getFromUser(User user) {
    throw new UnsupportedOperationException("Not supported yet.");
}

}

public interface BamAddressbookDAO extends InterfaceGenericDAO<Addressbook>{
   public Addressbook getFromUser(User user);
}

.

public interface InterfaceGenericDAO<T> {
   public T get(Long databaseID);
   public List<T> getAll();
   public void makePeristent(T entity);
   public void makeTransient(T entity);
}

I am getting no exceptions in the logs when I start the spring application context, yet when I try the following servlet it cannot find any beans, and I get a NoSuchBeanDefinitionException. Any bean I try to access which has been configured in XML seems to work fine:

public class BamServlet extends HttpServlet {

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(
                                                                    req.getSession().getServletContext());

    BamService bean = (BamService) context.getBean("bamService"); 
}

}

I am tearing my hair out with this problem!

  • 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-25T06:16:17+00:00Added an answer on May 25, 2026 at 6:16 am

    Change @Service to @Service(“bamService”) or change `

    BamService bean = (BamService) context.getBean("bamService"); `to

    BamService bean = context.getBean(BamService.class);
    

    and save your hair 🙂

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

Sidebar

Related Questions

I have the following log4j.xml configuration: <log4j:configuration> <appender name = CONSOLE class = org.apache.log4j.ConsoleAppender>
I have my web config as follows <?xml version=1.0?> <configuration> <appSettings/> <connectionStrings> <add name=MySqlConnection
I have an XML configuration file with a collection of strings like so: <SomeSetting>value</SomeSetting>
Question We have a large number of xml configuration files that we want merged
I have some values in a configuration file (XML file) with some values like
I have the following requirement: In C#2.0, Given a device configuration in xml format
I have the following configuration file for NHibernate : <?xml version=1.0 encoding=utf-8 ?> <hibernate-configuration
Say I have the following web.config: <?xml version=1.0 encoding=utf-8?> <configuration> <system.web> <authentication mode=Windows></authentication> </system.web>
I would like to have an xml config file as follows: <?xml version=1.0 encoding=utf-8
I have an XML configuration file, i want to pull one of the fields

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.