java - Initial spring mvc configuration: Servlet.init() for servlet Dispatcher Servlet threw exception -
i have checked of question , answers problem haven't found solution.
the error happens when run web app in tomcat ( have tried tomcat 7.0.57 , 8.0.24).
github project: https://github.com/gdiazcamilo/springmvc_intro
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"> <servlet> <servlet-name>springdispatcherservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/config/servlet-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springdispatcherservlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <display-name>archetype created web application</display-name> </web-app>
servlet-config.xml
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <mvc:annotation-driven /> <context:component-scan base-package="local.gdiaz.fitnesstracker" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver" p:prefix="/web-inf/jsp/" p:suffix=".jsp" /> <!-- <bean id="templateresolver" class="org.thymeleaf.templateresolver.servletcontexttemplateresolver"> <property name="prefix" value="/web-inf/views/" /> <property name="suffix" value=".html" /> <property name="templatemode" value="html5" /> </bean> --> </beans>
pom.xml
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>local.gdiaz</groupid> <artifactid>fitnesstracker</artifactid> <packaging>war</packaging> <version>0.0.1-snapshot</version> <name>fitnesstracker maven webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <!-- thymeleaf --> <dependency> <groupid>org.thymeleaf</groupid> <artifactid>thymeleaf</artifactid> <version>2.1.4.release</version> </dependency> <dependency> <groupid>org.thymeleaf</groupid> <artifactid>thymeleaf-spring3</artifactid> <version>2.1.4.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>3.2.0.release</version> </dependency> </dependencies> <build> <finalname>fitnesstracker</finalname> </build> </project>
project structure
as can see in eclipse sts, project folder has red x, no other file mark red x. tried restarting sts red x doesn't go away.
console output
ago 16, 2015 6:18:35 pm org.apache.catalina.core.applicationcontext log info: initializing spring frameworkservlet 'springdispatcherservlet' ago 16, 2015 6:18:35 pm org.springframework.web.servlet.frameworkservlet initservletbean info: frameworkservlet 'springdispatcherservlet': initialization started ago 16, 2015 6:18:35 pm org.springframework.context.support.abstractapplicationcontext preparerefresh info: refreshing webapplicationcontext namespace 'springdispatcherservlet-servlet': startup date [sun aug 16 18:18:35 bot 2015]; root of context hierarchy ago 16, 2015 6:18:35 pm org.springframework.beans.factory.xml.xmlbeandefinitionreader loadbeandefinitions info: loading xml bean definitions servletcontext resource [/web-inf/config/servlet-config.xml] ago 16, 2015 6:18:35 pm org.springframework.context.annotation.classpathscanningcandidatecomponentprovider registerdefaultfilters info: jsr-250 'javax.annotation.managedbean' found , supported component scanning ago 16, 2015 6:18:35 pm org.springframework.web.servlet.frameworkservlet initservletbean severe: context initialization failed java.lang.illegalargumentexception @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.core.type.classreading.simplemetadatareader.<init>(simplemetadatareader.java:52) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:80) @ org.springframework.core.type.classreading.cachingmetadatareaderfactory.getmetadatareader(cachingmetadatareaderfactory.java:101) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:76) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:298) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:300) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:300) @ org.springframework.context.annotation.configurationclassparser.doprocessconfigurationclass(configurationclassparser.java:230) @ org.springframework.context.annotation.configurationclassparser.processconfigurationclass(configurationclassparser.java:153) @ org.springframework.context.annotation.configurationclassparser.parse(configurationclassparser.java:130) @ org.springframework.context.annotation.configurationclasspostprocessor.processconfigbeandefinitions(configurationclasspostprocessor.java:285) @ org.springframework.context.annotation.configurationclasspostprocessor.postprocessbeandefinitionregistry(configurationclasspostprocessor.java:223) @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:630) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:461) @ org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:647) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:598) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:661) @ org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:517) @ org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:458) @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:138) @ javax.servlet.genericservlet.init(genericservlet.java:158) @ org.apache.catalina.core.standardwrapper.initservlet(standardwrapper.java:1284) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1197) @ org.apache.catalina.core.standardwrapper.allocate(standardwrapper.java:864) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:134) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:421) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1070) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:611) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:314) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source) ago 16, 2015 6:18:35 pm org.apache.catalina.core.applicationcontext log severe: standardwrapper.throwable java.lang.illegalargumentexception @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.core.type.classreading.simplemetadatareader.<init>(simplemetadatareader.java:52) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:80) @ org.springframework.core.type.classreading.cachingmetadatareaderfactory.getmetadatareader(cachingmetadatareaderfactory.java:101) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:76) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:298) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:300) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:300) @ org.springframework.context.annotation.configurationclassparser.doprocessconfigurationclass(configurationclassparser.java:230) @ org.springframework.context.annotation.configurationclassparser.processconfigurationclass(configurationclassparser.java:153) @ org.springframework.context.annotation.configurationclassparser.parse(configurationclassparser.java:130) @ org.springframework.context.annotation.configurationclasspostprocessor.processconfigbeandefinitions(configurationclasspostprocessor.java:285) @ org.springframework.context.annotation.configurationclasspostprocessor.postprocessbeandefinitionregistry(configurationclasspostprocessor.java:223) @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:630) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:461) @ org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:647) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:598) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:661) @ org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:517) @ org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:458) @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:138) @ javax.servlet.genericservlet.init(genericservlet.java:158) @ org.apache.catalina.core.standardwrapper.initservlet(standardwrapper.java:1284) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1197) @ org.apache.catalina.core.standardwrapper.allocate(standardwrapper.java:864) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:134) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:421) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1070) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:611) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:314) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source) ago 16, 2015 6:18:35 pm org.apache.catalina.core.standardwrappervalve invoke severe: allocate exception servlet springdispatcherservlet java.lang.illegalargumentexception @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.asm.classreader.<init>(unknown source) @ org.springframework.core.type.classreading.simplemetadatareader.<init>(simplemetadatareader.java:52) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:80) @ org.springframework.core.type.classreading.cachingmetadatareaderfactory.getmetadatareader(cachingmetadatareaderfactory.java:101) @ org.springframework.core.type.classreading.simplemetadatareaderfactory.getmetadatareader(simplemetadatareaderfactory.java:76) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:298) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:300) @ org.springframework.context.annotation.configurationclassparser.getimports(configurationclassparser.java:300) @ org.springframework.context.annotation.configurationclassparser.doprocessconfigurationclass(configurationclassparser.java:230) @ org.springframework.context.annotation.configurationclassparser.processconfigurationclass(configurationclassparser.java:153) @ org.springframework.context.annotation.configurationclassparser.parse(configurationclassparser.java:130) @ org.springframework.context.annotation.configurationclasspostprocessor.processconfigbeandefinitions(configurationclasspostprocessor.java:285) @ org.springframework.context.annotation.configurationclasspostprocessor.postprocessbeandefinitionregistry(configurationclasspostprocessor.java:223) @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:630) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:461) @ org.springframework.web.servlet.frameworkservlet.configureandrefreshwebapplicationcontext(frameworkservlet.java:647) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:598) @ org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:661) @ org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:517) @ org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:458) @ org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:138) @ javax.servlet.genericservlet.init(genericservlet.java:158) @ org.apache.catalina.core.standardwrapper.initservlet(standardwrapper.java:1284) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1197) @ org.apache.catalina.core.standardwrapper.allocate(standardwrapper.java:864) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:134) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:503) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:421) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1070) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:611) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:314) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source)
try following config. name important spring-servlet.xml
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/spring-servlet.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> </web-app>
Comments
Post a Comment