Search code examples
javatomcatgrailsjbosswildfly

Wildfly Jboss NoClassDefFoundError: Failed to link Error for org/jboss/ws/core/jaxws/spi/ProviderImpl


Currently working on deployeing a web application(with Grails) on wildlfy 17. The WAR gets deployed but when i run a specific action at runtime,

I am getting the following error(stacktrace minified):

WARN  [org.jboss.modules.define] (default task-18) Failed to define class org.jboss.ws.core.jaxws.spi.ProviderImpl in Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\Programs\Wildfly\modules,C:\Programs\Wildfly\modules\system\layers\base)): java.lang.NoClassDefFoundError: Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\IDeaS\CMA\G302\Programs\Wildfly\modules,C:\Programs\Wildfly\modules\system\layers\base))): javax/xml/ws/spi/Provider

ERROR [StackTrace] (default task-18) Full Stack Trace:: javax.xml.ws.WebServiceException: Error while searching for service [javax.xml.ws.spi.Provider]

Caused by: java.lang.NoClassDefFoundError: Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\Programs\Wildfly\modules,C:\\Programs\Wildfly\modules\system\layers\base))): javax/xml/ws/spi/Provider

ERROR [StackTrace] (default task-18) Full Stack Trace:: java.lang.NoClassDefFoundError: Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\Programs\Wildfly\modules,C:\Programs\Wildfly\modules\system\layers\base))): javax/xml/ws/spi/Provider

ERROR [StackTrace] (default task-18) Full Stack Trace:: javax.xml.ws.WebServiceException: Error while searching for service [javax.xml.ws.spi.Provider]

Caused by: java.lang.NoClassDefFoundError: Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\Programs\Wildfly\modules,C:\Programs\Wildfly\modules\system\layers\base))): javax/xml/ws/spi/Provider

ERROR [org.grails.web.errors.GrailsExceptionResolver] (default task-18) NoClassDefFoundError occurred when processing request: [POST] /cma/Sql/runQuery
Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\Programs\Wildfly\modules,C:\Programs\Wildfly\modules\system\layers\base))): javax/xml/ws/spi/Provider. Stacktrace follows:: javax.xml.ws.WebServiceException: Error while searching for service [javax.xml.ws.spi.Provider]

Caused by: java.lang.NoClassDefFoundError: Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader @68b6f0d6 (finder: local module finder @4044fb95 (roots: C:\Programs\Wildfly\modules,C:\Programs\Wildfly\modules\system\layers\base))): javax/xml/ws/spi/Provider

I have added Jars to my projects which contain this classes, I have checked and these classes exists in the WAR file that is produced. Also, these are not there in Wildlfy's modules folder

I have created jboss-deployment-structure.xml:

<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclusions>
            <module name="org.quartz" />
            <module name="org.jboss.ws.core" />
        </exclusions>
        <resources>
            <resource-root path="jbossws-client.jar" />
        </resources>
        <dependencies>
            <module name="org.jboss.ws.core" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Here I have tried exclusion, resources and dependencies each one separately but just combined here for simplicity. But none of them seems to work for me.

Adding <module name="org.quartz" /> solved my quartz-scheduling problem but does not seem to work for this one.


Solution

  • What happened was that a module named com.project already exists in wildlfy.

    This is what the error meant by-

    Failed to link org/jboss/ws/core/jaxws/spi/ProviderImpl (Module "com.project" from local module loader
    

    It means "com.project" (which was in wildlfy and in the WAR too) has this class and this results in both the jars being loaded and two same classes resulting in NoClassDefFoundError

    By adding I was able to make it work. Now it is possible to just remove to module from wildlfy as its user added but in my case this module is required by other wars. So it needs to be excluded at the required war where its creating this error.