java.lang.NoSuchMethodError:com.opensymphony.xwork2.util.finder.UrlSet.includeClassesUrl

时间:2014-01-08 07:10:41

标签: java tomcat struts2

我在使用tomcat 7进行部署时遇到异常。我正在使用netbeans7.4进行开发。 我已经包含了struts2.3.15 jar文件和hibernet jar文件。

SEVERE: Exception starting filter struts2
    java.lang.NoSuchMethodError: com.opensymphony.xwork2.util.finder.UrlSet.includeClassesUrl(Lcom/opensymphony/xwork2/util/finder/ClassLoaderInterface;Lcom/opensymphony/xwork2/util/finder/UrlSet$FileProtocolNormalizer;)Lcom/opensymphony/xwork2/util/finder/UrlSet;
        at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildUrlSet(PackageBasedActionConfigBuilder.java:442)
        at org.apache.struts2.convention.PackageBasedActionConfigBuilder.readUrls(PackageBasedActionConfigBuilder.java:410)
        at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:389)
        at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:347)
        at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
        at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
        at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)

如何解决此问题。

2 个答案:

答案 0 :(得分:0)

java.lang.NoSuchMethodError:

如果应用程序试图调用类的指定方法(静态或实例),并且该类不再具有该方法的定义,则抛出错误。

通常,编译器会捕获此错误;如果类的定义发生不兼容的更改,则此错误只能在运行时发生。

尝试download最新版本的jar文件

答案 1 :(得分:0)

当包含的jar中的方法存在冲突时,通常会抛出

NoSuchMethodError:,或者可能是由于包含的依赖jar的不同版本。尝试删除不必要的罐子,如果仍然没有解决问题,请检查包含的罐子的版本