java - IntelliJ IDEA 13.1.1 - Spring MVC Project Template Error -
this question has answer here:
i'm playing spring framework in intellij idea 13.1.1.
in intellij choose: file -> new project -> spring -> spring mvc -> create project template. creates default spring project configuration of deploying war:exploded tomcat server. change nothing default configuration. builds , deploys correctly, result following:
http status 500 - servlet.init() servlet mvc-dispatcher threw exception
javax.servlet.servletexception: servlet.init() servlet mvc-dispatcher threw exception org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:313) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) java.lang.thread.run(thread.java:744)
files generated intellij quite concise:
mvc-dispatcher-servlet.xml
<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" xsi:schemalocation="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.xsd"> <context:component-scan base-package="com.springapp.mvc"/> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/pages/"/> <property name="suffix" value=".jsp"/> </bean> </beans>
web.xml
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>spring mvc application</display-name> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
hellocontroller.java
package com.springapp.mvc; import org.springframework.stereotype.controller; import org.springframework.ui.modelmap; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; @controller @requestmapping("/") public class hellocontroller { @requestmapping(method = requestmethod.get) public string printwelcome(modelmap model) { model.addattribute("message", "hello world!"); return "hello"; } }
this occurs on 2 different machines, under ubuntu 12.04 , windows 7. downloaded other spring mvc projects internet , run fine, guess problem files intellij generates automatically, find weird. however, not able find part causes problem.
edit: full stack trace tomcat (7.0.52) log:
kwi 23, 2014 11:48:42 pm org.apache.catalina.core.applicationcontext log @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) @ 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:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:313) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:744) kwi 23, 2014 11:48:43 pm org.apache.catalina.core.standardwrappervalve invoke severe: allocate exception servlet mvc-dispatcher 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:1279) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1192) @ 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:501) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) @ 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:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:313) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:744) kwi 23, 2014 11:48:43 pm org.apache.catalina.core.applicationcontext log @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) @ 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:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:313) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:744)
i facing same problem , changing java sdk (file >> project structure >> projects)from 1.8 1.6 or 1.7 helped remove problem.
Comments
Post a Comment