2011-01-22 15 views
0

私は現在、私はGoogleのEclipseプラグインをインストールしたForce.com for Google App Engine for Java: Getting StartedJava/SalesForce/Google Appが表示されないのはなぜですか?

題しSalesForce.comのチュートリアルに取り組んでいますが、(チュートリアルページに見られるような)ライブラリをダウンロードし、「Hello Worldのアプリケーションを」入力された:

package com.force; 
import java.io.IOException; 
import java.io.PrintWriter; 

import javax.servlet.http.*; 
import java.util.logging.*; 

import com.sforce.ws.*; 
import com.sforce.soap.partner.*; 
import com.sforce.soap.partner.sobject.SObject; 


@SuppressWarnings("serial") 
public class HelloWorldServlet extends HttpServlet { 
    private static final Logger log = Logger.getLogger(HelloWorldServlet.class.getName()); 

    private String username = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
    private String password = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
    private PartnerConnection connection; 

    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { 
     resp.setContentType("text/html"); 
     resp.getWriter().println("Hello, world. this is a test2"); 

     PrintWriter t = resp.getWriter(); 
     getConnection(t, req); 
     if (connection == null) { return; } 

     QueryResult result = null; 

     try { 

      result = connection.query( "select id, name, phone from Account order by LastModifiedDate desc limit 10 "); 

     } catch (ConnectionException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     for (SObject account : result.getRecords()) { 
      t.println("<li>"+ (String)account.getField("Name") + "</li>"); 
     } 
    } 

    void getConnection(PrintWriter out, HttpServletRequest req) { 

     try { 
      // build up a ConnectorConfig from a sid 
      String sessionid = req.getParameter("sid"); 
      String serverurl = req.getParameter("srv"); 

      if (connection == null) { 

       out.println("<p>new connection needed</p>"); 
       // login to the Force.com Platform 
       ConnectorConfig config = new ConnectorConfig(); 
       if (sessionid != null && serverurl != null) { 
        config.setServiceEndpoint(serverurl); 
        config.setSessionId(sessionid); 
        config.setManualLogin(false); 
        out.println("using session from query string"); 
       } else { 
        config.setUsername(username); 
        config.setPassword(password); 
       } 
       connection = Connector.newConnection(config); 
       out.println(connection.getConfig().getSessionId()); 
       out.println(connection.getConfig().getServiceEndpoint()); 
      } else { 
       out.println("<p> reuse existing connection"); 
       out.println(connection.getConfig().getSessionId()); 
      } 
      log.warning("Connection SID " +connection.getConfig().getSessionId()); 

     } catch (ConnectionException ce) { 
      log.warning("ConnectionException " +ce.getMessage()); 

      out.println(ce.getMessage() + " s " + ce.getClass()); 

     } 

    } 
} 

「Webアプリケーションは、」私は、コンソールに次のように取得するように私は、アプリケーションを実行します。

Initializing AppEngine server 
Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger 
Successfully processed D:\education\java\HelloWorldOriginal\war\WEB-INF/appengine-web.xml 
Successfully processed D:\education\java\HelloWorldOriginal\war\WEB-INF/web.xml 
The server is running at http://localhost:8888/ 
Warning: default mime table not found: C:\devtool\Java\jre6\lib\content-types.properties 

私はhttp://localhost:8080/を訪問しようとすると、私は以下を参照してください。

Oops! Google Chrome could not connect to localhost:8080 
Did you mean: localhost-­8080.­com 
Additional suggestions: 
Try reloading: localhost:­8080 
Search on Google: 

Google Chrome Help - Why am I seeing this page? 
©2011 Google - Google Home 

しかし、私はhttp://localhost:8888/を訪問したときに、私が取得:

Web Application Starter Project 

Please enter your name: 
    Send 

(。どちらが、また希望や期待結果ではありません)これは私というcontent-type.propertiesは何

行方不明で、どうすれば修正できますか?それともそれはより大きな問題の徴候ですか?

答えて

1

あなたのweb.xmlが/の要求を適切なハンドラクラスに指示していることを確認しましたか?クラスを書くだけでは不十分です。着信要求がそのクラスに送信されるようにする必要があります。

+0

私は、以前のダイナミックWebアプリケーションの場合、それをやっていることを漠然として思い出しましたが、新しいアプリケーションでは注釈のためにこれが必要ないことを発見しました。これはあなたに戻ってきます。 :-) –

+0

他にもいくつかのエラーが出ていますが、後でそれらを並べ替えます。私が尋ねたものを修正するための乾杯。 :-) –

関連する問題