Flyway migration validation fails after running integration test - spring-boot

I have a problem with flyway migration validation when I am running integration tests on local. Whenever it fails, I delete flywaydb in .m2 folder and then I run maven install then run the test and everything is fine. But when I run test second time it fails with flyway validation error again. I do not understand what is the reason. Anyone has any idea ?
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation
Detected failed migration to version 5
....
Caused by: org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation

Related

gradle7.4.2 can not implementation local jar

gradle7.4.2 can not implementation local jar
the error is npe.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':client:rest'.
at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:116)
Caused by: java.lang.NullPointerException
I need to use local jar into project, used gradle 5.4.2 is success, but use 7.4.2, always error...
I use many method to test, but can not access...
enter image description here
how to handle the exception?
thanks~~~

Kogito processes build failing - enum mismatch

Using Quarkus version 2.7.3.Final, the build is failing because of the 2 different enums value field clashing.
Java 11
Error details:
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor#postGenerationProcessing threw an exception: org.infinispan.protostream.DescriptorParserException: Enum value org.kie.kogito.app.Level.value clashes with enum value org.kie.kogito.app.Error422Code.value
Is it a known issue?
Is there any workaround to use the enums?
I managed to easily reproduce the issue and created the following JIRA to track: https://issues.redhat.com/browse/KOGITO-7063

How run spring boot jar with class path resource

I have a spring boot application. It works perfectly if I run it from Eclipse. But if I run the same from command prompt, I am getting the following error
ERROR
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.kafka.core.ProducerFactory]: Factory method 'kafkaProducerFactory' threw exception; nested exception is java.lang.IllegalStateException: Resource 'class path resource [kafka/somejksfile.jks]' must be on a file system\r\n\tat
I extracted the .jar file and I was able to see the Kafka related .jks file inside
projectName\BOOT-INF\classes
For some reason it is not picking all the files which are inside src/main/resources. How to refer that location when running the .jar from command prompt. I tried the following with no luck
java -jar -Dspring.profiles.active=dev -Dspring.config.location=file:\\C:\my-files\poc\projectName\src\main\resources\ api-account-info.jar
Note: I cannot make any code changes
I resolved the issue by the following.
Downloaded Spring Boot CLI and extracted it. (https://repo.spring.io/release/org/springframework/boot/spring-boot-cli/2.6.2/spring-boot-cli-2.6.2-bin.zip)
Set environment variable
Variable: SPRING_HOME
Value: C:\my-files\Installations\spring-boot-cli-2.6.2-bin\spring-2.6.2
Variable: Path
Value: %SPRING_HOME%\bin
From command prompt run the following commands
SET SPRING_PROFILES_ACTIVE=dev
mvn spring-boot:run
This will build and start the application.

Spring-boot app working in IDEA but crash when running jar - “Unable to resolve persistence unit"

Updated:
It's been days that I tried to accomodate some times in between then came back to this code-base, but still faced up the same issue.
I am frustrated that have a Spring Boot 1.5.12 application that worked in IDEA but failed when running executable jar in Unix box, and the stack trace follows this format that I needed to trim the stack trace for relevancy:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxEntityManager' defined in class path resource [com.abc.persistence.ConfigClass]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
................. [Skipped the stack strace]
Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:602)
... 48 common frames omitted
As per suggestion by Getting "Unable to resolve persistence unit" error when building jar without IDE, I tried this workaround of 2 changes but it doesn't work at all.
1)#EnableAutoConfiguration(exclude = HibernateJpaAutoConfiguration.class) to my application class
2)spring.data.jpa.repositories.enabled=false to my application.yml file in src/main/resource/ directory
Even with those two changes being added, it still shows the same error.
I hope someone can help me figure out this frustrating inconsistency occured between the run time behavior in IDEA and executable jar in console.
Edit:
I used Gradle build script with this build task applications to build the app jar executable whose jar pull everything of src files in package names and resource property configuration yaml files besides gradle build:
applications {
...
}
So I've been tried to crack the root cause that runs my life nuts, which is based on this possible mystery:
Can someone know about jar (JVM) process of how it processes to create jar artifacts that in the end when I face the extremely weird anomaly where Intellj has always been able to set the persistence unit URL to default, whereas running on jar doesn't accomodate this auto-configuration already coded in the app and property codes?

Error when deploying application: Nested exception Resolution

I created an application in Jdeveloper 10g. I have created a war for my app. Then I attempted to deploy my app to an application server (Oracle Enterprises manager). When I deploy, it is throwing an error which is given below:
Failed to deploy web application "test". Failed to deploy web application "test". . Nested exception
Resolution:
Base Exception:
com.evermind.server.rmi.OrionRemoteException
Class not found:
org.springframework.beans.factory.access.BootstrapException;
nested exception is:
java.lang.ClassNotFoundException:
org.springframework.beans.factory.access.BootstrapException.
Class not found:
org.springframework.beans.factory.access.BootstrapException;
nested exception is:
java.lang.ClassNotFoundException:
org.springframework.beans.factory.access.BootstrapException
So please help me out with this. Thanks
You are missing a library file (presumably the spring framework). You can either add it to your server in in the library folder for the app server, or you can include it in you war file in the WEB-INF/libs/ folder.

Resources