Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails 5 - Unable to deploy on Wildfly 26.1.2 #12743

Closed
jarantes17 opened this issue Oct 24, 2022 · 19 comments
Closed

Grails 5 - Unable to deploy on Wildfly 26.1.2 #12743

jarantes17 opened this issue Oct 24, 2022 · 19 comments
Assignees

Comments

@jarantes17
Copy link

jarantes17 commented Oct 24, 2022

I'm trying to deploy my grails application (latest stable version 5.2.4) on Wildfly application server (version 26.1.2). I've dealt with some log-related conflict points, however, now I'm getting the following error:

{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"g6web-0.1-plain.war\".undertow-deployment" => "java.lang.RuntimeException: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
    Caused by: java.lang.RuntimeException: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
    Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor)."}}

This seems to have something bug from micronaut dependency. Maybe the issue below:
micronaut-projects/micronaut-core#7144

Gradle dependencies:

dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")
    compileOnly "io.micronaut:micronaut-inject-groovy"
    console "org.grails:grails-console"
    providedCompile "org.springframework.boot:spring-boot-starter-logging"
    implementation "org.springframework.boot:spring-boot-starter-validation"
    implementation "org.springframework.boot:spring-boot-autoconfigure"
    implementation "org.grails:grails-core"
    implementation "org.springframework.boot:spring-boot-starter-actuator"
    providedCompile "org.springframework.boot:spring-boot-starter-tomcat"
    implementation "org.grails:grails-plugin-url-mappings"
    implementation "org.grails:grails-plugin-rest"
    implementation "org.grails:grails-plugin-codecs"
    implementation "org.grails:grails-plugin-interceptors"
    implementation "org.grails:grails-plugin-services"
    implementation "org.grails:grails-plugin-datasource"
    implementation "org.grails:grails-plugin-databinding"
    implementation "org.grails:grails-web-boot"
    implementation "org.grails:grails-logging"
    implementation "org.grails.plugins:cache"
    implementation "org.grails.plugins:async"
    implementation "org.grails.plugins:events"
    implementation "org.grails.plugins:hibernate5"
    implementation "org.hibernate:hibernate-core:5.6.12.Final"
    implementation "org.grails.plugins:views-json"
    implementation "org.grails.plugins:views-json-templates"
    profile "org.grails.profiles:rest-api"
    runtimeOnly "org.apache.tomcat:tomcat-jdbc"
    runtimeOnly 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
    testImplementation "io.micronaut:micronaut-inject-groovy"
    testImplementation "org.grails:grails-gorm-testing-support"
    testImplementation "org.mockito:mockito-core"
    testImplementation "io.micronaut:micronaut-http-client"
    testImplementation "org.grails:grails-web-testing-support"
    testImplementation "org.grails:views-json-testing-support"
    testImplementation "org.hibernate.validator:hibernate-validator:8.0.0.Final"

    implementation "mysql:mysql-connector-java:8.0.30"
    implementation "org.codehaus.jackson:jackson-mapper-asl:1.9.13"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4"
    implementation "com.codahale.metrics:metrics-json:3.0.2"
}

WEB-INF jboss configs:
jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
      http://www.jboss.com/xml/ns/javaee
      http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
    <context-root>api</context-root>
</jboss-web>

jboss-deployment-structure

<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclusions>
            <module name="org.hibernate.validator" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

Expected Behavior

Deploy and usually run the application in Wildfly as grails 5.2.4.

Actual Behaviour

Failed deployment

Steps To Reproduce

1.Run grails clean
2. Run grails dev war
3. Upload war on wildfly management interface
4. I got the above mentioned error

Environment Information

  • Operating System: Windows 10/Ubuntu 22.04
  • Grails Version: 5.2.4
  • Gorm Version: 7.3.2
  • JDK Version: 1.8
  • Container Version (If Applicable): Wildfly 26.1.2

Example Application

No response

Version

5.2.4

@gabrielpadilh4
Copy link

Hello Guys, i'm facing the same issue with the latest version of Grails. If we use an older version(Grails 3 for example), the application is deployed with success and works normally.

@gilbertozzz
Copy link

I would like to update grails to version 5, but I will do it after solved.

jarantes17 referenced this issue Dec 7, 2022
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@jarantes17
Copy link
Author

@puneetbehl Could you help me with this issue? I replicated test with grails 5.2.5 and 6.0.0-M1 versions and I got same problem. Even after updating micronaut dependencies and some related fixes from latest grails versions. This error occurs only at deployment time in wildfly.

@puneetbehl puneetbehl self-assigned this Dec 19, 2022
@puneetbehl puneetbehl changed the title Grails 5.2.4 does not deploy on Wildfly 26.1.2 Grails 5 - Unable to deploy on Wildfly 26.1.2 Dec 19, 2022
@tpraj24
Copy link

tpraj24 commented Feb 27, 2023

@puneetbehl Could you help me with this issue? I replicated test with grails 5.2.5 and 6.0.0-M1 versions and I got same problem. Even after updating micronaut dependencies and some related fixes from latest grails versions. This error occurs only at deployment time in wildfly.

I am getting same error while deploying sample hello world grails 5.2.5 on Websphere server. If you are able to resolve it or provide any insights, please share it. Thank you.

@puneetbehl
Copy link
Member

@tpraj24 I didn't get a chance to look at it.

@tpraj24
Copy link

tpraj24 commented Mar 6, 2023

@tpraj24 I didn't get a chance to look at it.

hi Puneet - Following up to see if you got a chance to check this. We are in process of migrating to grails 5 and our application runs on Websphere server, we were not able to go further without resolving this deployment issue. Any help is really appreciated.

@tpraj24
Copy link

tpraj24 commented Mar 6, 2023

@puneetbehl Could you help me with this issue? I replicated test with grails 5.2.5 and 6.0.0-M1 versions and I got same problem. Even after updating micronaut dependencies and some related fixes from latest grails versions. This error occurs only at deployment time in wildfly.

Did you able to pass through this issue.

@parthbhagat
Copy link

I tried with latest stable grails release (5.3.2), that too have the same issue. I tried the workaround here. But it is not working somehow. Anyone found the solution for this?

@parthbhagat
Copy link

parthbhagat commented Mar 20, 2023

Do these changes fixes the issue? If so then shouldn't there be a new release with this fix? @puneetbehl can you kindly help to fix the issue in probably new release or guide how it can be used in existing 5.3.2 release?

@ziceck
Copy link

ziceck commented Apr 24, 2023

Also I have this problem with Grails 5.2.0 and Tomcat 9
Does anyone know how to solve this?

@jarantes17
Copy link
Author

Hi @ziceck I used another approach without application container running grails with embedded tomcat and nginx as reverse proxy.

@lucas-napse
Copy link

same issue here, grails 5.3.2, wildfly 27.0.1 final. We are not using any micronaut dependency.

@ziceck
Copy link

ziceck commented Aug 23, 2023

same issue here, grails 5.3.2, wildfly 27.0.1 final. We are not using any micronaut dependency.
@lucas-napse

In my case, with Grails 4.x I was using providedRuntime "org.springframework.boot:spring-boot-starter-tomcat"
to solve the problem in Grails 5.x I changed to implementation "org.springframework.boot:spring-boot-starter-tomcat"

@lucas-napse
Copy link

lucas-napse commented Aug 25, 2023

same issue here, grails 5.3.2, wildfly 27.0.1 final. We are not using any micronaut dependency.
@lucas-napse

In my case, with Grails 4.x I was using providedRuntime "org.springframework.boot:spring-boot-starter-tomcat" to solve the problem in Grails 5.x I changed to implementation "org.springframework.boot:spring-boot-starter-tomcat"

thanks but this didn't solve the problem. I understand that your case was replaced by different versions of gradle.

@lucas-napse
Copy link

lucas-napse commented Aug 25, 2023

same issue here, grails 5.3.2, wildfly 27.0.1 final. We are not using any micronaut dependency.

Investigating a little more, I see that the micronaut dependency, although our project does not add it, is transitive due to the grails-core dependency. I also add that the war created with gradle assemble, which includes embedded tomcat, while giving java -jar file.war, works correctly. The problem is with the war that does not include embedded tomcat, and that we need to use it on wildfly 20. I tested in my case both on wildfly 20 and wildfly 27 that have error. (adding websphere and tomcat, which mentioned above)

@lucas-napse
Copy link

same issue here, grails 5.3.2, wildfly 27.0.1 final. We are not using any micronaut dependency.

I add that this happens both using grails 5.3.2, 5.3.3, and grails 6.0.0 latest version

@armeris
Copy link

armeris commented Apr 1, 2024

I'm having this issue too and while not having a solution I think that very probably the error comes from Micronaut, not from Grails, but as Grails 5 and 6 rely on Micronaut we inherit this error.
I'm trying to deploy a Grails 6 app in Wildfly 15 and I'm getting this error about NoSuchBeanException. To look for the error I've create apps in the different frameworks Grails uses: spring-boot and micronaut.
With spring-boot the app works in Wildfly flawlessly.
With micronaut 3.10 the same error as in Grails (NoSuchBean blablabla ApplicationEventPubliser blablaba).
I've tried micronaut 4.3.7 and IT WORKS!! But it seems that micronaut needs groovy 4 and grails needs groovy 3, and you cannot use micronaut version 4 on grails...

@guillermocalvo
Copy link
Contributor

I believe the root cause is that Wildfly 26.1.2 doesn't provide support for Jakarta EE 10. Please try using the latest WildFly release and feel free to reopen this issue if you find any other errors.

@qwerty-debug
Copy link

test-6.2.0.zip
test-6.2.0.log
Unable to deploy the latest version of Grails (6.2.0) to the latest release of WildFly (31.0.1)

Grails documentation mentions that "The Grails framework requires that runtime containers support Servlet 3.0 and above".
Note that Wildfly 26 supports Jakarta EE 8 which uses Servlet API 4.0 while Wildfly 27+ only supports Jakarta EE 10 which uses Servlet API 6.0.

Is there any way to make my Grails app compatible with either Jakarta EE 8 / Servlet API 4.0 or Jakarta EE 10 / Servlet API 6.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests