使用gradle的NoClassDefFound异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用gradle的NoClassDefFound异常相关的知识,希望对你有一定的参考价值。

我正在尝试为我的项目导入一些gradle依赖项。但是,特定包正在生成NoClassDefFound异常。如果我理解正确,会发生这种情况,因为在编译时发现了包,但在运行时却没有。我在下面包含了我的gradle构建以及生成的错误。我试图手动将所需的jar添加到WAR lib文件中,但没有成功。

我已经尝试手动将所需的jar添加到WAR lib文件中,但没有成功。

repositories {
     mavenCentral()
}

dependencies {
    providedCompile group: 'javax.faces', name: 'javax.faces-api', version: '2.2'
    runtime group: 'org.glassfish', name: 'javax.faces', version: '2.2.18'
    runtime group: 'com.liferay.faces', name: 'com.liferay.faces.bridge.ext', version: '5.0.3'
    runtime group: 'com.liferay.faces', name: 'com.liferay.faces.bridge.impl', version: '4.1.2'

    compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
    compileOnly group: 'com.sun.syndication', name: 'com.springsource.com.sun.syndication', version: '1.0.0'
    compileOnly group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
    compileOnly group: 'org.springframework.security', name: 'spring-security-cas-client', version: '3.0.8.RELEASE'
    compileOnly group: 'javax.el', name: 'javax.el-api', version: '3.0.1-b06'
    compileOnly group: 'javax', name: 'javaee-api', version: '8.0.1'

    compile group: 'log4j', name: 'log4j', version: '1.2.14'
    compile group: 'org.richfaces', name: 'richfaces', version: '4.5.17.Final'
    compile group: 'org.springframework', name: 'spring-tx', version: '5.1.6.RELEASE'
    compile group: 'org.springframework.security', name: 'spring-security-core', version: '5.1.5.RELEASE'
    compile group: 'org.springframework.security', name: 'spring-security-web', version: '5.1.5.RELEASE'
    compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.3.5.RELEASE'
    compile group: 'org.springframework', name: 'org.springframework.web.servlet', version: '3.2.2.RELEASE'
    compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
    compile group: 'org.springframework', name: 'spring-test', version: '4.0.5.RELEASE'
    compile group: 'org.testng', name: 'testng', version: '6.14.3'
    compile group: 'javax.persistence', name: 'javax.persistence-api', version: '2.2'
    compile group: 'org.hibernate', name: 'hibernate-core', version: '4.0.0.CR1'
    compile group: 'javax.xml.parsers', name: 'jaxp-api', version: '1.4.5'
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1'
    compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.1'
    compile group: 'xerces', name: 'xercesImpl', version: '2.12.0'              
}

Catastrophic initialization failure! Shutting down portlet WAB due to: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl 
java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
    at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter._initializeContext(ServletContextListenerExceptionAdapter.java:119)
    at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter.contextInitialized(ServletContextListenerExceptionAdapter.java:99)
    at jdk.internal.reflect.GeneratedMethodAccessor465.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.equinox.http.servlet.internal.registration.ListenerRegistration$EventListenerInvocationHandler.invoke(ListenerRegistration.java:145)
    at com.sun.proxy.$Proxy688.contextInitialized(Unknown Source)
    at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddListenerRegistration(ContextController.java:350)
    at org.eclipse.equinox.http.servlet.internal.context.ContextController.addListenerRegistration(ContextController.java:303)
    at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:67)
    at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:1)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
    at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:891)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:487)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1004)
    at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initListeners(WabBundleProcessor.java:571)
    at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:217)
    at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:186)
    at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
    at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:175)
    at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
    at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
    at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
    at org.eclipse.osgi.container.Module.start(Module.java:467)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
    at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:777)
    at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:768)
    at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:538)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:484)
    at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1028)
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1409)
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:295)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:294)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:293)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:146)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1169)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:147)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:288)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:277)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:400)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
    at javax.xml.bind.JAXB$Cache.<init>(JAXB.java:127)
    at javax.xml.bind.JAXB.getContext(JAXB.java:154)
    at javax.xml.bind.JAXB.unmarshal(JAXB.java:183)
    at org.richfaces.javascript.ClientServiceConfigParser.parse(ClientServiceConfigParser.java:81)
    at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:70)
    at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:65)
    at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:60)
    at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:60)
    at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:110)
    at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:69)
    at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:167)
    at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
    at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
    at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:301)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:739)
    at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:704)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:270)
    ... 54 more
2019-04-16 12:20:16.699 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:261] Processing portlet.war
2019-04-16 12:20:27.087 INFO  [fileinstall-C:/Users/Argiris/Desktop/Liferay7.1/liferay-ce-portal-7.1.2-ga3/osgi/war][BundleStartStopLogger:42] STOPPED portlet_1.0.0 [1012]
2019-04-16 12:20:29.899 INFO  [fileinstall-C:/Users/Argiris/Desktop/Liferay7.1/liferay-ce-portal-7.1.2-ga3/osgi/war][BaseAutoDeployListener:43] Copying portlets for C:UsersArgirisDesktopLiferay7.1liferay-ce-portal-7.1.2-ga3	omcat-9.0.10	emp20190416122027087VBYVASCOportlet.war
2019-04-16 12:20:32.023 INFO  [fileinstall-C:/Users/Argiris/Desktop/Liferay7.1/liferay-ce-portal-7.1.2-ga3/osgi/war][BaseDeployer:877] Deploying portlet.war
2019-04-16 12:21:04.566 INFO  [fileinstall-C:/Users/Argiris/Desktop/Liferay7.1/liferay-ce-portal-7.1.2-ga3/osgi/war][BaseAutoDeployListener:50] Portlets for C:UsersArgirisDesktopLiferay7.1liferay-ce-portal-7.1.2-ga3	omcat-9.0.10	emp20190416122027087VBYVASCOportlet.war copied successfully
2019-04-16 12:21:29.627 INFO  [Refresh Thread: Equinox Container: 4507fbcc-c97b-4c9a-83d0-cc94415a5052][BundleStartStopLogger:39] STARTED portlet_1.0.0 [1012]
2019-04-16 12:22:06.848 ERROR [Refresh Thread: Equinox Container: 4507fbcc-c97b-4c9a-83d0-cc94415a5052][com_liferay_portal_osgi_web_wab_extender:97] Catastrophic initialization failure! Shutting down portlet WAB due to: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl 
java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
    at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter._initializeContext(ServletContextListenerExceptionAdapter.java:119)
    at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter.contextInitialized(ServletContextListenerExceptionAdapter.java:99)
    at jdk.internal.reflect.GeneratedMethodAccessor465.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.equinox.http.servlet.internal.registration.ListenerRegistration$EventListenerInvocationHandler.invoke(ListenerRegistration.java:145)
    at com.sun.proxy.$Proxy688.contextInitialized(Unknown Source)
    at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddListenerRegistration(ContextController.java:350)
    at org.eclipse.equinox.http.servlet.internal.context.ContextController.addListenerRegistration(ContextController.java:303)
    at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:67)
    at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:1)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
    at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:891)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:487)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1004)
    at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initListeners(WabBundleProcessor.java:571)
    at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:217)
    at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:186)
    at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
    at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:175)
    at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
    at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
    at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
    at org.eclipse.osgi.container.Module.start(Module.java:467)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
    at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:777)
    at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:768)
    at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:538)
    at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:484)
    at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1028)
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1409)
    at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:295)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:294)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:293)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:146)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1169)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:147)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
    at javax.xml.bind.JAXB$Cache.<init>(JAXB.java:87)
    at javax.xml.bind.JAXB.getContext(JAXB.java:114)
    at javax.xml.bind.JAXB.unmarshal(JAXB.java:143)
    at org.richfaces.javascript.ClientServiceConfigParser.parse(ClientServiceConfigParser.java:81)
    at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:70)
    at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:65)
    at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:60)
    at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:60)
    at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:110)
    at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:69)
    at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:167)
    at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
    at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
    at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:301)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:739)
    at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:704)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:270)
    ... 54 more
答案

NoClassDefFoundError: Could not initialize class com.sun.xml.bind.DatatypeConverterImpl表示DatatypeConverterImpl无法加载。此类存在于Java 8中,在Java 9中已弃用,在Java 11中不再可用。

根据this answer,您希望将JAXB依赖项更新为2.3.0或更高版本。您目前正在使用2.1,它于2008年发布,不适合使用模块化JVM(Java 9中的Jigsaw后)。

以上是关于使用gradle的NoClassDefFound异常的主要内容,如果未能解决你的问题,请参考以下文章

在 android 2.3 上使用 jcifs 库时出现 NoClassDefFound 异常

Android 错误:使用 android-json-rpc 时出现 NoClassDefFound 错误

XStream noClassDefFound 错误取决于运行时

UCanAccess 出现 ClassNotFoundException 和 NoClassDefFound 错误

当我尝试保存测试计划时,为啥会收到 NoClassDefFound 错误?

Android 应用程序在 SDK-tools 更新版本后崩溃(NoClassDefFound,工具版本 22)