Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource

I'm new to spring mvc 3 and hibernate 3. i need some clarification for the following issue.I'm locked with this issue, so that i can't proceed to next step.

This is my dispatch-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>


    <context:component-scan base-package="net.example"/>
    <tx:annotation-driven/>
    <!--
    Most controllers will use the ControllerClassNameHandlerMapping above, but
    for the index controller we are using ParameterizableViewController, so we must
    define an explicit mapping for it.
    -->

    <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp" />

</beans>  

In that once i include this line i got the following error, i tried to solve but nothing will happened.

    
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor
        org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
        org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
        org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
        org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
        org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
        org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
        org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
        org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
        org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)
        org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)
        org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
        org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
        org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
        org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
        org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
        javax.servlet.GenericServlet.init(GenericServlet.java:160)
        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
        org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        java.lang.Thread.run(Thread.java:662)

i'm using spring 3.0.2 RELEASE version. and also included spring-tx.3.0.2.RELEASE.jar in my library(i'm using netbeans 7.0)

like image 266
Rajkumar Avatar asked Jul 11 '11 10:07

Rajkumar


2 Answers

You're probably missing the spring-tx.XXX.jar or org.springframework.transaction.XXX.jar from your classpath.

like image 197
skaffman Avatar answered Nov 15 '22 16:11

skaffman


Using this:

 <tx:annotation-driven/>

requires this in your classpath (and perhaps others):

org.springframework.transaction-3.1.0.M2.jar
like image 34
duffymo Avatar answered Nov 15 '22 18:11

duffymo