原因:java.lang.IllegalArgumentException:属性'driverClassName'不能为空 [英] Caused by: java.lang.IllegalArgumentException: Property 'driverClassName' must not be empty

查看:1068
本文介绍了原因:java.lang.IllegalArgumentException:属性'driverClassName'不能为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我在此处共享的代码中线程"restartedMain"中的异常; java.lang.reflect.InvocationTargetException原因:java.lang.NullPointerException 我收到新错误.你能帮我这个忙吗?

In the code I have shared here Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException Caused by: java.lang.NullPointerException I am getting new error. Could you please help me with this.

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'springLogging3Application': Unsatisfied dependency expressed through field 'factory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'factory' defined in com.spring.main.SpringLogging3Application: Unsatisfied dependency expressed through method 'getSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in com.spring.main.SpringLogging3Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Circular reference involving containing bean 'springLogging3Application' - consider declaring the factory method as static for independence from its containing instance. Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: Property 'driverClassName' must not be empty
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:598) ~[spring-beans-5.1.15.RELEASE.jar:5.1.15.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Circular reference involving containing bean 'springLogging3Application' - consider declaring the factory method as static for independence from its containing instance. Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: Property 'driverClassName' must not be empty
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.15.RELEASE.jar:5.1.15.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.15.RELEASE.jar:5.1.15.RELEASE]
    ... 51 common frames omitted
Caused by: java.lang.IllegalArgumentException: Property 'driverClassName' must not be empty
    at org.springframework.util.Assert.hasText(Assert.java:284) ~[spring-core-5.1.15.RELEASE.jar:5.1.15.RELEASE]

application.properties

application.properties

server.port=6565

db.driver:oracle.jdbc.driver.OracleDriver
db.url:jdbc:oracle:thin:@localhost:1521:xe  
db.username:xxxx  
db.password:xxxx

hibarenate.dialect:org.hibernate.dialect.OracleDialect
hibarenate.show_sql:true  
hibarenate.hbm2ddl.auto:update
entitymanager.packagesToScan:com.spring.main

更新了一个:

server.port=6565

db.driver=oracle.jdbc.driver.OracleDriver
db.url=jdbc:oracle:thin:@localhost:1521:xe  
db.username=xxxx 
db.password=xxxx

hibarenate.dialect=org.hibernate.dialect.OracleDialect
hibarenate.show_sql=true  
hibarenate.hbm2ddl.auto=update
entitymanager.packagesToScan=com.spring.main

推荐答案

尝试以下操作:

  • 请勿在application.properties文件中混合使用"="和:"分隔符
  • 登录"db.driver"属性,它似乎为空

致谢.

这篇关于原因:java.lang.IllegalArgumentException:属性'driverClassName'不能为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆