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. 我正在使用 ubuntu 12.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] Executing resource: /home/ragini/javaeetutorial5/examples/common/sql/javadb/tutorial.sql [sql] 181 个 SQL 语句中的 181 个成功执行

        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

我很确定 glassfish 的用户名和密码。

4

1 回答 1

0

聚会迟到了,但这个答案可能仍然为其他有类似问题的人服务。

简而言之,您似乎试图在与 Ant 脚本不同的 Glassfish 版本上运行本教程。

为了解决这个问题,您必须对 /home/ragini/javaeetutorial5/examples/bp-project/app-server-ant.xml 文件进行调整。

特别是,寻找名称为“部署”的目标(在第 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 回答