2016-04-25 12 views
0

jettyサーバーとサーブレットをバージョン9.2.2からバージョン9.3.8に更新しようとしています pom.xmlファイルの更新後にServletContextHandlerとServletHolderのようなエラーが発生しました見つかりません !jettyサーブレットの更新9.2.2から9.3.8

は、ここに私のpom.xml

<dependency> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-server</artifactId> 
      <version>9.3.8.v20160314</version> 
    </dependency> 

    <dependency> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-servlets</artifactId> 
     <version>9.3.8.v20160314</version> 
    </dependency> 

であり、これはあなたがあなたの依存関係にタイプミスがあり、私のJettyServerクラス

public static void start() throws Exception 
{ 
    Server server = new Server(Configuration.getInstance().getPortServer()); 

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); 
    context.setContextPath("/"); 

    ServletHolder h = new ServletHolder(new HttpServletDispatcher()); 
    h.setInitParameter("javax.ws.rs.Application", "de.jettyserver.Services"); 
    context.addServlet(h, "/*"); 

    server.setHandler(context); 

    server.start(); 
    server.join(); 

    LOGGER.debug("JettyServer started"); 
} 

とエラー

[ERROR] /C:/..../jettyserver/JettyServer.java:[4,33] package org.eclipse.jetty.servlet does not exist 

[ERROR]/C:/../jettyserver/JettyServer.java:[5,33] package org.eclipse.jetty.servlet does not exist 
[ERROR] /C:/../jettyserver/JettyServer.java:[27,17] cannot find symbol symbol: class ServletContextHandler location: class de.tuberlin.snet.sonic.jettyserver.JettyServer 

    [ERROR] /C:/../jettyserver/JettyServer.java:[27,53] cannot find symbol symbol: class ServletContextHandler location: class de.tuberlin.snet.sonic.jettyserver.JettyServer 
[ERROR] /C:/../jettyserver/JettyServer.java:[27,75] cannot find symbol symbol: variable ServletContextHandler location: class de.tuberlin.snet.sonic.jettyserver.JettyServer 

答えて

1

です。

<dependency> 
    <groupId>org.eclipse.jetty</groupId> 
    <artifactId>jetty-servlet</artifactId> <!-- not plural! --> 
    <version>9.3.8.v20160314</version> 
</dependency> 
+0

ありがとう。実際に私は桟橋のウェブサイトからコピーします http://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets/9.3.8.v20160314 – SenanSharhan

+0

これは桟橋のウェブサイトではありません。 eclipse jettyプロジェクトでは、mvnrepository.com上で[search.maven.org](https://search.maven.org/)を使用することを推奨しています(これはひどく不正確です) –

+0

oh ok!私がgoogleするとき、最初のウェブサイトはmvnrepository.comでした。情報ありがとうございました – SenanSharhan

関連する問題