Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CannotLoadBeanClassException  RSS feed

k sabeerdeen
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to call a method isValidUserId() in from

i am getting the following exception:

Cannot find class [LoginImplementation] for bean with name 'isValidUserId'
defined in class path resource [BusinessObject.xml];
nested exception is java.lang.ClassNotFoundException: LoginImplementation

i am using eclipse 3.4

public static void main(String args[])

LoginController loginController = LoginFactory.isValidUserId();
String result = loginController.isValidUserId(loginDTO);
}catch(Exception e){
// here i got the exception
public interface LoginController{
public Collection isValidUserId() throws Exception;

public class LoginFactory {

public static LoginController isValidUserId() throws Exception {
ClassPathResource resource = new ClassPathResource("BusinessObject.xml");
BeanFactory factory = new XmlBeanFactory(resource);
return (LoginController) factory.getBean("isValidUserId");


<bean id="isValidUserId" class="com.visiontss.smartweb.spring.LoginImplementation"/>
public class LoignImplementation implements LoginController {
public Collection isValidUserId() throws Exception {
System.out.println("Yes Valid user");
thanks in advance
Mark Secrist
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ultimately, it seems like it comes down to the Spring container not being able to locate the class LoginImplementation. Here are a couple of things to consider.
  • You may have mistyped the full path (package + class name) in the bean definition
  • A classfile may not have been generated since it looks like the isValidUserId method on LoginImplementation should return a value since your method signature says it does

  • Mark
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!