Wildfly war deployment fails

1,430 views
Skip to first unread message

Thomas Schwade

unread,
Apr 3, 2023, 5:41:16 AM4/3/23
to WildFly
Hello -

I hope someone with more experience with Wildfly 27 has an idea: The most simple war file (https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/) fails to deploy in Wildfly 27 with the error

WFLYSRV0021: Deploy of deployment "sample.war" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"sample.war\".undertow-deployment.UndertowDeploymentInfoService" => "Failed to start service
    Caused by: java.lang.NoClassDefFoundError: Failed to link mypackage/Hello (Module \"deployment.sample.war\" from Service Module Loader): javax/servlet/http/HttpServlet"}}

even though the class is definitely available in the package. It seems I am missing something very basic.

Thanks for any hint,
Thomas

Jean Francois Denise

unread,
Apr 3, 2023, 5:49:58 AM4/3/23
to wil...@googlegroups.com

Hi,

WildFly 27 supports Jakarta EE 10 version. You are using javax.servlet although you should use jakarta.servlet.

JF

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/cdc9780d-6338-4969-89d6-0107706d300dn%40googlegroups.com.

Thomas Schwade

unread,
Apr 3, 2023, 6:45:04 AM4/3/23
to WildFly
Thanks  for the hint. I changed the web.xml accordingy:

<web-app
        xmlns = "https://jakarta.ee/xml/ns/jakartaee"
        xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation = "https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
        version = "5.0"
        metadata-complete = "false"
>

but still receive the same error. Is there some special configuration required for the class loader? The documentation says that all classes in a war file should be loaded without any  special dependency configuration.

Kind regards, Thomas

Jean Francois Denise

unread,
Apr 3, 2023, 7:36:21 AM4/3/23
to wil...@googlegroups.com

Hi,

you need to change the java import in the Hello class. You could have a look to the WildFly quickstart: https://github.com/wildfly/quickstart/tree/27.0.1.Final/helloworld

JF

Thomas Schwade

unread,
Apr 3, 2023, 8:52:37 AM4/3/23
to WildFly
Thanks a lot. I did not realize that even the application code has to be rewritten, if an application is intended to run both in Tomcat and in Wildfly. In former times it was sufficient to add a platform dependent deployment descriptor...

Paul Ferraro

unread,
Apr 3, 2023, 11:33:20 AM4/3/23
to WildFly
This code change issue not unique to WildFly.  Applications migrating from Tomcat 9 -> Tomcat 10 require the same code changes.
This was due to a trademark dispute over the javax package namespace, see: https://eclipse-foundation.blog/2019/05/03/jakarta-ee-java-trademarks/
Reply all
Reply to author
Forward
0 new messages