我是Spring的新手,我已经使用wamp安装了MySQL,我正在学习一些教程http://www.javatpoint.com/spring-JdbcTemplate-tutorial是java的框架教程之一。 在教程中,除了使用MySQL之外,我所做的一切都是相同的。
每次,我都会收到此错误
Oct 10, 2016 1:09:11 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@729f624a: startup date [Mon Oct 10 01:09:11 IST 2016]; root of context hierarchy
Oct 10, 2016 1:09:11 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:481)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.springDBDemo.Test.main(Test.java:18)
Caused by: java.lang.ClassNotFoundException: org.springframework.expression.PropertyAccessor
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 5 more
所以我不知道是什么问题。
具有我的演示项目的Dropbox。 https://www.dropbox.com/s/4mmz87o9vstgw5a/springDBDemo.zip?dl=0
由于
答案 0 :(得分:1)
如果你使用像以下那样添加它,你就错过了这个jar:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
如果没有尝试添加到类路径的文件夹