Solution for Java. Lang. nosuchmethoderror: anlr. Collections. Ast. Getline () I error in the SSH framework project

Source: Internet
Author: User

An error occurs when I create another SSH project tonight. java. Lang. nosuchmethoderror: anlr. Collections. Ast. Getline () I

And the error is strange.

This is the first query.Code, No problems

Request. setattribute ("countrylist", countryservice. getresult ("from country", null ));

However, when the code is written in this way

Request. setattribute ("provincelist", provinceservice. getresult ("from province where country. ID = ?", New object [] {New INTEGER (1 )}));

The above error will occur, and I am deeply puzzled. The structure of all classes is exactly the same. Why is the first type of code not reported, and the second type of code will report an error? First, let's take a look at the only difference between the two query statements. Then, the first query is a query without conditions, and the second query is a query condition when executed.

Okay. Let me change the code to this.

Request. setattribute ("provincelist", provinceservice. getresult ("From province where country. ID = 1", null ));

That's right. The course has successfully queried the data. I am very confused. debug debugging to see if there is an error while passing the parameter parameters.

Public list getresult (string hql, object [] parameters) {query = sessionfactory. getcurrentsession (). createquery (hql); If (parameters! = NULL & parameters. length> 0) {for (INT I = 0; I <parameters. length; I ++) {query. setparameter (I, parameters [I]) ;}} return query. list ();}

After debugging, we found that the query statements are completely correct. We can successfully splice the correct query statements. This is even more annoying.

Eventually, the search engine helped me solve the problem.

Struts antlr-2.7.2.jar and hibernate3 antlr-2.7.6.jar there is a jar package conflict problem, well delete the lower version of the jar package.

It is best to remove the project and redeploy it. I used "Redeploy/reload application"

Failed.

 

The most puzzling thing is not over yet, so I don't believe it. I have to try importing the jar of the earlier version. it turns out that I am a real ghost. after importing the antlr-2.7.2.jar package again, there is no error. I have to admit that my character is already quite low. but for the sake of insurance, you should not keep two jar packages. it may be enough for you to debug your website if an error is reported that day.

Facts once again prove that the hunch is right. The same error occurs the next day. It seems that there is a bug in myeclipse, and this time it is determined that it cannot be left. Deleted.

This article is from nabaichuan. Please indicate the source and corresponding link when reprinting.

permanent link: http://www.bicner.com/104.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.