Announcement Announcement Module
Collapse
No announcement yet.
Error registering bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error registering bean

    Hello,
    I get the following error in my web browser:

    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name 'springappController' defined in ServletContext resource [/WEB-INF/FinalSpring-servlet.xml]: Bean class [SpringappController] not found; nested exception is java.lang.ClassNotFoundException: SpringappController

    I've got the following code in my FinalSpring-servlet.xml :

    Code:
     <beans>
        <bean id="springappController" class="SpringappController"/>
    
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="/hello.htm">springappController</prop>
                </props>
            </property>
        </bean>
    </beans>
    And I've got a class named SpringappController.java containing folowing code:

    Code:
    public class SpringappController implements Controller &#123;
    
        public ModelAndView handleRequest&#40;HttpServletRequest request, HttpServletResponse response&#41;
                throws ServletException, IOException &#123;
            return new ModelAndView&#40;""&#41;;
        &#125;
    &#125;
    Is there anyone familiar with this error-code?[/code]

  • #2
    Is it really in the default package? It's possible (although unlikely) that's the problem...

    It's bad practice to use the default package, so this might be a good place to start looking.

    You could also try to load the context outside the webapp, with ClassPathXmlApplicationContext or the like to test loading the class.

    Comment


    • #3
      The springappController.java class is not in the default package, it stands in the package finalspring.

      Comment

      Working...
      X