34

tomcat-maven-plugin の mvn tomcat:deploy を使用すると、403 エラーが発生します。

プロジェクト my-webapp で目標 org.codehaus.mojo:tomcat-maven-plugin:1.0:deploy (default-cli) を実行できませんでした: Tomcat マネージャーを呼び出せません: サーバーが HTTP 応答コードを返しました: URL の 403:http://localhost:8080/manager/text/deploy?path=%2Fdms&war=

戦争パラメータがnullのせいだと思います。しかし、なぜnullなのですか?

pom.xml には次のものがあります。

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>

  <configuration>
    <warFile>target\my-webapp.war</warFile>
    <server>myserver</server>
    <url>http://localhost:8080/manager/text</url>
    <path>/dms</path>
  </configuration>
</plugin>
4

21 に答える 21

45

/text を使用する必要があります:

http://localhost:8080/manager/text

また、ユーザーロール manager-script に追加します

于 2012-06-10T22:05:47.230 に答える
27

Tomcat 7 を使用している場合は、次のようにプラグイン構成を pom.xml に残す必要があります。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
        <url>http://localhost:8080/manager/html</url>
        <server>tomcat</server>
        <path>/finance</path>
    </configuration>
</plugin>

上記の例のようにバージョン構成を試してみましたが、うまくいきませんでした。settings.xml には、pom.xml の値と一致するサーバーの構成が必要です。

<settings>
    <servers>
        <server>
            <id>tomcat</id>
            <username>admin</username>
            <password>admin</password>
        </server>
    </servers>
</settings>

したがって、mvn tomcat:deploy または mvn tomcat:redeploy (既にアプリをデプロイしている場合)、または mvn tomcat:run (Tomcat がダウンしている場合) が機能するはずです。

于 2011-08-29T03:42:08.517 に答える
14

アプリケーションは、/managerデフォルトでユーザー名/パスワードによって保護されています。http://localhost:8080/managerと入力すると、セキュリティ資格情報も提供するよう求められます。最初に Tomcat でユーザーを作成/有効化します。キャンセルするか、数回失敗した後、Tomcat はエラー画面でヘルプを表示します。次に、ここtomcat-maven-pluginで説明されているように、これらの資格情報を使用します。

プラグイン構成ブロックを pom.xml に追加します。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
            <server>myserver</server>
    </configuration>
</plugin>

対応するサーバー ブロックを settings.xml に追加します。

<server>
    <id>myserver</id>
    <username>myusername</username>
    <password>mypassword</password>
</server>
于 2011-03-23T19:31:41.937 に答える
8

「/html」を追加してURLを変更するだけで、http://localhost:8080/manager/htmlのようになり、ビンゴが機能します

于 2012-01-25T09:59:44.610 に答える
8

Tomcat7 の場合、tomcat-users.xml に rolename manager-scriptも必要です。

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="s3cret" roles="manager-script,manager-gui"/>

そしてプロジェクトのPOM.xmlで

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>tomcat-maven-plugin</artifactId>
   <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>myserver</server>
        <path>/sw</path>
   </configuration>
</plugin>

およびmavenのsettings.xml:

<servers>
 <server>
  <id>myserver</id>
  <username>tomcat</username>
  <password>s3cret</password>
 </server>
</servers>
于 2013-04-08T10:44:09.910 に答える
7

完了したことを確認する必要があるいくつかの手順があります。これは真のブラック ホールである可能性があります。

org.codehaus.mojo の tomcat-maven-plugin を使用している場合は、次の構成を使用する必要があります。

<configuration>
    <url>http://localhost:8080/manager/text</url>
    <warFile>your_war_filename.war</warFile>
    <server>server_name_on_settingsxml</server>
</configuration>

maven settings.xml で「server_name_on_settingsxml」サーバー資格情報が定義されていることを確認してください。mvn tomcat:deploy を使用します (この 'tomcat' プレフィックスを使用する必要があります)。これは、デプロイ時に上記の構成を読み取る唯一の方法です。

ただし、org.apache.tomcat.maven の tomcat7-maven-plugin を使用している場合は、mvn tomcat7:deploy を使用する必要があります。「tomcat7」プレフィックスは、プラグインから構成を読み取ります。

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>

私は tomcat:deploy を使用していましたが、pom.xml に tomcat7-maven-plugin が定義されていました。したがって、maven deploy は構成タグを読み取っていませんでした...

ユーザー名とパスワードが正しく定義されていることを確認し、デプロイ時に正しいプラグインを使用すると、機能します。

于 2012-07-14T00:44:44.083 に答える
6

codehouse tomcat プラグイン バージョン 1.1 を使用して Tomcat 7 サーバーにデプロイしようとすると、403 エラーが発生する可能性があります。バージョン 1.1 はまだ Tomcat 7 をサポートしていません。

Tomcat 7 を使用している場合は、Cargo を使用する必要があります。

于 2011-04-29T16:09:20.307 に答える
4

「html」の代わりに次の文字列を使用する必要があることがわかりました。

http://localhost:8080/manager/text
于 2013-01-29T19:20:36.970 に答える
3

Tomcat 7を使用する場合は、tomcatプラグインのURL http:// localhost:8080 / manager/htmlを参照する必要があります。

http://mojo.codehaus.org/tomcat-maven-plugin/examples/deployment-tomcat7.html

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <version>1.2-SNAPSHOT</version>
  <configuration>
    <url>http://localhost:8080/manager/html</url>
  </configuration>
</plugin>
于 2011-08-22T16:51:52.320 に答える
3

バージョン 7 を使用している場合、問題があります。デフォルトでは、/manager/text リソースへのアクセスが有効になっていません。

ドキュメントに記載されているように、ロールmananger-scriptを持つユーザーを作成する必要があります

It would be quite unsafe to ship Tomcat with default settings that allowed anyone
on the Internet to execute the Manager application on your server.
Therefore, the Manager application is shipped with the requirement that anyone
who attempts to use it must authenticate themselves, using a username and
password that have the role manager-script associated with them.
Further, there is no username in the default users file
($CATALINA_BASE/conf/tomcat-users.xml) that is assigned this role.
Therefore, access to the Manager application is completely disabled by default.

To enable access to the Manager web application, you must either create a new
username/password combination and associate the role name manager-script with it,
or add the manager-script role to some existing username/password combination.

それが役に立てば幸い :)

于 2011-09-10T08:10:07.400 に答える
3

これも可能です:

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
        <server>myserver</server>
        <username>admin</username>
        <password>admin</password>
    </configuration>
</plugin>
于 2011-07-01T20:03:37.083 に答える
2

以前は同じエラーが発生していました。Tomcat-users.xml ファイルに (manager、manager-gui、admin、manager-script) のロールを持つユーザー (私の場合は管理者) が含まれていることを確認する必要があります。

ubuntuにtomcat 7、maven 3があります。

于 2011-09-15T03:59:48.373 に答える
1

config フォルダーの tomcat-users.xml で、manager-script および manager ロールを tomcat ユーザーに追加するだけです。Tomcat 7 では、さまざまなマネージャー GUI アクセスに対してさまざまなロールを指定する必要があります。この場合、テキストに移動します。テキスト インターフェイスの最後に、manager-script ロールを使用する必要があります。

于 2011-10-16T15:37:52.683 に答える
1

This solution is for "Apache" Tomcat7 plugin: As it is already mentioned before you need to add "/text" to the end of the url

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
    <port>8080</port>
    <path>/deployPath</path>
    <url>http://localhost:8080/manager/text</url>
    <server>TomcatServer</server>
</configuration>

Configure you "settings.xml" which is located inside .m2 folder

<servers>
    <server>
        <id>TomcatServer</id>
        <username>script-admin</username>
        <password>password</password>
    </server>
</servers>

Since you use Tomcat 7, the MOST important thing is that you should create a different user for "manager-script" role, as it is mentioned in the documentation!

<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-script"/>
于 2015-03-20T09:34:39.683 に答える
1

~/.m2/settings.xml の構成ファイルを確認する必要があるかもしれません。このファイルは次の構造体である必要があります。

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>

その後、サーバー conf がプロジェクトに対して正しいことを確認する必要があります。

  <servers>
     <server>
        <id>mytomcat</id>
        <username>test</username>
        <password>test</password>
     </server>
  </servers>

後で mvn tomcat:deploy を実行します。また、debbug を表示するために tomcat:deploy -X を実行することもできます。

于 2012-05-23T10:18:27.897 に答える
0

ユーザー名とパスワードに関する問題に直面している場合は、心配しないでください。Tomcat ディレクトリに という名前のファイルがあります。tomcat-user.xmlそこに移動して、名前とパスワードの属性を確認し、プロンプトでユーザー名とパスワードを要求されたときに使用します。

それでも Apache のホームページを開くことができない場合は、Tomcat ディレクトリに別のファイルがありserver.xml、ポート 8080 をこれに変更します。

于 2012-04-24T17:55:22.993 に答える
0

Netbeans にバンドルされている Tomcat Server 8.0 に Web アプリケーションをデプロイしようとしているときに、サーバーから返された HTTP 応答コード: 400 に3 日以上費やしました。コマンドラインで使用mvn tomcat7:deployすると、すべてが完璧に機能しましたが、Netbeans IDE では成功しませんでした。POM.xml に tomcat maven プラグインを設定しました

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>tomcat</server>
    </configuration>
</plugin>

さらに、Maven の .m2/conf/settings.xml のサーバー レコード、

<settings>
    <servers>
        <server>
            <id>tomcat</id>
            <username>admin</username>
            <password>admin</password>
        </server>
    </servers>
</settings>

tomcat-users.xml の適切な tomcat ユーザーでも

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script,manager-gui"/>

しかし、まだ成功していません。根本的な原因は、弊社で使用しているProxyサーバーとNetbeansの設定でした。Netbeans で、[ツール] -> [オプション] に移動し、[一般] タブで、[システム プロキシ設定] の代わりに [手動プロキシ設定] を使用します(システム プロキシ設定が機能する場合でも)。それは私を助け、Netbeans から直接 Tomcat 8 に Web アプリをデプロイできるようになりました。localhost サーバーのみを使用している場合は、No Proxy を設定することもできます。問題の根本的な原因は、オプションのシステム プロキシ設定のソースである、デフォルトの Web ブラウザで設定された不適切なプロキシでした。

于 2014-10-21T11:18:45.647 に答える
0

tomcat6 から tomcat7 への移行の要約:

  1. tomcat-user.xml にロールを追加する
  2. /text または /html を URL に追加します
  3. プラグインのバージョンを変更する

    <groupId>org.apache.tomcat.maven</groupId> 
    <artifactId>tomcat7-maven-plugin</artifactId> 
    <version>2.2</version>
    
  4. オプション tomcat:deploy を tomcat7:deploy に変更します

于 2013-11-18T12:25:21.113 に答える
0

403 エラーも発生しますが、Apache 2 経由で接続した場合のみです。ポート 8080 を使用して tomcat に直接デプロイすると、動作します。したがって、ポート 8080 を URL に追加してみてください。

Apache経由で機能しない理由をまだ理解しようとしています。私は使用 ProxyPass / ajp://localhost:8009/ しています

<Location "/manager" >
     Order allow,deny
     Allow from 62.245.147.202
     Satisfy Any
   </Location>
于 2015-10-23T11:39:16.317 に答える