java.lang.Error: Unresolved compilation problem: The import org.junit cannot be resolved
来源:互联网 发布:audino单片机书籍 编辑:程序博客网 时间:2024/05/24 05:02
我在eclipse里导入一个ssh2项目,结果运行时出错了,我也没注意看项目,是那个类报的错。首先是项目出错了。我完全没看到就运行这个项目,结果控制台报错。
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cateDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.onlinebook.ssh2.dao.impl.CategoryDAOImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The import org.junit cannot be resolved
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.onlinebook.ssh2.dao.impl.CategoryDAOImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The import org.junit cannot be resolved
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
... 23 more
Caused by: java.lang.Error: Unresolved compilation problem:
The import org.junit cannot be resolved
at com.onlinebook.ssh2.dao.impl.CategoryDAOImpl.<init>(CategoryDAOImpl.java:9)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 25 more
后面在百度里找错时,才看到项目有红叉,找到CategoryDAOImpl类,发现导入import org.junit.Test;这个类是不存在的提示。另一个类里也是这个问题。注释了以后就可以运行了。
- java.lang.Error: Unresolved compilation problem: The import org.junit cannot be resolved
- Maven项目报jspException unresolved compilation problem : the import cannot be resolved
- java.lang.Error: Unresolved compilation problem: Cannot make a static reference to the non-static
- ERROR: The import org.apache.commons.logging cannot be resolved
- The import junit cannot be resolved解决问题
- java.lang.Error: Unresolved compilation problem.
- java.lang.Error: Unresolved compilation problem:
- java.lang.Error: Unresolved compilation problem解决方案
- The import org.slf4j cannot be resolved
- The import java.util cannot be resolved
- The import java.util cannot be resolved
- The import java.util cannot be resolved
- The import java.util cannot be resolved
- The import java.util cannot be resolved
- The import java.util cannot be resolved
- The import java.io cannot be resolved
- The import java.sql cannot be resolved
- 关于 “The import junit cannot be resolved”的提示错误
- Android 自定义动画(Animation)
- 网站上集成支付宝接口(一、申请合作者ID和key,下载Demo)
- Linux下架设邮件服务器全攻略
- Centos下完美安装ACE库以及TAO
- Android 更新UI的两种方法——handler和runOnUiThread()
- java.lang.Error: Unresolved compilation problem: The import org.junit cannot be resolved
- svn版本回退
- 分布式数据库系统---商旅预定系统的实现(8)
- linux exec函数
- http://www.killdb.com/2012/12/06/how-to-extract-datafiles-from-asm-diskgroup.html
- 一个备份MySQL数据库的简单Shell脚本
- 位图和矢量图区别
- android中如何给button加圆角
- Linux IR遥控器不灵敏调试