首页上一页 1 下一页尾页 5 条记录 1/1页
Java项目开发案例全程实录(第2版)第3章java源代码运行不正确,求指导
发表在Java图书答疑
2012-02-26
是否精华
是
否
版块置顶:
是
否
按照视频上导入了源代码和Oracle数据库数据,结果不能运行.警告: Could not obtain connection metadata
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
127.0.0.1:1521:DBSQL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
at com.mwq.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:17)
at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:29)
at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
at com.mwq.frame.LandFrame.<init>(LandFrame.java:100)
at com.mwq.PersonnelManage.land(PersonnelManage.java:32)
at com.mwq.PersonnelManage$1.run(PersonnelManage.java:26)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
2012-2-26 19:22:07 org.hibernate.dialect.Dialect <init>
信息: Using dialect: org.hibernate.dialect.OracleDialect
2012-2-26 19:22:07 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
信息: Using default transaction strategy (direct JDBC transactions)
2012-2-26 19:22:07 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
信息: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic flush during beforeCompletion(): disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic session close at end of transaction: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Scrollable result sets: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC3 getGeneratedKeys(): disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Connection release mode: auto
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default batch fetch size: 1
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Generate SQL with comments: enabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL updates by primary key: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
信息: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2012-2-26 19:22:07 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
信息: Using ASTQueryTranslatorFactory
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query language substitutions: {}
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: JPA-QL strict compliance: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Second-level cache: enabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query cache: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory createCacheProvider
信息: Cache provider: org.hibernate.cache.NoCacheProvider
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Optimize cache for minimal puts: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Structured second-level cache entries: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Echoing all SQL to stdout
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Statistics: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Deleted entity synthetic identifier rollback: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default entity-mode: pojo
2012-2-26 19:22:07 org.hibernate.impl.SessionFactoryImpl <init>
信息: building session factory
2012-2-26 19:22:07 org.hibernate.impl.SessionFactoryObjectFactory addInstance
信息: Not binding factory to JNDI, no JNDI name configured
2012-2-26 19:22:07 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 0, SQLState: null
2012-2-26 19:22:07 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
127.0.0.1:1521:DBSQL
Exception in thread "AWT-EventQueue-0" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:31)
at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
at com.mwq.frame.LandFrame.<init>(LandFrame.java:100)
at com.mwq.PersonnelManage.land(PersonnelManage.java:32)
at com.mwq.PersonnelManage$1.run(PersonnelManage.java:26)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
127.0.0.1:1521:DBSQL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 26 more
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
127.0.0.1:1521:DBSQL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
at com.mwq.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:17)
at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:29)
at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
at com.mwq.frame.LandFrame.<init>(LandFrame.java:100)
at com.mwq.PersonnelManage.land(PersonnelManage.java:32)
at com.mwq.PersonnelManage$1.run(PersonnelManage.java:26)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
2012-2-26 19:22:07 org.hibernate.dialect.Dialect <init>
信息: Using dialect: org.hibernate.dialect.OracleDialect
2012-2-26 19:22:07 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
信息: Using default transaction strategy (direct JDBC transactions)
2012-2-26 19:22:07 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
信息: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic flush during beforeCompletion(): disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic session close at end of transaction: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Scrollable result sets: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC3 getGeneratedKeys(): disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Connection release mode: auto
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default batch fetch size: 1
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Generate SQL with comments: enabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL updates by primary key: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
信息: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2012-2-26 19:22:07 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
信息: Using ASTQueryTranslatorFactory
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query language substitutions: {}
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: JPA-QL strict compliance: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Second-level cache: enabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query cache: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory createCacheProvider
信息: Cache provider: org.hibernate.cache.NoCacheProvider
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Optimize cache for minimal puts: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Structured second-level cache entries: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Echoing all SQL to stdout
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Statistics: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Deleted entity synthetic identifier rollback: disabled
2012-2-26 19:22:07 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default entity-mode: pojo
2012-2-26 19:22:07 org.hibernate.impl.SessionFactoryImpl <init>
信息: building session factory
2012-2-26 19:22:07 org.hibernate.impl.SessionFactoryObjectFactory addInstance
信息: Not binding factory to JNDI, no JNDI name configured
2012-2-26 19:22:07 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 0, SQLState: null
2012-2-26 19:22:07 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
127.0.0.1:1521:DBSQL
Exception in thread "AWT-EventQueue-0" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:31)
at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
at com.mwq.frame.LandFrame.<init>(LandFrame.java:100)
at com.mwq.PersonnelManage.land(PersonnelManage.java:32)
at com.mwq.PersonnelManage$1.run(PersonnelManage.java:26)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
127.0.0.1:1521:DBSQL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 26 more