具有使用Java 11编译的EAR应用程序。 部署到Wildfly 14时,返回以下错误:
Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ef' defined in class path resource [application-context.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [application-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]
...
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]
at deployment.test-1.0.ear//org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:121)
与Java 8编译的同一应用程序部署没有问题(实际上,它是作为Java 8应用程序启动的)。因此,驱动程序本身似乎不是问题。
这是Wildfly路径modules / system / layers / base / com / oracle / main中的 module.xml :
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.5" name="com.oracle">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
更改EAR应用程序的最佳方法是什么,以便在使用Java 11进行编译时可以正确地伪装?
答案 0 :(得分:1)
ojdbc6
驱动程序不支持Java11。根据What are the Oracle JDBC releases versus JDK versions,只有具有数据库18.3的ojdbc8
驱动程序完全支持Java 11。
要么升级驱动程序(可能还有数据库),要么继续使用Java 8。