java


HTTP Status 500 - Servlet.init() for servlet appServlet threw exception in spring MVC


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)
...
root cause java.lang.ClassNotFoundException: org.springframework.jdbc.core.RowMapper
Looks like you miss a dependency. Add this to maven (if you use it)
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.0.6</version>
</dependency>
If not add the .jar to classpath

Related Links

Thread order using synchronized
XMLHttpRequest cannot load http://xxxxx. and OPTIONS instead of POST
App crashes when I try to switch from fragment to activity
Cannot cast com.app.japp.MyConfig to com.app.japp.MyConfig
Java thread program stops running with no error message (mac terminal/command prompt)
Why pass constants into Bundle objects putString() method?
Why rejection handler doesn't invoke when queue overflowed and all threads busy
Android studio listview doesn't show
Vaadin spring boot extreme long startup
When trying to acces an Arraylist from the doInbackground gives a null arraylist
Java EE Project in Tomcat return always 404
“hidden” method to get the object “description”
Java encrypt/decrypt with RSA generating keys from modulus and exponents
Android volley request package
In JSP, context.xml seems to be broken error
Click Listeners do not work when maximizing window or resize (LibGDX)

Categories

HOME
cloud
listview
gerrit
isabelle
gremlin
routes
spring-cloud-stream
google-project-tango
pivotal-cloud-foundry
ios-charts
node-notifier
android-youtube-api
cross-validation
contact
dacpac
gnupg
kentor-authservices
windows-azure-storage
visual-studio-2005
zebra-printers
ups
carthage
seaborn
django-admin
windows-7-x64
pugjs
code-review
viewport
google-pagespeed
jprofiler
amazonsellercentral
cx-freeze
web-sql
sylius
jndi
lcd
buildbot
uninstall
fifo
assistant
vision
objectanimator
sql-server-2012-express
media-queries
google-cloud-endpoints-v2
column-family
azure-sql-database
http-digest
vxworks
neuroscience
abstract-class
dism
gzipstream
outlook-api
eclipse-gef
thin
scrollable
alphabet
git-diff
brightcove
namecoin
memory-alignment
spring-cache
webdriverjs
redundancy
google-cdn
deadbolt-2
instant
httplistener
etsy
xml-attribute
firebaseui
simplewebrtc
sigabrt
qcustomplot
testng-dataprovider
freelancer.com-api
jmeter-maven-plugin
tmuxinator
wireshark-dissector
angular-leaflet-directive
fluid-dynamics
clipperlib
skos
codeigniter-url
cdt
cctv
aapt
openlaszlo
mcts
geos
ccss
sitemesh
yui-compressor
factory-method
funscript
runas
manchester-syntax
newtonscript
psi
tomcat-valve
oncheckedchanged
mysql-error-1005
coda-slider
revisions
jquery-ui-droppable
virtual-functions
noscript
mediarss
zune
uiq3

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App