2016-03-24 13 views
1

Google App Engine for Javaからの "Hello World"チュートリアルを試しています。IntellijのGoogle App Engineアプリのデバッグ

mvn appengine:devserver 

を私のブラウザでは、私はちょうど起動します:

http://localhost:8080 

しかし、私はデバッグを実行したときのIntelliJで、ブラウザがページに過ぎず開きを私は実行することによって、私のブラウザでアプリケーションを実行するとすべてが正常に動作します表示できません(エラー403)。

この問題は、プロジェクトがIntellijで設定されている方法と関係があります。私がそれを入力するときに使用しているものをアプリケーションサーバーのMavenコマンドと私はのIntelliJからそれを実行するときに使用される1私には明確ではありません

Debug settings

:私のデバッグ設定の添付のスクリーンショットを参照してください。 IntellijはJettyを使用しているように見えます。ここでのIntelliJでのApplication Serverの設定のスナップショットです:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
Copyright 2015 Google Inc. All Rights Reserved. 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
--> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <groupId>com.example.appengine</groupId> 
    <artifactId>appengine-helloworld</artifactId> 
    <!-- Parent POM defines ${appengine.sdk.version} (updates frequently). --> 
    <parent> 
     <groupId>com.google.cloud</groupId> 
     <artifactId>doc-samples</artifactId> 
     <version>1.0.0</version> 
     <relativePath>../..</relativePath> 
    </parent> 
    <dependencies> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>2.5</version> 
      <type>jar</type> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <build> 
     <!-- for hot reload of the web application --> 
     <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <version>3.3</version> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>com.google.appengine</groupId> 
       <artifactId>appengine-maven-plugin</artifactId> 
       <version>${appengine.sdk.version}</version> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

私はのIntelliJでデバッグを実行できるように、私はこの問題を解決するにはどうすればよい:

App Server Settings

ここでpom.xmlファイルですか?

答えて

3

あなたはMavenでdevサーバを実行しているので、リモートデバッグ設定を設定する必要があります。 ファイル名を指定して実行メニューの下

  • 編集設定を選択...
  • 選択リモートを新しい設定を追加する(左上)+アイコンをクリックします。

    :あなたは、あなたのpom.xml内のApp Engineプラグインのセクションは、同じポート番号を使用してこのセクションを持っていることを確認する必要がありますが、それはポート5005をリッスンしているが表示されます

Remote debug options for App Engine

にこれらのオプションが表示されます

<plugin> 
    <groupId>com.google.appengine</groupId> 
    <artifactId>appengine-maven-plugin</artifactId> 
    <version>${appengine.sdk.version}</version> 
    <configuration> 
     <-- other config stuff here --> 
     <jvmFlags> 
      <jvmFlag>-Xdebug</jvmFlag> 
      <jvmFlag>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmFlag> 
     </jvmFlags> 
    </configuration> 
</plugin> 

通常のように(ポート8080やpomで設定したものどもで)devサーバを起動しますが、コードにブレークポイントを設定して、そのコードをトリガすることができますあなたのブラウザでは、デバッガをステップバイステップで実行することができます。

+0

デバッグを実行すると、次のようなエラーが表示されます。デバッグローカルアプリケーションエンジンを実行中にエラーが発生しました:デバッガポート(localhost:5005)を開くことができません:java.net.ConnectException "接続が拒否されました"許可の何らかの種類ですか?私はこれをMac上で実行しています。 – AndroidDev

+0

ブロックする可能性があるファイアウォールはありますか?あなたのmvnの出力は、 '' dt_socket at address:5005'のようなものを表示していますか? – tx802

+0

mvn appengine:devserverコマンドが機能するので、ファイアウォールがそれをブロックしているとは思わない。しかし、ポート5005がブロックされているかどうかはわかりません。私はIDEでこれを実行しているので、Mavenの出力は表示されません。 – AndroidDev

関連する問題