java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet

编程入门 行业动态 更新时间:2024-10-25 20:24:45
本文介绍了java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在将我的 Web 应用程序从 Jboss 4.2 迁移到 tomcat 7.
使用 tomcat 7 后,我面临以下异常.

I am migrating my web application from Jboss 4.2 to tomcat 7 .
After using the tomcat 7 i am facing the following exception.

java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
    at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:855)
    at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1051)
    at com.sun.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
    at com.sun.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
    at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1883)
    at org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment(ContextConfig.java:1469)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1246)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

我尝试从库中删除 catalina.jar(根据针对相同异常给出的解决方案)以解决该问题,但没有奏效.

我没有办法解决这个问题,任何人都可以帮助解决这个问题.

I have tried to remove the catalina.jar (according to the solution given for the same exception)from the lib to solve the issue but it didn't worked.

I am not getting any way to solve this issue can anyone please help on this issue.

推荐答案

在你的 pom.xml如果你已经包含了像 tomcat-catalina 这样的依赖项,按照提供的范围放置

In your pom.xml if you have included dependencies like tomcat-catalina, put the scope as provided

<dependency>
  <groupId>org.apache.tomcat</groupId>
  <artifactId>tomcat-catalina</artifactId>
  <version>7.0.47</version>
  <scope>provided</scope>
</dependency>

当您部署应用程序时,容器(此处为 tomcat)本身会提供一些依赖项(如 tomcat-catalina jar).因此,您无需将它们包含在您的应用程序中.但是编译需要jars.这是通过将范围设置为提供"来实现的

The container ( here tomcat ) itself provides some dependencies ( like tomcat-catalina jar ) when you deploy your app. So you don't need to include them in your application. But the jars are needed for compilation. This is achieved by setting the scope as 'provided'

这篇关于java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 03:31:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1389274.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NoSuchMethodException   org   java   lang   apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!