After upgrading Spring Boot version to 2.7 Flowable engine not able create table - spring-boot

I have updated spring-boot-starter-parent dependency version to 2.7.1 and flowable-engine to 6.8.0
then after when I am running JUnit test cases then I am getting below error
> nested exception is org.flowable.common.engine.api.FlowableException: couldn’t create db schema: create table ACT_HI_TSK_LOG (column names .....)
..
..
..
Caused by: org.h2.jdbc.JdbcSqlNonTransmissionException: Unknown data type: "IDENTITY"; SQL Statement: create table ACT_HI_TSK_LOG (ID_ identity, TYPE_ varchar(64), TASK_ID_ varchar(64) not null, .....)
Getting same error for creating ACT_EVT_LOG table
I don't have defined or written this tables and I think this is coming from the flowable-engine dependency.
Dependencies which I have used :
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-engine</artifactId>
<version>6.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<type>pom</type>
</dependency>
Can someone help me on this please.
If I am using Spring 2.6.x version then it's working fine and all JUnit test cases are getting passed
GETTING BELOW ERROR AFTER UPGRADING THE SPRING-BOOT-STARTER-PARENT v2.7.7
H2 is on v1.4.200 And flowable-engine v6.8.0
Error creating bean with name 'processEngine': FactoryBean threw the exception on object creation; nested exception is java.lang.RuntimeException: Exception while initializing Database connection at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) .........
................
ommitted caused by: java.lang.RuntimeException: Exception while initializing Database connection at
...................
......................
org.flowable.spring/SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:76) at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:59) at
org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) ... 65 common frames omitted Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The drive could not establish a secure connection to SQL Server by using Secure Socket Layer (SSL) exception. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:a31221-r15-erer-gdf45451 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3680) at
com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2047) at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3204) at
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2833) at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2671) at

Related

Are spring-boot-starter-data-jpa and Liquibase incompatible?

I tried to setup a new Spring Boot 2.4.3 project and I want to include Liquibase as well as Spring Data JPA.
To achieve this I use the following dependencies in my POM:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
or...
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>${liquibase.version}</version>
</dependency>
...respectively and
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
with
<kotlin.version>1.4.31</kotlin.version>
<liquibase.version>4.3.1</liquibase.version>
<hibernate.version>5.4.29.Final</hibernate.version>
Yet, in the beginning, I don't have any DB setup so far and in application.yaml you can find:
server:
port: 8080
spring:
liquibase:
change-log: classpath:db/changelog/db.changelog.yml
wherbey db.changelog.yml is empty.
A Maven install using the spring-boot-starter-data-jpa dependency results in:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is
liquibase.exception.ChangeLogParseException: Empty file classpath:db/changelog/db.changelog.yml
Caused by: liquibase.exception.ChangeLogParseException: Empty file classpath:db/changelog/db.changelog.yml
while when commenting out this dependency the build succeeds.
I found out that the empty db.changelog.yml file must contain at least:
databaseChangeLog:
- changeset:
although on https://docs.liquibase.com/concepts/basic/changelog.html an example is given that an empty changelog.yaml file needs to look like:
databaseChangeLog:
, but this results in a BeanCreationException:
Caused by: liquibase.exception.ChangeLogParseException: Could not find databaseChangeLog node

Spring Boot application breaks after upgrade to Apache Derby 10.15 -- why?

During a round of SOUP upgrades in a Spring Boot application, I bumped Apache Derby from 10.14.1.0 to 10.15.1.3. Now the tests fail with this beauty (snipped, full stacktrace here):
Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource':
Invocation of init method failed
Caused by: java.lang.IllegalStateException:
Failed to replace DataSource with an embedded database for tests.
If you want an embedded database please put a supported one on the
classpath or tune the replace attribute of #AutoConfigureTestDatabase.
What is going here? Do I need to change any configuration?
Apache Derby requires Java 9 from 10.15.x on which Spring Boot does currently not support.
See also spring-boot#16433.
I just want to answer with what it took me to get Derby 15.2.0 to work with Spring Boot 2.4.4 with derby in embedded mode, on top of Java 11. Spring Boot 2.4.4 works out of the box with Derby 14, although you will get some warning as spring boot starts. Upgrading apache derby to 15.2.0 fixed that for me.
In pom, both derby and derbytools dependencies defined:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
Then in your apps properties file:
spring.datasource.driver-class-name=org.apache.derby.iapi.jdbc.AutoloadedDriver
Instead of:
spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver
After that, I now get a good startup of Spring Boot with no warnings or anything that raises concerns.

org.springframework.cloud.CloudException: No unique service matching interface org.springframework.amqp.rabbit.connection.ConnectionFactory found.

I am trying to deploy the springboot application in Pivotal Cloud Foundry. I am getting following exception.
Caused by: org.springframework.cloud.CloudException: No unique service matching interface org.springframework.amqp.rabbit.connection.ConnectionFactory found. Expected 1, found 0
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.rabbit.connection.ConnectionFactory]: Factory method 'rabbitConnectionFactory' threw exception; nested exception is org.springframework.cloud.CloudException: No unique service matching interface org.springframework.amqp.rabbit.connection.ConnectionFactory found. Expected 1, found 0
Try adding spring-cloud-services-starter-service-registry maven dependency.
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-starter-service-registry</artifactId>
<version>3.1.5.RELEASE</version>
</dependency>

dropwizard and hive/hiverunner integration with maven

most of the dropwizard:0.9.2 maven dependencies use glassfish jersey 2:
org.glassfish.jersey.media:jersey-media-multipart:jar:2.22.1:compile
org.apache.hive:hive-service:1.2.1 and com.klarna.hiverunner:3.1.0 both use com.sun.jersey 1:
com.sun.jersey:jersey-client:jar:1.9:runtime
I keep getting the following error:
java.lang.RuntimeException: javax.servlet.ServletException: io.dropwizard.jersey.setup.JerseyServletContainer-2acbc859#570b3305==io.dropwizard.jersey.setup.JerseyServletContainer,1,false
Caused by: A MultiException has 3 exceptions. They are:
1. java.lang.NullPointerException
2. java.lang.IllegalStateException: Unable to perform operation: method inject on com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
3. java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory
I get the following if I exclude jersey-core from hive:
java.lang.NoSuchMethodError: org.apache.hive.service.server.HiveServer2.init(Lorg/apache/hadoop/hive/conf/HiveConf;)V
The goal is to set up an in-memory hive using hiverunner then write stuff to hiveDB (Derby) using dropwizard API endpoints.
Looks like jersey 2 stopped using jersey 1's JSONJAXBContext.
Is there a proper way to get around this jersey 1 & 2 dependency conflict?

Spring boot - Eclipelink scanning orm.xml

I'm converting an existing application to spring boot, when I run the application using the created jar I get an exception when it scans and finds an orm.xml inside my entities jar (included as a dependency).
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException:
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: org.springframework.boot.loader.LaunchedURLClassLoader#38cdedfd
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [UAccessPersistenceUnit] failed.
Internal Exception: java.lang.RuntimeException: java.io.IOException: Unable to open root Jar file 'jar:file:everything-jar.jar'
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:107)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [UAccessPersistenceUnit] failed.
Internal Exception: java.lang.RuntimeException: java.io.IOException: Unable to open root Jar file 'jar:file:everything-jar.jar'
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1954)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1945)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:96)
... 46 common frames omitted
Caused by: org.eclipse.persistence.exceptions.EntityManagerSetupException:
Exception Description: Predeployment of PersistenceUnit [UAccessPersistenceUnit] failed.
Internal Exception: java.lang.RuntimeException: java.io.IOException: Unable to open root Jar file 'jar:file:everything-jar.jar'
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:230)
... 50 common frames omitted
This isn't using spring data, i'm building the datasources from a external properties file at the moment. It's the scanning that seems to cause issues.
This is spring boot 1.1.5-RELEASE with eclipselink 2.5.1
everything-jar.jar is a spring boot packed jar. With my compiles classes, the spring boot loader and the entities packaged in a jar. I've marked the dependency to be unpacked and it works, but it's not ideal.
This problem keeps coming up, now if I try to load persistence.xml from another jar it throws this same exception.
After a lot of investigation it seems there are two parts to the problem here.
The spring boot loader supports urls that look something like this :
jar:file:!/!/
Eclipselink generates urls for embedded orm.xml files like so
jar:jar:file:!/!/
I've got a fix in spring boot to make it better at opening the eclipselink URLs, but for an immediate fix we need to create a custom ArchiveFactoryImpl and override the createArchive method to return a custom JarInputStreamURLArchive when the protocol is jar.
In this custom class override the get entry as URL to check for a url with a protocol of jar that starts with jar and create a new URL from the file of the original (this cuts off the protocol part from the original url giving us jar:url instead of jar:url:url
public URL getEntryAsURL(String entryPath) throws IOException {
URL entryUrl = super.getEntryAsURL(entryPath);
if(entryUrl == null) {
return null;
}
if("jar".equals(entryUrl.getProtocol()) && entryUrl.getFile().startsWith("jar:")) {
//cut off the jar portions
String file = entryUrl.getFile();
return new URL(file);
} else {
return entryUrl;
}
}

Resources