2011-10-25 17 views
0

私はJettyとSpringの技術を使い慣れていません。私は実際にトンをJetty 7にSpring 3.0.5を統合しようとしていますが、すべてのエラーメッセージが表示されています。Jetty 7 Spring 3.0.5 integration

私の設定はMac OS X Lion、Eclipse Indigo、Jetty 7、Spring 3.0.5です。

誰かがSpringフレームワークに埋め込まれたjettyでEclipseを使用しましたか? I

 2011-10-24 21:47:28.060:INFO:oejs.Server:jetty-7.5.2.v20111006 
    2011-10-24 21:47:29.094:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for /, 
    did not find org.apache.jasper.servlet.JspServlet 
    2011-10-24 21:47:29.146:WARN:oejw.WebAppContext:Failed startup of context 
    o.e.j.w.WebAppContext{/,file:/Users/benjamin/Documents/workspace/jettyserver/WebContent/} 
    java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 

jettyserver.java

public static void main(String[] args) { 

     Server server = new Server(8080); 

     WebAppContext context = new WebAppContext(); 
     context.setResourceBase("../jettyserver/WebContent"); 
     context.setDescriptor("../jettyserver/WebContent/WEB-INF/web.xml"); 
     context.setContextPath("/"); 
     context.setParentLoaderPriority(true); 

     HandlerList handlers = new HandlerList(); 
     handlers.setHandlers(new Handler[]{ context, new DefaultHandler()}); 

     server.setHandler(handlers); 
     //server.setHandler(context); 
     try { 
      server.start(); 
      server.join(); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 
} 

web.xml

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

    <display-name>Spring3MVC</display-name> 

    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 

    <context-param> 
    <param-name>contextConfigLocation</param-name> 
     <param-value>WEB-INF/spring-servlet.xml</param-value> 
    </context-param> 

    <listener> 
    <listener-class> 
     org.springframework.web.context.ContextLoaderListener 
    </listener-class> 
    </listener> 

    <servlet> 
     <servlet-name>spring</servlet-name> 
     <servlet-class> 
      org.springframework.web.servlet.DispatcherServlet 
     </servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>spring</servlet-name> 
     <url-pattern>*.html</url-pattern> 
    </servlet-mapping> 

    </web-app> 

spring-servlet.xml

  <?xml version="1.0" encoding="UTF-8"?> 
     <beans xmlns="http://www.springframework.org/schema/beans" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:p="http://www.springframework.org/schema/p" 
      xmlns:context="http://www.springframework.org/schema/context" 
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
      http://www.springframework.org/schema/context 
      http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

    <context:annotation-config /> 
     <context:component-scan base-package="com.jetty.controller" /> 

     <bean id="viewResolver" 
      class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
     <property name="viewClass" 
      value="org.springframework.web.servlet.view.JstlView" /> 
     <property name="prefix" value="/WEB-INF/jsp/" /> 
     <property name="suffix" value=".jsp" /> 
     </bean> 

OK最後に私は桟橋7を走らせることができますが、私がテープのときは何も起こりません サファリでこのURL localhost:8080/hello。/helloのコントローラに@RequestMappingを追加しました。ここに私のメイン

そのような春は私のコントローラをマッピングしていません。私は何か悪いことをしましたか?

+0

ようこそスタックオーバーフロー!質問に追加情報を追加する場合は、質問の編集(質問の下にある[編集]リンクをクリック)してください。受け取った回答にコメントするには、回答の下にあるコメント機能を使用します。コメントスペースが不足していると思われる場合は、おそらく編集する必要があります。回答はちょうどあなたの質問への直接の回答でなければなりません。 –

答えて

0

はここで基本的に同じことを言って、いくつかの答えです:

をI 午前あなたが検索方法を少し好奇心。私がしたのは、 "jetty"と "No JSP support"という文字列の検索でした。

+0

まあ、私は桟橋+春や桟橋の春のインテリアなどを探していた...私はすべてをチェックしたが、ほとんどは働いていなかった。それらのリンクをできるだけ早くチェックしてください。 –

+0

@ benjamin1111いつもエラーメッセージ/例外テキストを検索することから始めるのが最善です - 時には役に立たないこともありますが、それは一般的には良い場所です:) –

+0

私は検索しましたが解決することができました。私はそのことがJetty 7の新機能であると思っています。私が見つけた情報の多くは、Jetty 6またはSpring 2.5 wasvforでした。 –

関連する問題