2016-04-17 32 views
1

Ich entwerfe Web-App mit Spring-Boot + Winterschlaf 5. Und ich verwende keine XML-Dateien. Ich erstelle Datenquelle und sessionFactory, und ich bekomme Fehler:java.sql.SQLException: ORA-01017: ungültiger Benutzername/Passwort; Anmeldung abgelehnt

verursacht durch: java.sql.SQLException: ORA-01017: ungültiger Benutzername/Passwort; Anmeldung verweigert

Aber mein Benutzername und Passwort sind genau richtig. Es ist meine Datasource Bohne:

@Bean(name = "dataSource") 
    public DataSource getDataSource(){ 
     DriverManagerDataSource dataSource = new DriverManagerDataSource(); 

     dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver"); 
     dataSource.setUsername("system"); 
     dataSource.setPassword("admin"); 
     dataSource.setUrl("jdbc:oracle:thin:@localhost:1521:xe"); 

     return dataSource; 
    } 

Es ist meine session Bohne:

@Autowired 
@Bean(name = "sessionFactory") 
public SessionFactory generateSessionFactoryBean(DataSource dataSource) throws Exception { 
    DriverManagerDataSource ds = (DriverManagerDataSource)dataSource; 
    System.out.println(ds.getUsername() + " " + ds.getPassword()); 
    LocalSessionFactoryBuilder sessionBuilder = 
      new LocalSessionFactoryBuilder(dataSource); 
    SessionFactory sessionFactory = sessionBuilder 
      .scanPackages("org.company")  
      .setProperties(getHibernateProperties()) 
      .buildSessionFactory(); 

    return sessionFactory; 
} 

Es ist mein getHibernateProperties ist() -Methode, die in session verwendet wird:

public Properties getHibernateProperties(){ 
    Properties properties = new Properties(); 
    properties.put("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect"); 
    properties.put("hibernate.show_sql", "true"); 
    properties.put("hibernate.hbm2ddl.auto", "update"); 
    return properties; 
} 

Und ich Haben Sie die Datei hibernate.properties nur für den Fall:

hibernate.connection.url = jdbc:oracle:thin:@localhost:1521:xe 
hibernate.connection.username = system 
hibernate.connection.user = system 
hibernate.connection.password = admin 
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver 
hibernate.dialect = org.hibernate.dialect.Oracle10gDialect 

Ein Teil der Stack-Trace:

. ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot ::  (v1.3.3.RELEASE) 

2016-04-17 12:59:52.312 INFO 5136 --- [   main] org.company.RestresourceApplication  : Starting RestresourceApplication on МорфПК with PID 5136 (D:\NewWorkspace\restresource\target\classes started by Морф in D:\NewWorkspace\restresource) 
2016-04-17 12:59:52.317 INFO 5136 --- [   main] org.company.RestresourceApplication  : No active profile set, falling back to default profiles: default 
2016-04-17 12:59:52.424 INFO 5136 --- [   main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]22f17321: startup date [Sun Apr 17 12:59:52 EEST 2016]; root of context hierarchy 
2016-04-17 12:59:54.527 INFO 5136 --- [   main] o.s.b.f.s.DefaultListableBeanFactory  : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]] 
2016-04-17 12:59:55.607 INFO 5136 --- [   main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$df212fee] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2016-04-17 12:59:56.878 INFO 5136 --- [   main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 
2016-04-17 12:59:56.898 INFO 5136 --- [   main] o.apache.catalina.core.StandardService : Starting service Tomcat 
2016-04-17 12:59:56.899 INFO 5136 --- [   main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.32 
2016-04-17 12:59:57.109 INFO 5136 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]  : Initializing Spring embedded WebApplicationContext 
2016-04-17 12:59:57.110 INFO 5136 --- [ost-startStop-1] o.s.web.context.ContextLoader   : Root WebApplicationContext: initialization completed in 4698 ms 
2016-04-17 12:59:57.905 INFO 5136 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/] 
2016-04-17 12:59:57.911 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 
2016-04-17 12:59:57.912 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 
2016-04-17 12:59:57.912 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 
2016-04-17 12:59:57.913 INFO 5136 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 
2016-04-17 12:59:58.110 INFO 5136 --- [   main] o.s.j.d.DriverManagerDataSource   : Loaded JDBC driver: oracle.jdbc.driver.OracleDriver 
2016-04-17 13:00:00.223 INFO 5136 --- [   main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 
2016-04-17 13:00:00.280 INFO 5136 --- [   main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ 
    name: default 
    ...] 
2016-04-17 13:00:00.631 INFO 5136 --- [   main] org.hibernate.Version     : HHH000412: Hibernate Core {5.0.5.Final} 
2016-04-17 13:00:00.636 INFO 5136 --- [   main] org.hibernate.cfg.Environment   : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.username=system , hibernate.connection.password=****, hibernate.dialect=org.hibernate.dialect.Oracle10gDialect, hibernate.connection.user=system, hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:xe, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver} 
2016-04-17 13:00:00.637 INFO 5136 --- [   main] org.hibernate.cfg.Environment   : HHH000021: Bytecode provider name : javassist 
2016-04-17 13:00:00.738 INFO 5136 --- [   main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 
2016-04-17 13:00:00.758 WARN 5136 --- [   main] org.hibernate.orm.deprecation   : HHH90000006: Attempted to specify unsupported NamingStrategy via setting [hibernate.ejb.naming_strategy]; NamingStrategy has been removed in favor of the split ImplicitNamingStrategy and PhysicalNamingStrategy; use [hibernate.implicit_naming_strategy] or [hibernate.physical_naming_strategy], respectively, instead. 
2016-04-17 13:00:01.295 WARN 5136 --- [   main] o.h.e.j.e.i.JdbcEnvironmentInitiator  : HHH000342: Could not obtain connection to query metadata : ORA-01017: invalid username/password; logon denied 

2016-04-17 13:00:01.325 INFO 5136 --- [   main] org.hibernate.dialect.Dialect   : HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect 
2016-04-17 13:00:01.376 INFO 5136 --- [   main] o.h.e.j.e.i.LobCreatorBuilderImpl  : HHH000422: Disabling contextual LOB creation as connection was null 
2016-04-17 13:07:53.993 ERROR 7432 --- [   main] org.hibernate.hql.spi.id.IdTableHelper : Unable obtain JDBC Connection 

java.sql.SQLException: ORA-01017: invalid username/password; logon denied 

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:385) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:938) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:480) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:416) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:825) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:596) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564) ~[ojdbc7-11.2.0.0.jar:12.1.0.1.0] 
    at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[na:1.8.0_73] 
    at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[na:1.8.0_73] 
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:155) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:130) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.internal.SessionFactoryImpl$2.obtainConnection(SessionFactoryImpl.java:648) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.hql.spi.id.IdTableHelper.executeIdTableCreationStatements(IdTableHelper.java:67) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy.finishPreparation(GlobalTemporaryTableBulkIdStrategy.java:125) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy.finishPreparation(GlobalTemporaryTableBulkIdStrategy.java:42) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.hql.spi.id.AbstractMultiTableBulkIdStrategyImpl.prepare(AbstractMultiTableBulkIdStrategyImpl.java:88) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:464) ~[hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) [hibernate-core-5.0.5.Final.jar:5.0.5.Final] 
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802) [hibernate-entitymanager-5.0.5.Final.jar:5.0.5.Final] 
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) [spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) [spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:319) [spring-orm-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at org.company.RestresourceApplication.main(RestresourceApplication.java:112) [classes/:na] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_73] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_73] 
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_73] 
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478) [spring-boot-maven-plugin-1.3.3.RELEASE.jar:1.3.3.RELEASE] 
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_73] 

2016-04-17 13:07:54.006 INFO 7432 --- [   main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory 
2016-04-17 13:07:54.162 WARN 7432 --- [   main] o.h.hql.internal.ast.HqlSqlWalker  : [DEPRECATION] Encountered positional parameter near line 1, column 49 in HQL: [from org.company.model.User user where userId = ?]. Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead. 
system admin 
2016-04-17 13:07:54.386 WARN 7432 --- [   main] org.hibernate.orm.connections   : HHH10001002: Using Hibernate built-in connection pool (not for production use!) 
2016-04-17 13:07:54.390 INFO 7432 --- [   main] org.hibernate.orm.connections   : HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:xe] 
2016-04-17 13:07:54.390 INFO 7432 --- [   main] org.hibernate.orm.connections   : HHH10001001: Connection properties: {user=system , password=****} 
2016-04-17 13:07:54.393 INFO 7432 --- [   main] org.hibernate.orm.connections   : HHH10001003: Autocommit mode: false 
2016-04-17 13:07:54.399 INFO 7432 --- [   main] .c.i.DriverManagerConnectionProviderImpl : HHH000115: Hibernate connection pool size: 20 (min=1) 
2016-04-17 13:07:54.451 WARN 7432 --- [   main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.company.service.UserService org.company.controller.UserController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.company.dao.UserDAO org.company.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory org.company.dao.UserDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in org.company.RestresourceApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hibernate.SessionFactory]: Factory method 'generateSessionFactoryBean' threw exception; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] 
2016-04-17 13:07:54.456 INFO 7432 --- [   main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 
2016-04-17 13:07:54.461 INFO 7432 --- [   main] o.apache.catalina.core.StandardService : Stopping service Tomcat 
2016-04-17 13:07:54.508 ERROR 7432 --- [   main] o.s.boot.SpringApplication    : Application startup failed 

Jede Hilfe sehr geschätzt wird.

+0

Der Fehler ist wirklich klar ist es nicht .. Der Benutzername und das Passwort Doesein't existieren nicht in der DB, die Sie versuchen, zuzugreifen. Können Sie von außerhalb Ihrer Anwendung mit demselben Benutzernamen und Passwort auf die Datenbank zugreifen? – ArunM

+0

Ja, ich habe von SQL-Entwickler Zugriff auf DB, und das Ergebnis ist erfolgreich. Und ich habe eine andere Web-App mit XML-Dateien, und diese Anwendung funktioniert gut. – Yuriy

Antwort

3

Ist es möglich, dass Sie whitespace in Ihrer hibernate.properties hibernate.connection.username haben? Erraten von Logging-Ausgabe:

{hibernate.connection.username=system , 
+0

Vielen Dank, aber ich verstehe nicht, warum Hibernate erhalten Eigenschaften aus dieser Datei, aber nicht aus meiner DataSource, und wenn ich Hibernate.properties-Datei lösche, erhalte ich einen Fehler: Die Anwendung sollte JDBC-Verbindung liefern. Erkläre mir bitte, warum Hibernate keine Eigenschaften von dataSource bekommen kann ?? – Yuriy

+1

Wenn Sie 'new LocalSessionFactoryBuilder (dataSource) erstellen, fügt spring die Eigenschaft hibernate.connection.datasource für Ihre Datenquelle hinzu. Wenn Sie jedoch SessionFactory erstellen, wird durch das Aufrufen von .setProperties (getHibernateProperties()) der aktuelle Satz von Eigenschaften ersetzt. Versuchen Sie stattdessen, die addProperties-Methode zu verwenden. – Tijkijiki

+0

Vielen Dank! – Yuriy

0

Dies ist wegen eines Fehlers in Oracle. geben Sie den Benutzernamen und das Passwort richtig ein. aber es wird auf eine andere Weise gesendet, es könnte eine Änderung Ihres Passworts von Großbuchstaben in Kleinbuchstaben oder Kleinbuchstaben in Großbuchstaben sein. Ich habe dieses Problem gelöst, indem ich mein Oracle-Passwort in Großbuchstaben geändert habe. sollten Sie es auch versuchen.