title: Desperately need help with Glassfish 3.1 deployment and issues running in Maven
body: <p>I am trying desperately to get a maven maven-glassfish-plugin working to start my domain and deploy a war so I can test.
  I wanted to use maven-glassfish-plugin because as far as I can find, maven-embedded-glassfish-plugin does not support setting a keyfile so I can test login authentication through selenium</p>
  
  <p>${project.build.outputDirectory}/keyfile</p>
  
  <p>But I cannot get maven-glassfish-plugin to run, and I cannot get maven-embedded-glassfish-plugin to actually allow programmatic setting of users and authentication.</p>
  
  <p>My Maven items:</p>
  
  <pre><code>    &lt;properties&gt;
          &lt;glassfish.home&gt;C:/usr/bin/glassfish-3.1-b42-02_11_2011/&lt;/glassfish.home&gt;
          &lt;glassfish.domain.name&gt;domain1&lt;/glassfish.domain.name&gt;
          &lt;glassfish.domain.host&gt;localhost&lt;/glassfish.domain.host&gt;
  
          &lt;!-- Glassfish --&gt;
          &lt;glassfish.version&gt;3.2-SNAPSHOT&lt;/glassfish.version&gt;
          &lt;glassfish.plugin.version&gt;2.1&lt;/glassfish.plugin.version&gt;
          &lt;glassfish.domain.name&gt;domain1&lt;/glassfish.domain.name&gt;
          &lt;glassfish.domain.host&gt;localhost&lt;/glassfish.domain.host&gt;
          &lt;glassfish.adminUser&gt;admin&lt;/glassfish.adminUser&gt;
          &lt;glassfish.adminPassword&gt;adminadmin&lt;/glassfish.adminPassword&gt;
          &lt;glassfish.passwordFile&gt;${project.build.testOutputDirectory}/passwd.local.file&lt;/glassfish.passwordFile&gt;--&gt;
  
          ...
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.glassfish.maven.plugin&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-glassfish-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${glassfish.plugin.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;glassfishDirectory&gt;${glassfish.home}&lt;/glassfishDirectory&gt;
                      &lt;user&gt;${glassfish.adminUser}&lt;/user&gt;
                      &lt;!--&lt;adminPassword&gt;&lt;/adminPassword&gt;--&gt;
                      &lt;passwordFile&gt;${glassfish.passwordFile}&lt;/passwordFile&gt;
                      &lt;autoCreate&gt;true&lt;/autoCreate&gt;
                      &lt;debug&gt;true&lt;/debug&gt;
                      &lt;echo&gt;true&lt;/echo&gt;
                      &lt;terse&gt;false&lt;/terse&gt;
                      &lt;domain&gt;
                          &lt;name&gt;${glassfish.domain.name}&lt;/name&gt;
                          &lt;host&gt;${glassfish.domain.host}&lt;/host&gt;
                          &lt;adminPort&gt;4848&lt;/adminPort&gt;
                          &lt;httpPort&gt;8080&lt;/httpPort&gt;
                          &lt;httpsPort&gt;8443&lt;/httpsPort&gt;                                                        
                      &lt;/domain&gt;
                      &lt;components&gt;
                          &lt;component&gt;
                              &lt;name&gt;${project.artifactId}&lt;/name&gt;
                              &lt;artifact&gt;${project.build.directory}/${project.build.finalName}.war&lt;/artifact&gt;
                          &lt;/component&gt;
                      &lt;/components&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  </code></pre>
  
  <p>But I still cannot get this to start the admin without forcing the admin login.</p>
  
  <p>I started blogging about this, but really with there was a solution</p>
  
  <p>=== Details ===</p>
  
  <p>I went through much different iteration with this plugin, and really did not have complete success.
  One issue that keeps plaguing this plugin in my testing, is when the plugin defines no username and password, or adds the default admin username and password like:</p>
  
  <pre><code>&lt;user&gt;${glassfish.adminUser}&lt;/user&gt;
  &lt;adminPassword&gt;${glassfish.adminPassword}&lt;/adminPassword&gt;
  </code></pre>
  
  <p>The domain will not start based on a missing “Master Password” and also a warning about deprecated syntax.</p>
  
  <pre><code>[DEBUG] [C:\usr\bin\glassfish-3.1-b42-02_11_2011\bin\asadmin.bat, start-domain, --echo=true, --terse=false, --interactive=false, --user, admin, --passwordfile, C:\DOCUME~1\MKN
  UTS~1\LOCALS~1\Temp\mgfp2524993691695672772.tmp, --debug=true, --domaindir, C:\usr\bin\glassfish-3.1-b42-02_11_2011\domains, domain1]
  [INFO] Deprecated syntax, instead use:
  [INFO] asadmin --echo --terse=false --interactive=false --user admin --passwordfile C:\DOCUME~1\MKNUTS~1\LOCALS~1\Temp\mgfp2524993691695672772.tmp start-domain [options] ...
  [INFO] asadmin --host localhost --port 4848 --user admin --passwordfile C:\DOCUME~1\MKNUTS~1\LOCALS~1\Temp\mgfp2524993691695672772.tmp --interactive=false --echo=true --terse=false start-domain --verbose=false --upgrade=false --debug=true --domaindir "C:\\usr\\bin\\glassfish-3.1-b42-02_11_2011\\domains" domain1
  [INFO] Command start-domain failed.
  [ERROR] The Master Password is required to start the domain.  No console, no prompting possible.  You should either create the domain with --savemasterpassword=true or provide
   a password file with the --passwordfile option.
  [ERROR] Unable to start domain "domain1".
  [ERROR] For more detail on what might be causing the problem try running maven with the --debug option
  [ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
  </code></pre>
  
  <p>Another option was to use a passwordFile for the startup</p>
  
  <pre><code>&lt;passwordFile&gt;${glassfish.passwordFile}&lt;/passwordFile&gt;
  …
  &lt;glassfish.passwordFile&gt;${project.build.testOutputDirectory}/passwd.local.file&lt;/glassfish.passwordFile&gt;
  </code></pre>
  
  <p>When I attempt to start the domain</p>
  
  <pre><code>mvn org.glassfish.maven.plugin:maven-glassfish-plugin:start-domain -e –X
  </code></pre>
  
  <p>The domain successfully starts as per the logs:</p>
  
  <pre><code>asadmin --host localhost --port 4848 --user admin --passwordfile C:\DOCUME~1\MKNUTS~1\LOCALS~1\Temp\mgfp2524993691695672772.tmp --interactive=false --echo=true --terse=false start-domain --verbose=false --upgrade=false --debug=true --domaindir "C:\\usr\\bin\\glassfish-3.1-b42-02_11_2011\\domains" domain1
  </code></pre>
  
  <p>The domain successfully starts as per the logs:</p>
  
  <pre><code>[DEBUG] [C:\usr\bin\glassfish-3.1-b42-02_11_2011\bin\asadmin.bat, start-domain, --echo=true, --terse=false, --interactive=false, --user, MKnuts6173c, --passwordfile, C:\usr\SY
  NCH\PACKT\3166\Chapters_Code\ch03\target\test-classes/passwd.local.file, --debug=true, --domaindir, C:\usr\bin\glassfish-3.1-b42-02_11_2011\domains, domain1]
  [INFO] Deprecated syntax, instead use:
  [INFO] asadmin --echo --terse=false --interactive=false --user MKnuts6173c –passwordfile C:\usr\SYNCH\PACKT\3166\Chapters_Code\ch03\target\test-classes/passwd.local.file start-domain [options] ...
  
  [INFO] asadmin --host localhost --port 4848 --user MKnuts6173c --passwordfile C:\usr\SYNCH\PACKT\3166\Chapters_Code\ch03\target\test-classes/passwd.local.file --interactive=false --echo=true --terse=false start-domain --verbose=false --upgrade=false --debug=true --domaindir "C:\\usr\\bin\\glassfish-3.1-b42-02_11_2011\\domains" domain1
  
  [INFO] Attempting to start domain1.... Please look at the server log for more details.....
  </code></pre>
  
  <p>Even though this seemed to complete successfully, there was a fundamental issue I could not solve. When this method to start domain1 in GF, there is not a default admin login, thus you are prompted for an admin login:</p>
  
  <p><img src="https://i.stack.imgur.com/r9tAd.png" alt="image 3166_ch02_07"></p>
  
  <p>The admin screen does not get a user to login with as confirmed in the logs:</p>
  
  <pre><code>[#|2011-02-15T15:15:21.047-0500|INFO|glassfish3.1|javax.enterprise.system.tools.admin.com.sun.enterprise.container.common|_ThreadID=100;_ThreadName=Thread-1;|User [] from host localhost does not have administration access|#]
  </code></pre>
  
  <p>When attempting to actually login, admin user does not have administration permission as found in the logs:</p>
  
  <pre><code>[#|2011-02-15T15:23:22.535-0500|INFO|glassfish3.1|javax.enterprise.system.tools.admin.com.sun.enterprise.container.common|_ThreadID=118;_ThreadName=Thread-1;|User [admin] from host localhost does not have administration access|#]
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/O8fhX.png" alt="image 3166_ch02_08"></p>
  
  <p>My application is also not actually deployed when this happens. So I rally have access to nothing.</p>
  
  <p>I also tried to remove the passwordFile, and use nothing, or use just the user, or even the user and adminPassword, but still no luck</p>
  
  <p>My contents of my passwordFile:</p>
  
  <pre><code>AS_ADMIN_MASTERPASSWORD=changeit
     AS_ADMIN_PASSWORD=adminadmin
     AS_ADMIN_USERPASSWORD=xxx
  </code></pre>
  
  <p>When I run this same command on outside of maven</p>
  
  <pre><code>C:\usr\bin\glassfish-3.1-b42-02_11_2011\bin\asadmin.bat --host localhost --port 4848 --user MKnuts6173c --passwordfile C:\usr\SYNCH\PACKT\3166\Chapters_Code\ch03\target\test-classes/passwd.local.file --interactive=false --echo=true --terse=false start-domain --verbose=false --upgrade=false --debug=true --domaindir "C:\\usr\\bin\\glassfish-3.1-b42-02_11_2011\\domains" domain1
  </code></pre>
  
  <p>I get the same issues where I cannot seem to get into my control panel, but the server logs are being populated now.</p>