java.lang.NoSuchMethodError:从jetty 7升级到jetty 9时的javax.servlet.ServletContext.getServletRegistration

时间:2015-11-27 16:28:28

标签: jetty-9

我正在升级jetty 7和jetty 9并在我尝试启动我的应用程序时遇到异常,该应用程序在jetty 7上完美运行。我确保servlet-api-3.1.jar在classpath和我的web中。 xml符合servlet 3.0。

2015-11-27 10:59:08.317:INFO:oejs.Server:main: jetty-9.1.5.v20140505
2015-11-27 10:59:08.344:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/opt/muni/AlaBAMa/muMCVClient/1470003/jetty/webapps/] at interval 1
2015-11-27 10:59:13.952:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.annotations.ServletContainerInitializersStarter@704d6e83: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration;
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration;
        at org.apache.jasper.runtime.TldScanner.onStartup(TldScanner.java:231)
        at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:141)
        at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:69)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:276)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1359)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1352)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.addBean(ContainerLifeCycle.java:289)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.addBean(ContainerLifeCycle.java:221)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.updateBeans(ContainerLifeCycle.java:771)
        at org.eclipse.jetty.server.handler.HandlerCollection.setHandlers(HandlerCollection.java:89)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.setHandlers(ContextHandlerCollection.java:144)
        at org.eclipse.jetty.server.handler.HandlerCollection.addHandler(HandlerCollection.java:155)
        at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:41)
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186)
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:498)
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:146)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
        at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:605)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:528)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:391)
        at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:560)
        at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:235)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
        at org.eclipse.jetty.server.Server.start(Server.java:358)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
        at org.eclipse.jetty.server.Server.doStart(Server.java:325)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1250)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:297)
        at org.eclipse.jetty.start.Main.start(Main.java:727)
        at org.eclipse.jetty.start.Main.main(Main.java:103)

web.xml如下

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app 
xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee        http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
       version="3.0">

     <!-- Servlets -->

     <!-- Default page to serve -->
     <welcome-file-list>
       <welcome-file>CVSizeHack.html</welcome-file>
       <welcome-file>MuMCVClient.html</welcome-file>
     </welcome-file-list>
     <servlet>
        <servlet-name>MCVDataService</servlet-name>
   <servlet-  class>com.citi.muni.citivelocity.server.MCVDataServiceImpl</servlet-class>
        <load-on-startup /> 
            </servlet>
            <servlet-mapping>
                <servlet-name>MCVDataService</servlet-name>
                <url-pattern>/mumcvclient/MCVDataService</url-pattern>
            </servlet-mapping>

            <servlet>
        <servlet-name>MCVCalculatorService</servlet-name>
        <servlet-       class>com.citi.muni.citivelocity.server.MCVCalculatorServiceImpl</servlet-class>
     </servlet>
     <servlet-mapping>
        <servlet-name>MCVCalculatorService</servlet-name>
        <url-pattern>/mumcvclient/MCVCalculatorService</url-pattern>
     </servlet-mapping>

     <servlet>
        <servlet-name>MCVExcelExport</servlet-name>
        <servlet-class>com.citi.muni.citivelocity.server.ExportToExcelServlet</servlet-class>
        <load-on-startup /> 
     </servlet>
     <servlet-mapping>
        <servlet-name>MCVExcelExport</servlet-name>
        <url-pattern>/mumcvclient/MCVExcelExport</url-pattern>
     </servlet-mapping>

   </web-app>

我被困在这上面了。任何帮助将不胜感激。

0 个答案:

没有答案