Results 1 to 2 of 2

Thread: Exception on "No bean named 'simpleResourcePojo' is defined"

  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Angry Exception on "No bean named 'simpleResourcePojo' is defined"

    It works fine under eclipse environment as following on Spring annotation:

    main code:
    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "com/jgk/spring3/simple/resource/simple-annotated.xml",});

    SimpleResourcePojo pojo = (SimpleResourcePojo) context.getBean("simpleResourcePojo");

    and SimpleResourcePojo define:

    package com.jgk.spring3.simple.resource;
    @Component("simpleResourcePojo")
    public class SimpleResourcePojo {

    simple-annotated.xml:

    <context:component-scan base-package="com.jgk.spring3.simple.resource"/>


    But when I try to deploy code to run with java command like:

    java -classpath .;lib\* com.jgk.spring3.simple.resource.CheckSpringResourc e

    Then get error message about "No bean named 'simpleResourcePojo' is defined"

    Any one know what happened? how to set classpath?

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    1) Use code tags
    2) Read carefully the Spring Reference documentation.
    3)

    But when I try to deploy code to run with java command like:
    java -classpath .;lib\* com.jgk.spring3.simple.resource.CheckSpringResourc e
    Why? Use an IDE, there should appear the error messages (if any exists)
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •