0

ここにあるdukesbankサンプルアプリケーションを実行しようとしています。

http://docs.oracle.com/javaee/5/tutorial/doc/bncna.html

そこから次の指示に従おうとしています。

Building, Packaging, and Deploying Duke’s Bank Using Ant

To compile and package the enterprise beans, application client, and web client into dukesbank.ear, go to the tut-install/javaeetutorial5/examples/dukesbank/ directory of the tutorial distribution and execute the command:

ant

Run the following command to deploy dukesbank.ear:

ant deploy

This task calls the create-tables task to initialize the database tables.
  1. ubuntu12.04を使用しています。Glassfish アプリケーション サーバーをインストールしましたが、適切に起動および停止できます。javaeetutorial5 をダウンロードしました。

  2. javaeetutorial5/example/common/admin-passwd.txt ファイルに GlassFish のパスワードを書きました。

  3. javaeetutorial5/examples/bp-project/build.properties.sample ファイルのパラメーターに値を指定し、ファイルの名前を build.properties に変更しました。

  4. ターミナルでディレクトリ javaeetutorial/example/dukesbank に移動し、 と入力すると"ant"、正常に動作します。しかし、「ant run」と入力しようとすると、次のようになります。

    create-tables: [sql] リソースの実行: /home/ragini/javaeetutorial5/examples/common/sql/javadb/tutorial.sql [sql] 181 個中 181 個の SQL ステートメントが正常に実行されました

        deploy:
             [exec] Deprecated syntax, instead use:
             [exec] asadmin --user admin --passwordfile /home/ragini/javaeetutorial5/examples/common/admin-password.txt --host localhost --port 4848 deploy [options] ...
             [exec] Command deploy failed.
             [exec] Authentication failed for user: admin
             [exec] with password from password file: /home/ragini/javaeetutorial5/examples/common/admin-password.txt
             [exec] (Usually, this means invalid user name and/or password)
    

テーブルを作成するまで、すべてが正常に実行され、表示されたエラーが表示されることに注意してください。誰かがそれが実際に何を言おうとしているのか教えてもらえますか?

javaeetutorial/examples/bp-project/ にある私の build.properties ファイルは次のようになります。

# Set the property javaee.home, using the path to your 
# GlassFish installation.
# C:/Program Files/glassfish-v3 is the GlassFish v3 default installation 
# path on Windows.
# 
javaee.home=/usr/local/glassfish-3.1.2.2

# Set the property javaee.tutorial.home to the location where you 
# installed the Java EE Tutorial bundle.
#
javaee.tutorial.home=/home/ragini/javaeetutorial5

# machine name (or the IP address) where the applications will be deployed.
javaee.server.name=localhost

# port number where GlassFish applications are accessed by users
javaee.server.port=8080

# port number where the Admin Console of GlassFish is available

javaee.adminserver.port=4848


# Uncomment the property javaee.server.username, 
# and replace the administrator username of the app-server 
javaee.server.username=admin

# Uncomment the property javaee.server.passwordfile, 
# and replace the following line to point to a file that 
# contains the admin password for your app-server. 
# The file should contain the password in the following line: 
#
# AS_ADMIN_PASSWORD=admin
#
# Notice that the password is adminadmin since this is 
# the default password used by GlassFish.
#
javaee.server.passwordfile=${javaee.tutorial.home}/examples/common/admin-password.txt

appserver.instance=server

# Uncomment and set this property to the location of the browser you 
# choose to launch when an application is deployed.
# On Windows and Mac OS X the OS default browser is used.
#default.browser=/Applications/Firefox.app/Contents/MacOS/firefox-bin

# Database vendor property for db tasks
# JavaDB is the default database vendor. See the settings in javadb.properties
db.vendor=javadb

# Digital certificate properties for mutual authentication
keystore=${javaee.tutorial.home}/examples/jaxws/simpleclient-cert/support/client_keystore.jks
truststore=${javaee.home}/domains/domain1/config/cacerts.jks
keystore.password=changeit
truststore.password=changeit

グラスフィッシュのユーザー名とパスワードについてはよく知っています。

4

1 に答える 1

0

パーティーに遅れましたが、この回答は、同様の問題を抱えている他の人に役立つ可能性があります.

つまり、Ant スクリプトに使用されているバージョンとは異なる Glassfish バージョンでチュートリアルを実行しようとしているようです。

この問題を解決するには、/home/ragini/javaeetutorial5/examples/bp-project/app-server-ant.xml ファイルを調整する必要があります。

特に、「 deploy 」という名前のターゲットを探し(367 行目あたり)、変更します。

<exec executable="${asadmin}" failonerror="${failonerror}">
        <arg line=" deploy "/>
        <arg line=" --user ${javaee.server.username}" />
        <arg line=" --passwordfile ${javaee.server.passwordfile}" />
        <arg line=" --host ${javaee.server.name}" />
        <arg line=" --port ${javaee.adminserver.port}" />
        <arg line=" --name ${module.name}"/>
...
</exec>

<exec executable="${asadmin}" failonerror="${failonerror}">
        <arg line=" --user ${javaee.server.username}" />
        <arg line=" --passwordfile ${javaee.server.passwordfile}" />
        <arg line=" --host ${javaee.server.name}" />
        <arg line=" --port ${javaee.adminserver.port}" />
        <arg line=" deploy "/>
        <arg line=" --name ${module.name}"/>
...
</exec>

つまり、デプロイ コマンドの指示の順序は、長年にわたって変更されているようです。他のターゲット ( undeployなど)をサポートするには、同様の方法でターゲットを変更する必要がある場合があります。

于 2016-10-14T09:25:42.453 に答える