Spring Boot project: Enhancement not working

1,096 views
Skip to first unread message

Jean-François Côté

unread,
Nov 15, 2021, 8:03:01 AM11/15/21
to Ebean ORM
Hi Rob!

I have a brand new Spring Boot application with Ebean. When I start the project using IntelliJ with the Ebean Enhancement Plugin activated, everything works perfectly (Using the Spring Boot Application Run Configuration).

The problem is when I'm trying to run my application using Gradle only . It is able to build but it seems the enhancement is not done. I receive this error:

{"@timestamp":"2021-11-15T07:33:58.100-05:00","@version":"1","message":"Application run failed","logger_name":"org.springframework.boot.SpringApplication","thread_name":"main","level":"ERROR","stack_trace":"org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.stingray.traininghubbackend.Application]; nested exception is java.io.FileNotFoundException: class path resource [io/ebean/Finder.class] cannot be opened because it does not exist\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189)\r\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331)\r\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)\r\n\tat org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)\r\n\tat org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)\r\n\tat org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)\r\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)\r\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)\r\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782)\r\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774)\r\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:339)\r\n\tat com.stingray.traininghubbackend.Application.main(Application.java:12)\r\nCaused by: java.io.FileNotFoundException: class path resource [io/ebean/Finder.class] cannot be opened because it does not exist\r\n\tat org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:187)\r\n\tat org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:55)\r\n\tat org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:49)\r\n\tat org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)\r\n\tat org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86)\r\n\tat org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73)\r\n\tat org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:696)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:1010)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:341)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:304)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207)\r\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175)\r\n\t... 12 common frames omitted\r\n"}

Here is my build.gradle

buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:$openapitools_generator_version"
}
}

plugins {
id 'org.springframework.boot' version '2.4.5'
id 'io.franzbecker.gradle-lombok' version '4.0.0'
//id 'io.ebean' version '12.8.3' #Didn't change anything...
}

apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
//apply plugin: 'io.ebean' #Didn't change anything...

apply from: 'gradle/openapitools-server-generator.gradle'

description = """TrainingHubBackend Service"""

springBoot {
buildInfo()
}

ebean {
debugLevel = 1
}

dependencies {
implementation project(":api")

implementation("com.stingray.web-rest-commons:web-rest-spring-boot-starter:1.0.1")
implementation("com.stingray.apikey-web-security:apikey-spring-boot-starter:1.0.4")

//Spring boot starter
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")

//Metrics
implementation("io.micrometer:micrometer-registry-prometheus")

//Logging
implementation group: 'org.codehaus.janino', name: 'janino', version: '3.0.16'
implementation("net.logstash.logback:logstash-logback-encoder:6.6")

//Required to compile generated code
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '3.0.0'

implementation("io.swagger:swagger-annotations:$swagger_annotations_version")

//Feature flags
implementation 'com.solidstategroup:bullet-train-client:1.6'

//Everything related to database/ORM
compileOnly("io.ebean:ebean:12.8.3")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("mysql:mysql-connector-java:$mysql_connector_version")
implementation("org.flywaydb:flyway-core")

//Testing
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.junit.platform:junit-platform-runner:$junit_platform_runner_version")
}

tasks.withType(Test) {
useJUnitPlatform()
systemProperty 'spring.profiles.active', 'dev'
}

Any idea what I am missing?

Jean-François Côté

unread,
Nov 16, 2021, 11:19:10 AM11/16/21
to Ebean ORM
Since  I wrote this thread, I have updated my dependencies to this:

testImplementation group: 'io.ebean', name: 'querybean-generator', version: '12.8.3'

compileOnly("io.ebean:ebean:12.8.3  ")
compile("io.ebean:ebean-querybean:12.8.3")

I can see my unique model is generated. But I still receive the same error, like this:

{"@timestamp":"2021-11-16T16:12:56.233Z","@version":"1","message":"Application run failed","logger_name":"org.springframework.boot.SpringApplication","thread_name":"main","level":"ERROR","stack_trace":"org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.stingray.traininghubbackend.Application]; nested exception is java.io.FileNotFoundException: class path resource [io/ebean/Finder.class] cannot be opened because it does not exist\n\tat org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189)\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331)\n\tat org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)\n\tat

I really don't understand what is going on... It should be working...

Rob Bygrave

unread,
Dec 21, 2021, 11:39:54 PM12/21/21
to ebean@googlegroups
Apologies, that no one got back to you on this one.

The gradle dependencies are not correct:


testImplementation group: 'io.ebean', name: 'querybean-generator', version: '12.8.3'
compileOnly("io.ebean:ebean:12.8.3  ")
compile("io.ebean:ebean-querybean:12.8.3")


Both io.ebean:ebean and io.ebean:ebean-querybean should be implementation and not compile/compileOnly.

io.ebean:querybean-generator should be annotationProcessor and not testImplementation

Have a look at the example at: https://github.com/ebean-orm/examples/blob/master/basic-gradle-java/build.gradle#L21


Cheers, Rob.

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ebean/3fc1b6de-55f8-4af8-9e60-bf08134b0646n%40googlegroups.com.

Jean-François Côté

unread,
Dec 22, 2021, 8:59:40 AM12/22/21
to Ebean ORM
Thanks Rob, it worked. Between my question and your answer, I reverted back to version 11 and get it to work but I prefer using this one!

Thanks!

Rob Bygrave

unread,
Dec 22, 2021, 4:34:51 PM12/22/21
to ebean@googlegroups
Great. Apologies again for getting back to this so late.

Cheers, Rob.

Reply all
Reply to author
Forward
0 new messages