为了账号安全,请及时绑定邮箱和手机立即绑定

INFO: HHH000206: hibernate.properties not found

INFO: HHH000206: hibernate.properties not found

刃殇 2016-11-02 22:14:03
七月 02, 2016 10:08:31 下午 org.hibernate.Version logVersionINFO: HHH000412: Hibernate Core {5.1.0.Final}七月 02, 2016 10:08:31 下午 org.hibernate.cfg.Environment <clinit>INFO: HHH000206: hibernate.properties not found七月 02, 2016 10:08:31 下午 org.hibernate.cfg.Environment buildBytecodeProviderINFO: HHH000021: Bytecode provider name : javassist七月 02, 2016 10:08:32 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureWARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///test?useUnicode=true&charaterEncoding=UTF-8]七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001001: Connection properties: {user=root, password=****}七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001003: Autocommit mode: false七月 02, 2016 10:08:33 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>INFO: HHH000115: Hibernate connection pool size: 20 (min=1)七月 02, 2016 10:08:34 下午 org.hibernate.dialect.Dialect <init>INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect七月 02, 2016 10:08:37 下午 org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateServiceINFO: HHH000397: Using ASTQueryTranslatorFactoryjava.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy33.createQuery(Unknown Source) at service.impl.UsersDAOImpl.uesrsLogin(UsersDAOImpl.java:28) at action.UsersAction.login(UsersAction.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at 
查看完整描述

6 回答

?
大咪

TA贡献785条经验 获得超332个赞

就是说你的属性文件没有被找到
查看完整回答
1 反对 回复 2016-11-03
  • 刃殇
    刃殇
    属性都是按照课程里打的啊,没有问题
  • 大咪
    大咪
    .....没说你属性有问题,问题是找不到你这个配置文件。。仅仅是异常信息,不上代码谁能光看这个给你找出错误啊。。上代码!
  • 刃殇
    刃殇
    <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <!-- Generated by MyEclipse Hibernate Tools. --> <hibernate-configuration> <session-factory> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.password">123456</property> <property name="connection.username">root</property> <property name="connection.url">jdbc:mysql:///test?useUnicode=true&amp;amp;charaterEncoding=UTF-8</property> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="show_sql">true</property> <property name="format_sql">true</property> <property name="hbm2ddl.auto">update</property> <property name="hibernate.current_session_context_class"> thread </property> <property name="myeclipse.connection.profile">jdbc</property> <mapping resource="entity/Students.hbm.xml" /> <mapping resource="entity/Users.hbm.xml" /> </session-factory> </hibernate-configuration>
点击展开后面3
?
兮蓅

TA贡献1条经验 获得超0个赞

题主这个问题解决了吗?

查看完整回答
反对 回复 2016-11-16
?
刃殇

TA贡献1条经验 获得超0个赞

package service.impl;

import java.util.List;




import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import db.MyHibernateSessionFactory;
import entity.Users;
import service.UsersDAO;

public class UsersDAOImpl implements UsersDAO{

	@Override
	public boolean uesrsLogin(Users u) {
		// TODO Auto-generated method stub
		Transaction tx=null;
		String hql="";
		try
		{
			Session session=MyHibernateSessionFactory.getSessionFactory().getCurrentSession();
			tx=session.beginTransaction();//开启事务
			hql="from Users where username= ? and password= ? ";
			Query query=session.createQuery(hql); 
			query.setParameter(0, u.getUsername());
			query.setParameter(1, u.getPassword());
			List list=query.list();
			tx.commit();
			if (list.size()>0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
			return false;
		}
		finally
		{
			if(tx!=null)
			{
				
				tx=null;
			}
		}
	}
}


查看完整回答
反对 回复 2016-11-06
?
大咪

TA贡献785条经验 获得超332个赞

这个文件没问题……你用户登录那块的Daoimpl下的userlogin代码能看看吗?我觉得是那的问题
查看完整回答
反对 回复 2016-11-06
  • 刃殇
    刃殇
    照着打的,我也加在回答下面了
  • 大咪
    大咪
    http://www.imooc.com/qadetail/101196,你去看看这个,这个和你一样的错误……试试能不能行,看看jar包……
  • 6 回答
  • 0 关注
  • 9355 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信