Eclipse / Hibernate工具错误:存档类路径条目不存在

时间:2014-02-18 18:16:00

标签: java eclipse spring hibernate postgresql

我正在尝试设置Hibernate工具 - 将其附加到spring petclinic项目。到目前为止,问题出在classpath中。我的行动:

  • 在Hibernate Configuration视图中单击hibernate
  • 添加 postgresql-9.1.jar位于的根目录下 spring-petclinic项目

结果是错误:[Classpath]:存档类路径条目不存在[/spring-petclinic/postgresql-9.1.jar](图片见http://jboston.net/HIbernateToolsError.jpg

另见日志:

java.lang.IllegalArgumentException: Path must include project and resource name: /postgresql-9.1.jar
java.lang.IllegalArgumentException: Path must include project and resource name: /postgresql-9.1.jar
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2170)
at org.eclipse.core.internal.resources.Container.getFile(Container.java:208)
at org.hibernate.eclipse.console.utils.ProjectUtils.findJavaProjects(ProjectUtils.java:308)
at org.hibernate.eclipse.console.workbench.ProjectCompilerVersionChecker.validateProjectComplianceLevel(ProjectCompilerVersionChecker.java:35)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:37)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

2 个答案:

答案 0 :(得分:3)

@Craig Ringer回答有帮助。我的解决方法如下:

  • 使用postgresql jdbc jar创建用户库

  • 从Hibernate配置类路径选项卡中选择Advanced 正确的菜单

  • 选择“添加库”

答案 1 :(得分:1)

看起来您已尝试将JDBC jar添加为必需项目。别。将其添加为库依赖项。

请参阅this list of ways to do it - 未经验证,因为我感谢不再需要使用Eclipse了。