简体   繁体   English

在Eclipse中使用Spring JDBC库时遇到麻烦

[英]Having trouble with using Spring JDBC libraries in Eclipse

I have recently downloaded the latest version of the spring framework: spring-framework-4.0.0.M1-dist.zip(sha1), but I only wanted the JDBC libraries that came with it, which consisted of 3 jars, as far as I could tell. 我最近下载了spring框架的最新版本:spring-framework-4.0.0.M1-dist.zip(sha1),但是到目前为止,我只想要它随附的JDBC库,它由3个jar组成。我可以说。 I have tried to include these jars in my project in Eclipse by configuring my build path for them. 我试图通过配置它们的构建路径来将这些jars包含在Eclipse中的项目中。 Whenever I do this, and try to extend a class from one of these libraries, it says it is unrecognized, and as a solution, to import the appropriate package: okay, fine. 每当我这样做并尝试从其中一个库中扩展一个类时,它都说无法识别,并且作为一种解决方案,它导入了适当的包:好的,很好。 So I import it, and it still throws me an error saying: "The type org.springframework.dao.support.DaoSupport cannot be resolved. It is indirectly referenced from required .class files" whenever I hover over the class being extended. 因此,我将其导入,但仍然出现错误:“无法解析类型org.springframework.dao.support.DaoSupport。它从所需的.class文件中间接引用”。

I would provide a screenshot, but I need to have at least a 10 reputation, and I am new to this website, so I apologize. 我将提供一个屏幕截图,但我至少必须有10个声誉,并且我是该网站的新手,所以我深表歉意。

I have tried using the default unzipping tool which is already on Windows 7, I have used 7Zip, and have tried to include external jars without creating a folder in Eclipse to place the jars in, and I have tried to make a folder and include them, and have also tried deleting and re-downloading the entire spring framework. 我尝试使用Windows 7上已经存在的默认解压缩工具,我使用了7Zip,并尝试包括外部jar,而没有在Eclipse中创建用于放置jar的文件夹,并且尝试制作一个文件夹并将其包括在内,并且还尝试删除并重新下载整个spring框架。 Still the same error. 还是一样的错误。

Any help would be greatly appreciated. 任何帮助将不胜感激。

When I face this problem usually, I go with a clean build in eclipse if the project is configured correctly. 通常,当我面对这个问题时,如果项目配置正确,我将使用eclipse中的干净构建。 In order to use any jar files in general you right click on the project Build Path->Configure Build Path and make sure that you see those jars in libraries tab, if not add them; 为了通常使用任何jar文件,请右键单击项目“构建路径”->“配置构建路径”,并确保在库选项卡中看到了这些jar,如果未添加它们的话; having them in a 'lib' directory serves no purpose as they must be included in the .classpath file of the project regardless the directory. 将它们放在“ lib”目录中没有任何作用,因为无论目录如何,它们都必须包含在项目的.classpath文件中。

Hey I found solution to this problem that after adding some jar package (DapSupport dependent some other classes) like [org.springframework.transaction-3.0.5.RELEASE.jar] compiled without errors. 嘿,我发现此问题的解决方案是在添加了一些jar包(依赖于DapSupport的其他一些类)后,例如[org.springframework.transaction-3.0.5.RELEASE.jar]编译成功了。 If there is fault, it is necessary to see whether there are other jar package has not been imported....thanks 如果有故障,就要看是否还有其他的jar包没有被导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM