当前位置: 代码迷 >> Java Web开发 >> java连接mysql数据库有关问题
  详细解决方案

java连接mysql数据库有关问题

热度:2059   发布时间:2013-02-25 21:10:15.0
java连接mysql数据库问题
java项目在linux系统上部署,启动tomcat时报错 。
  2012-09-25 14:26:10,375 INFO [DefaultListableBeanFactory.java-414]: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@813bc1: defining beans [dataSource,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice,baseService,sessionFactory,hibernateDao,adminService,logsService,smsAccountService,rateService,prestoreSMSService,sendSMSService,udpService,sysSetService,adminActionBean,smsAccountBean,rateBean,sendSMSBean,logsBean,sysSetBean]; root of factory hierarchy
2012-09-25 14:26:11,360 INFO [Environment.java-543]: Hibernate 3.3.1.GA
2012-09-25 14:26:11,372 INFO [Environment.java-576]: hibernate.properties not found
2012-09-25 14:26:11,383 INFO [Environment.java-709]: Bytecode provider name : javassist
2012-09-25 14:26:11,398 INFO [Environment.java-627]: using JDK 1.4 java.sql.Timestamp handling
2012-09-25 14:26:12,033 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.PrestoreSMS -> t_msm_prestore
2012-09-25 14:26:12,354 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.SysSet -> t_system_set
2012-09-25 14:26:12,445 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.SendSMS -> t_history
2012-09-25 14:26:12,514 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.Admin -> t_sms_admin
2012-09-25 14:26:12,584 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.Logs -> t_log
2012-09-25 14:26:12,668 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.SMSaccount -> t_sms_account
2012-09-25 14:26:12,750 INFO [HbmBinder.java-322]: Mapping class: com.adt.entity.Rate -> t_rate
2012-09-25 14:26:12,754 INFO [LocalSessionFactoryBean.java-795]: Building new Hibernate SessionFactory
2012-09-25 14:26:12,760 INFO [HbmBinder.java-2404]: Mapping collection: com.adt.entity.SMSaccount.accountSet -> t_sms_account
2012-09-25 14:26:12,790 INFO [ConnectionProviderFactory.java-95]: Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
2012-09-25 14:26:13,136 WARN [JDBCExceptionReporter.java-100]: SQL Error: 0, SQLState: null
2012-09-25 14:26:13,140 ERROR [JDBCExceptionReporter.java-101]: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'127.0.0.1' (using password: YES))
2012-09-25 14:26:13,147 WARN [SettingsFactory.java-144]: Could not obtain connection metadata
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'127.0.0.1' (using password: YES))
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
  at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
  at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
  at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
Caused by: java.sql.SQLException: Access denied for user 'root'@'127.0.0.1' (using password: YES)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:770)
  at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3641)
  at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1175)
  at com.mysql.jdbc.Connection.createNewIO(Connection.java:2544)
  at com.mysql.jdbc.Connection.<init>(Connection.java:1474)
  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:264)
  at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
  at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
  相关解决方案