grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.79k stars 948 forks source link

Grails 5 - Unable to deploy on Wildfly 26.1.2 #12743

Closed jarantes17 closed 7 months ago

jarantes17 commented 2 years ago

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: https://github.com/micronaut-projects/micronaut-core/issues/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

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

Environment Information

Example Application

No response

Version

5.2.4

gabrielpadilh4 commented 2 years ago

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 commented 2 years ago

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

jarantes17 commented 1 year ago

@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.

tpraj24 commented 1 year ago

@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 commented 1 year ago

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

tpraj24 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

jarantes17 commented 1 year ago

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

lucas-napse commented 1 year ago

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

ziceck commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 7 months ago

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 commented 7 months ago

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 commented 6 months ago

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?

djvasquezce commented 6 months ago

did you find any solution to deploy grails 5+ on wildfly 31? i have tried to deploy a "hellow world" grails 5.3.6 project on wildfly 31 but i get "403 forbidden".