首页

抛出java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference异常

标签:异常,NoClassDefFoundError,jaxws-api,依赖包,Exception,error,报错,异常日志,EndpointReference     发布时间:2015-09-12   

一、异常现象

[MDS] 22:45:56,534 ERROR org.springframework.web.context.ContextLoader,324 - Context initialization failed@b@java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference@b@    at java.lang.Class.getDeclaredMethods0(Native Method)@b@    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)@b@    at java.lang.Class.getDeclaredMethods(Class.java:1791)@b@    at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:161)@b@    at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)@b@    at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:88)@b@    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)@b@    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)@b@    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)@b@    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)@b@    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)@b@    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)@b@    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)@b@    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)@b@    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)@b@    at org.apache.catalina.startup.Embedded.start(Embedded.java:825)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)@b@    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)@b@    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)@b@    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)@b@    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)@b@    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)@b@    at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)@b@    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)@b@    at java.lang.reflect.Method.invoke(Method.java:597)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)@b@2015-9-12 22:45:56 org.apache.catalina.core.StandardContext listenerStart@b@严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener@b@java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference@b@    at java.lang.Class.getDeclaredMethods0(Native Method)@b@    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)@b@    at java.lang.Class.getDeclaredMethods(Class.java:1791)@b@    at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:161)@b@    at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)@b@    at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:88)@b@    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)@b@    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)@b@    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)@b@    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)@b@    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)@b@    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)@b@    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)@b@    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)@b@    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)@b@    at org.apache.catalina.startup.Embedded.start(Embedded.java:825)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)@b@    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)@b@    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)@b@    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)@b@    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)@b@    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)@b@    at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)@b@    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)@b@    at java.lang.reflect.Method.invoke(Method.java:597)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)@b@2015-9-12 22:45:56 org.apache.catalina.core.StandardContext start@b@严重: Error listenerStart@b@2015-9-12 22:45:56 org.apache.catalina.core.StandardContext start@b@严重: Context [/mds] startup failed due to previous errors@b@2015-9-12 22:45:56 org.apache.catalina.core.ApplicationContext log@b@信息: Closing Spring root WebApplicationContext@b@[MDS] 22:45:56,596  WARN org.springframework.web.context.support.XmlWebApplicationContext,1052 - Exception thrown from ApplicationListener handling ContextClosedEvent@b@java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sat Sep 12 22:45:52 CST 2015]; root of context hierarchy@b@    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)@b@    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)@b@    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049)@b@    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)@b@    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)@b@    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)@b@    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4174)@b@    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4778)@b@    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4675)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)@b@    at org.apache.catalina.startup.Embedded.start(Embedded.java:825)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)@b@    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)@b@    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)@b@    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)@b@    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)@b@    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)@b@    at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)@b@    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)@b@    at java.lang.reflect.Method.invoke(Method.java:597)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)@b@[MDS] 22:45:56,596  WARN org.springframework.web.context.support.XmlWebApplicationContext,1060 - Exception thrown from LifecycleProcessor on context close@b@java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sat Sep 12 22:45:52 CST 2015]; root of context hierarchy@b@    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)@b@    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)@b@    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)@b@    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:559)@b@    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)@b@    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4174)@b@    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4778)@b@    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4675)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)@b@    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)@b@    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)@b@    at org.apache.catalina.startup.Embedded.start(Embedded.java:825)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)@b@    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)@b@    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)@b@    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)@b@    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)@b@    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)@b@    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)@b@    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)@b@    at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)@b@    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)@b@    at java.lang.reflect.Method.invoke(Method.java:597)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)@b@    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)@b@2015-9-12 22:45:56 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc@b@严重: The web application [/mds] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.@b@2015-9-12 22:45:56 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc@b@严重: The web application [/mds] registered the JBDC driver [org.firebirdsql.jdbc.FBDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

二、解决步骤

1. 很明显根据java.lang.NoClassDefFoundError可以判断确实依赖包,根据经验是jaxws-api包

2. 直接在项目引入该依赖包,这边引入的是2.1版本,具体如下所示(如是普通web项目直接将jar包copy到lib目录下)

 <dependency>@b@            <groupId>javax.xml.ws</groupId>@b@            <artifactId>jaxws-api</artifactId>@b@            <version>2.1</version>@b@</dependency>

抛出java.lang.NoClassDefFoundError: javax/xml/ws/EndpointReference异常

<<热门下载>>