My build is successful but deployment using Wildfly 16 on Windows is failing. On my macbook it works.
Windows OpenJDK 1.8.0_252. Macbook OpenJDK 1.8.0_251
Wildfly 16 configurations such as drivers on Windows and my Mac are equal.
Does anyone here have a clue? What am I missing.
Thanks in advance for your attention. Your help is much appreciated.
applicationContext.xml
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="YYY" />
<property name="persistenceXmlLocation" value="classpath:persistence.xml" />
<property name="dataSource" ref="yyyDataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="generateDdl" value="false" />
<property name="databasePlatform" value="org.hibernate.dialect.DB2400Dialect" />
</bean>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
</property>
</bean>
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="YYY" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/xxx/YYYDB</jta-data-source>
<class>nl.xxxx.xx.xxx.xxx</class>
<class>nl.xxxx.xx.xxx.xxx</class>
<properties>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.DB2400Dialect" />
<!--<property name="javax.persistence.sharedCache.mode" value="ALL"/> -->
</properties>
</persistence-unit>
</persistence>
pom.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.3.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.4.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.2.4.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws</artifactId>
<version>2.1.4.RELEASE</version>
<classifier>all</classifier>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.2.2.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
standalone.xml
<datasource jta="true" jndi-name="java:/jdbc/xxx/YYYDB" pool-name="YYYDB" enabled="true" use-ccm="false">
<connection-url>jdbc:db2://xxxxxx.xxx.net:xxxx/xxxxx</connection-url>
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
<driver>db2</driver>
<new-connection-sql>SELECT current date FROM sysibm.sysdummy1</new-connection-sql>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<max-pool-size>5</max-pool-size>
</pool>
<security>
<user-name>yyy02</user-name>
<password>${VAULT::vault::yyy02::1}</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
Stacktrace
09:27:44,076 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "xxxx-services-ear.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"xxxx-services-ear.ear\".\"xxxxx-services-xxx.war\".undertow-deployment" => "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.HibernateException: Unable to construct requested dialect [org.hibernate.dialect.DB2400Dialect]
Caused by: java.lang.ClassCastException: org.hibernate.dialect.DB2400Dialect cannot be cast to org.hibernate.dialect.Dialect"}}
09:27:44,077 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "xxxx-services-ear.ear" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"xxxx-services-ear.ear\".\"xxxx-services-xxx.war\".undertow-deployment" => "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.HibernateException: Unable to construct requested dialect [org.hibernate.dialect.DB2400Dialect]
Caused by: java.lang.ClassCastException: org.hibernate.dialect.DB2400Dialect cannot be cast to org.hibernate.dialect.Dialect"}}
09:27:44,089 DEBUG [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) unRegistering EJB client context for classloader ModuleClassLoader for Module "deployment.xxxx-services-ear.ear" from Service Module Loader
09:27:44,091 DEBUG [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) unRegistering EJB client context for classloader ModuleClassLoader for Module "deployment.xxxx-services-ear.ear.xxxx-services-xxx.war" from Service Module Loader
09:27:44,095 DEBUG [org.wildfly.extension.batch] (MSC service thread 1-1) Removing batch environment; ModuleClassLoader for Module "deployment.xxxx-services-ear-.ear.xxxx-services-xxx.war" from Service Module Loader
09:27:44,111 DEBUG [org.infinispan.manager.DefaultCacheManager] (MSC service thread 1-7) Stopping cache manager null on null
09:27:44,118 DEBUG [org.infinispan.manager.DefaultCacheManager] (MSC service thread 1-7) Stopped cache manager null
09:27:44,118 DEBUG [org.jboss.as.clustering.infinispan] (MSC service thread 1-7) frontend-services-cache cache container stopped
09:27:44,462 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0208: Stopped subdeployment (runtime-name: xxxx-services-xxx.war) in 383ms
09:27:44,951 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028: Stopped deployment xxxx-services-ear.ear (runtime-name: frontend-services-ear-2.21.0-SNAPSHOT.ear) in 873ms
[2020-07-28 09:27:45,090] Artifact xxxxx-services-ear:ear: Error during artifact deployment. See server log for details.
[2020-07-28 09:27:45,091] Artifact xxxxx-services-ear.ear: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"xxxxx-services-ear.ear\".\"xxxx-services-xxx.war\".undertow-deployment" => "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.HibernateException: Unable to construct requested dialect [org.hibernate.dialect.DB2400Dialect]
Caused by: java.lang.ClassCastException: org.hibernate.dialect.DB2400Dialect cannot be cast to org.hibernate.dialect.Dialect"}}
09:27:52,669 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0272: Suspending server
09:27:52,677 INFO [org.jboss.as.ejb3] (management-handler-thread - 1) WFLYEJB0493: EJB subsystem suspension complete
09:27:52,680 DEBUG [org.jboss.remoting.remote.connection] (management I/O-2) JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host
09:27:52,682 INFO [org.jboss.as.server] (Management Triggered Shutdown) WFLYSRV0241: Shutting down in response to management operation 'shutdown'
I think it is a class loading problem.
First of all, Wildfly 16 uses version 5.3.9.Final of hibernate, so you should change your pom to this version. Secondly, all these hibernate jars are automatically provided by Wildfly, so they should be with scope
provided
in yourpom.xml
because you shouldn't include them in your final war/ear file.