java.lang.ClassNotFoundException: antlr.ANTLRException but I have antlr-2.7.6 in folder lib of project

和自甴很熟 提交于 2019-12-11 06:19:01

问题


I have this in .classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
    ...
    ...
<classpathentry kind="lib" path="lib/hibernate3.jar"/>
<classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
    ...
</classpath>

Some .jar added. When I try this:

Query query2 = session.createQuery(sql2);

throw exception in question name:

java.lang.ClassNotFoundException: antlr.ANTLRException

Any idea?

Thanks in advance.

Greetings.


回答1:


This is related to the Hibernate API. Hibernate 3.0 uses ANTLR (Another Tool for Language Recognition) for processing HSQL queries - if I remember correctly.
You need to add an additional jar (ANTLR-2.7.5H3.jar) to your classpath.

Or you can add the below maven dependency to the pom.xml

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>antlr</artifactId>
<version>2.7.5H3</version>
</dependency>


来源:https://stackoverflow.com/questions/17168137/java-lang-classnotfoundexception-antlr-antlrexception-but-i-have-antlr-2-7-6-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!