java - Spring REST web service appContext failed -


i'm trying create rest web service using spring.

i have 1 controller, 1 appcontext.

controller:

@controller public class restcontroller {  @requestmapping(method=requestmethod.post, value="service/{url}......<params>)  //some method here  //some logic here  } 

and app context:

<?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"         xsi:schemalocation="                 http://www.springframework.org/schema/beans                 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd                 http://www.springframework.org/schema/context                  http://www.springframework.org/schema/context/spring-context-3.0.xsd">          <context:component-scan base-package="spring.rest.controller" />          <bean class="org.springframework.web.servlet.mvc.annotation.defaultannotationhandlermapping" />         <bean class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter" />  </beans> 

i'm using tomcat 7, when trying start exception:

[13:02] error contextloader () - context initialization failed java.lang.noclassdeffounderror: org/springframework/expression/propertyaccessor     @ org.springframework.context.support.abstractapplicationcontext.preparebeanfactory(abstractapplicationcontext.java:567)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:468)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:389)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:294)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:106)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4939)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5434)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:334)     @ java.util.concurrent.futuretask.run(futuretask.java:166)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:722) caused by: java.lang.classnotfoundexception: org.springframework.expression.propertyaccessor     @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1714)     @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1559)     ... 15 more jul 23, 2013 1:02:21 pm org.apache.catalina.core.standardcontext listenerstart severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener java.lang.noclassdeffounderror: org/springframework/expression/propertyaccessor     @ org.springframework.context.support.abstractapplicationcontext.preparebeanfactory(abstractapplicationcontext.java:567)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:468)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:389)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:294)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:106)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4939)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5434)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:334)     @ java.util.concurrent.futuretask.run(futuretask.java:166)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:722) caused by: java.lang.classnotfoundexception: org.springframework.expression.propertyaccessor     @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1714)     @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1559)     ... 15 more 

libs used - spring beans, core, context, web, webmvc, security-core, oxm. p.s. never used spring before, have no idea wrong.

any suggestions?

you're missing spring expression jar file.

since have have spring core jar file, should have expression jar file if using project build manager such maven spring-expression dependency of spring-core. in case, chances there problem deploying expression jar file (either doesn't exist in local maven repository or corrupt). see here how refresh local maven repositories.

if you're not using build manager such maven, need manually download jar file, matching version existing spring jar files.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -