kandan
kandan

Reputation: 737

EAR compiled with java 11 deployment error

Have an EAR application compiled with java 11. When deployed to Wildfly 14 returns the following error:

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)

The same application compiled with Java 8 deploys without problems (Actually it started as a java 8 application). So it does not seem to be an issue with the driver itself.

This is the module.xml in the Wildfly path modules/system/layers/base/com/oracle/main:

<?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>

What is the best way to change the EAR application so when compiled with java 11 will depoy correctly?

Upvotes: 1

Views: 742

Answers (1)

Karol Dowbecki
Karol Dowbecki

Reputation: 44932

ojdbc6 driver does not support Java 11. Only ojdbc8 driver with database 18.3 is fully supporting Java 11, as per What are the Oracle JDBC releases versus JDK versions.

Either upgrade the driver (and potentially the database) or keep using Java 8.

Upvotes: 1

Related Questions