首页 > 代码库 > ORA-28040: No matching authentication protocol

ORA-28040: No matching authentication protocol

使用hibernate+oracle数据库时报错,错误例如以下:

121 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA

147 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
162 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
189 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
502 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
503 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
994 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : com/sina/domain/Message.hbm.xml
1457 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.sina.domain.Message -> Message
1706 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : com/sina/domain/Users.hbm.xml
1830 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.sina.domain.Users -> users
1841 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
1844 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.sina.domain.Users.sendMessages -> Message
1845 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.sina.domain.Users.getMessages -> Message
1894 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
1894 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
1895 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
1968 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@127.0.0.1:1521:oracle12c
1968 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=c##test1, password=****}
2464 [main] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
java.sql.SQLException: ORA-28040: No matching authentication protocol


at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:288)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at com.sina.util.HibernateUtil.<clinit>(HibernateUtil.java:17)
at com.sina.test.TestMain.main(TestMain.java:13)
2503 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.Oracle9Dialect
2508 [main] WARN org.hibernate.dialect.Oracle9Dialect - The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead
2517 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
2521 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2521 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
2522 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
2523 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled
2523 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
2523 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
2525 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
2525 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
2525 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
2525 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
2525 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2529 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
2530 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
2530 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
2530 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
2530 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
2531 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
2531 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
2531 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
2542 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
2544 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
2544 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
2544 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
2544 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
2663 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
3177 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
3193 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update
3193 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata
3220 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - could not get database metadata
java.sql.SQLException: ORA-28040: No matching authentication protocol


at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:288)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:168)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:346)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at com.sina.util.HibernateUtil.<clinit>(HibernateUtil.java:17)
at com.sina.test.TestMain.main(TestMain.java:13)
3223 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - could not complete schema update
java.sql.SQLException: ORA-28040: No matching authentication protocol


at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:288)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:168)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:346)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at com.sina.util.HibernateUtil.<clinit>(HibernateUtil.java:17)

at com.sina.test.TestMain.main(TestMain.java:13)

No matching authentication protocol中文翻译过来就是没有匹配的身份认证协议

原来曾经用的orale是曾经的版本号。可是近期换了下oracle的版本号,可是对应的jar包没有变换。原来的jar包使用的版本号为oracle14.jar,

换了下罪行的ojdbc7.jar包就没报错了。

ORA-28040: No matching authentication protocol