There is so many of this error in stackoverflow but I could not resolver my issue from is. Below is my simple configurations :
context.xml from my TOMCAT server where I have configured a datasource for accessing my oracle 11g server
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!--Oracle DataSource-->
<Resource
name="jdbc/MonDataSource"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:orcl"
username="system"
password="Azerty123"
connectionProperties="SetBigStringTryClob=true"
accessToUnderlyingConnectionAllowed="true"
maxTotal="60"
maxIdle="20"
maxWaitMillis="10000"
/>
</Context>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
servlet-context.xml to show my bean configuration
<beans:bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<beans:property name="jndiName" value="java:comp/env/jdbc/MonDataSource"/>
</beans:bean>
<beans:bean id="ArticleDAO" class="com.projet.testjdbc.ArticleDAOImpl">
<beans:constructor-arg>
<beans:ref bean="dataSource" />
</beans:constructor-arg>
</beans:bean>
</beans:beans>
I don't know if it'll be usefull but you have below my controller action
@Controller
public class HomeController {
@Autowired
private ArticleDAO aricleDAO;
@RequestMapping(value="/liste")
public ModelAndView home() throws IOException{
List<Article> listArticles = aricleDAO.list();
ModelAndView model = new ModelAndView("home");
model.addObject("articleListe", listArticles);
return model;
}
}
EXCEPTIONS MESSAGES EXCERPT
exception javax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79 ...
root cause org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'homeController': Unsatisfied dependency expressed through field 'aricleDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ArticleDAO': Failed to introspect bean class [com.projet.testjdbc.ArticleDAOImpl] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ...
root cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ArticleDAO': Failed to introspect bean class [com.projet.testjdbc.ArticleDAOImpl] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:269) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1118) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1091) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ...
root cause java.lang.NoClassDefFoundError: org/springframework/jdbc/core/RowMapper java.lang.Class.getDeclaredMethods0(Native Method) java.lang.Class.privateGetDeclaredMethods(Unknown Source) java.lang.Class.getDeclaredMethods(Unknown Source) org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510) org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:247) ...
root cause java.lang.ClassNotFoundException: org.springframework.jdbc.core.RowMapper
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) java.lang.Class.getDeclaredMethods0(Native Method) java.lang.Class.privateGetDeclaredMethods(Unknown Source) java.lang.Class.getDeclaredMethods(Unknown Source) org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524) ...