myeclipe eclipse 常遇问题:Some projects cannot be imported 、java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver、The file connot be validate
1、Some projects cannot be imported because they already exist in the workspace
2、Some projects were hidden because they exist in the workspace directory
这种情况基本是以下错误操作造成:
1.手动删除本地磁盘下的工程目录
2.删除时,没有勾选Delete project contents on disk(cannot be undone)
以上2种操作,eclipse本身不会删除一些以 二进制形式记录的工程信息,
所以你在导入的时候就提示工程已经存在了~
有时候eclipse或者myeclipse导入项目的时候会发生上面两个错误,IDE不允许我们导入。具体原因是在IDE的workspace中已经存在了相同名字的项目,所以不能导入。
解决办法则是修改项目名:
1、right click【右键】 --- refactor --- rename
2、workspace中要修改名字的项目 --- 打开.project文件 --- 修改<name>projectName</name>【导出到myeclipse外面的项目不能通过直接改项目名称来修改真正的项目名称,只能通过这种方式】
==============================================================================================
注意:诚然修改项目名可以解决,但是给人的感觉好像是以前的找不到了(工程目录下面明明没有)导致无法删除,只好改名,实乃无奈之举!!
思考--加入不进去,一定是以前的有一个标记记录了你的工程信息,也就是说找到那个标记删除它,我们就不用改名字了。经过我的摸索
E:\workspace\eclipseworkspace\.metadata\.plugins\org.eclipse.core.resources\.projects 在我的这个版本的eclipse上是这个目录里面
警告:The file connot be validate as there was a connect problem
解决方式: 引入所需的dtd
ps:这种只是警告,不是错误,所以不处理也是没问题的,只是它不能出现提示而已。主要原因是这些dtd本来是可以通过网络获取的,假如你没有网络,它就没办法通过联网获得,所以解决办法就是把这些文件导入myeclipse。
错误:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80) at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:66) at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279) at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:80) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:141) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:98) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:73) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355) at $Proxy37.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:195) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:120) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:90) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40) at $Proxy42.selectTest(Unknown Source) at com.test.sevices.MonitorService.showModule(MonitorService.java:16) at com.test.controller.MonitorController.showModule(MonitorController.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619)
报错原因:
缺失了连接oracle数据库的驱动文件
解决办法:
在MyEclipse中引入oracle 11g自带的jdbc包(如“G:\app\welcome\product\11.1.0\db_1\jdbc\lib\ojdbc6.jar”):右击java项目,选择“Build Path”、“Configure Build Path”,单击“Add External JARs”按钮,选择你的ojdbc6.jar;