One workaround is to use a temporary password (say, "xxx") when creating the connection pool, stop the domain, open
$GLASSFISH_HOME/domains/domain1/config/domain.xml
, and replace "xxx" with ""This should work with all versions of GlassFish (v1, v2, and v3). To do it with script:
$GLASSFISH_HOME/bin/asadmin start-domainvi/vim is also well suited for this type of search-replace:
$GLASSFISH_HOME/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --property user=root:password=xxx:DatabaseName=test:ServerName=localhost:port=3306 mysql-pool
$GLASSFISH_HOME/bin/asadmin create-jdbc-resource --connectionpoolid mysql-pool jdbc/test
$GLASSFISH_HOME/bin/asadmin stop-domain
cd $GLASSFISH_HOME/domains/domain1/config
cat domain.xml | sed "s/xxx//" > domain.xml.replaced
mv domain.xml domain.xml.original
mv domain.xml.replaced domain.xml
$GLASSFISH_HOME/bin/asadmin start-domain
vim domain.xml
/xxx
dw
:wq