Based on errors encountered in the Struts+hibernate development process

Source: Internet
Author: User

1.import javax.servlet.http.HttpServletRequest Import Package ErrorAn error occurred in the import package, usually the package was not introduced, thehttpservletrequest package is a browser-issued request through HTTP, you need to import Servlet-api.jar under the Tomcat/lib directory. but it still doesn't work after importing, and restarting Eclipse won't get him into effect. Finally, it comes into effect through Project-clean..
2.the JSP interface added the form tag after the error
Workaround: Copy the EL-API,ECJ-4.3.1JRE from the Tomcat/lib directory .
3. Using <c:forEach> tags, error Failed to load or instantiate Taglibraryvalidator class
first add the file at the beginning of the JSP interface<% @taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>Then add Servlet-api.jar and Standard.jar under the Web-inf/lib directory under the project directory
4.abandoned connection cleanup thread] but had failed to stop it. This was very likely to create a memo every time Tomcat is started, it starts without shutting down,Tomcat reported memory leaks. The solution is to turn off Eclipse and restart your computer. After each boot Tomcat is turned off and then started.
5. Use the MySQL database. Root as the connection name, the connection is rejected after a period of timeThe default root user does not support remote control, and the MySQL console changes the root permission and still does not work. Finally, the Navicat (MySQL visualizer) was used to create a new user and reconfigure the connection.
6. Database table A, the foreground to a table write a data, immediately query, found that no table A is not updated. While viewing table A in the database server, the data has been updated. However, after you reconnect the database in MyEclipse. When you query again, the data gets updated. The Query method is a DAO that is automatically generated using HibernatePublic List Findbyproperty (String PropertyName, Object value) {
Log.debug ("Finding Product instance with property:" + PropertyName
+ ", Value:" + value);
try {
String queryString = "from Product as model where model."
+ propertyname + "=?";
Query queryobject = GetSession (). CreateQuery (queryString);
Queryobject.setparameter (0, value);
return Queryobject.list ();
} catch (RuntimeException re) {
Log.error ("Find by property name failed", re);
throw re;
}
}
the problem is appearing on the session. the Hibernate framework operations database is implemented through Org.hibernate.Session. And the session is managed by Org.hibernate.SessionFactory. config conf=new configuration (). Configure ();//need to re-create the configured connection every timeorg.hibernate.SessionFactory sessionfactory=conf.buildsessionfactory ();Session session=sessionfactory.opensession ();
The getsession () method in the automatically generated DAO file onlypublic class Basehibernatedao implements Ibasehibernatedao {
Public Session getsession () {
return Hibernatesessionfactory.getsession ();
}
}




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.