struts2+hibernate+spring Simple integration and java.sql.SQLException:No suitable driver problem solving

Source: Internet
Author: User

Recently on the Java EE class, the teacher asked to integrate struts2+hibernate+spring, I am in fact early prepared to make, and now all the 9th project, but their own ideas and clues to bring their own pits, of course, is also the experience of the problem, in fact, just use MyEclipse to integrate , originally also did not have so many questions, see video It incredibly much to hand dozen, I do not like to see not to go down, the tutorial is a pile of pits, the most puzzling is clearly there is a conflict is need to solve, but I see the tutorial incredibly did not mention, there is a mistake actually a lot of people seem to automatically ignore the same, Can solve my problem is to look for a long time, so I must have to record this process, give the first friend some help, do not waste time with me, of course, I need to help my girlfriend finish homework first. I'll come back and build a project, write a little!

Toss for one hours I finally came back, think about the first time to build a good ssh2 or a little excited, record it, remember to read the patient first.

First of all, to build a Web project, by default, the final automatic generation of XML, I use myeclipse2016.

OK, bath return, continue. The next step is to add three frames, in order, spring, to Struts2 to hibernate (or struts2, to spring, to hibernate), and the order should be important. Don't want to type, just look at the picture

So with the struts2, remember to put it and spring together with the plugin package also circled in, the next add spring, the recommended use of spring3.1, originally I came up with the highest 4.1, as if not, may not be compatible with it, but also in the start of the server when prompted below

Error Configuring application Listener of Class Org.springframework.web.context.ContextLoaderListener
Java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener

I did not understand, nor can Baidu solve it, but then after the success I vaguely feel that this may be incompatible version of the issue.

OK, complete the spring3.1, finally add hibernate, with the hibernate4.1, also did not use the highest version, as for the production of HBM files, everyone will.

All right, all three frameworks have been added into the project, but is it over? No, the most pit is the jar conflict, at first I did not have such a consciousness, let me have been done a lot of new BMS project attempt, but also in the classmate's mouth and web site, in fact, the most depressed is my textbook did not mention, otherwise I will not white busy so long. See how to remove the jar, the most common is to remove Antlr-*.*.jar, generally keep the highest version, see this in struts and hibernate are present, and discard the strucs2 that can, go to the law as follows right click on the project to choose Properties

Click Edit, the core is not selectable, but the option is checked.

But careful I found another same jar, but I do not seem to get rid of it, I am too lazy to go, because my last project was removed.

When you run the Web project, you may encounter the following error java.sql.SQLException:No suitable driver, a few exceptions, see the last exception is the root exception, see other people's solution, direct

Other after all, this is not a textbook, to everyone to study, finally on this complete project, that is, my homework, serious hint: do not directly import into the run, because not to run, but to create a new project, according to the above steps, finally see what is missing and then copied into or modified, The SQL code is also in the inside, the database is called BMS. There's a problem with me qq1471914707, project: Http://pan.baidu.com/s/1hr59lkC

struts2+hibernate+spring Simple integration and java.sql.SQLException:No suitable driver problem solving

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.