0
votes

mvc-dispatcher-servlet.xml

<bean class="com.springframework.BlogController">
<property name="formView" value="Welcome" />
<property name="successView" value="Home" />

<!-- Mapping validator -->
<property name="validator">
    <bean class="com.springframework.BloggerValidator" />
</property>

Error:

SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping#0' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.springframework.BlogController] for bean with name 'com.springframework.BlogController#0' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.springframework.BlogController Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.springframework.BlogController] for bean with name 'com.springframework.BlogController#0' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.springframework.BlogController at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method)

1
Is the class BlogController in a jar?Harshul Pandav
No. BlogController is present in the package com.springframeworkgunjan ragtah

1 Answers

0
votes

Cannot find class [com.springframework.BlogController] for bean with name 'com.springframework.BlogController'

No class called com.springframework.BlogController on your webapp's classpath.

Check if the qualified classname is correct in /WEB-INF/"*".xml

Or, check if /WEB-INF/classes directory in missing.