简体   繁体   中英

deploying/Running dukesbank sample application of java ee with glassfish

I am trying to run dukesbank sample application which is here.

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

I am trying to follow the following instructions from there:

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. I am using ubuntu 12.04. I have installed glassfish application server and I am able to start and stop it properly. I have downloaded the javaeetutorial5.

  2. I have written password of glassfish in javaeetutorial5/example/common/admin-passwd.txt file.

  3. I have given values to parameters in javaeetutorial5/examples/bp-project/build.properties.sample file and then I have renamed the file to build.properties.

  4. Now when I got to directory javaeetutorial/example/dukesbank in terminal and type "ant" , it works fine. but when I try to type " ant run " it gives me following:

    create-tables: [sql] Executing resource: /home/ragini/javaeetutorial5/examples/common/sql/javadb/tutorial.sql [sql] 181 of 181 SQL statements executed successfully

      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) 

pl note that till create table, everything executes successfully then it gives me the shown error. Could someone pl tell what does it try to say actually ?

My build.properties file in javaeetutorial/examples/bp-project/ looks like below:

# 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

I am quite sure about username and password of glassfish.

Late to the party, but this answer might still serve someone else with a similar problem.

In short, you seem to be trying to run the tutorial on a different Glassfish version than used for the Ant script.

In order to resolve this problem, you have to make adjustments to the /home/ragini/javaeetutorial5/examples/bp-project/app-server-ant.xml file.

In particular, look for the target with name " deploy " (around line 367) and change

<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>

to

<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>

In other words, the order of the instructions for the deploy command seem to have changed over the years. In order to support other targets (eg, undeploy ), you might need to change their targets in a similar fashion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM