【问题标题】:maven-glassfish-plugin tries to start the domain when it is already startedmaven-glassfish-plugin 尝试在域已经启动时启动它
【发布时间】:2010-11-10 03:27:01
【问题描述】:

我刚刚开始使用 maven-glassfish-plugin。我得到了起始域目标。但是,当我尝试执行部署目标时,插件认为域未启动并尝试重新启动它 - 这显然失败了。请参阅下面的日志:

> mvn glassfish:start-domain
[INFO] --- maven-glassfish-plugin:2.1:start-domain (default-cli) @ arquillian-sample ---
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --user admin --echo --terse=false start-domain [options] ...
[INFO] asadmin --host localhost --port 4848 --user admin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --echo=true --terse=false start-domain --debug=true --domaindir C:\apps\glassfish-3.0.1\glassfish\domains --help=false --upgrade=false --verbose=false domain1
[INFO] Waiting for DAS to start ...
[INFO] Started domain: domain1
[INFO] Domain location: C:\apps\glassfish-3.0.1\glassfish\domains\domain1
[INFO] Log file: C:\apps\glassfish-3.0.1\glassfish\domains\domain1\logs\server.log
[INFO] Admin port for the domain: 4848
[INFO] Debug port for the domain: 9009
[INFO] Command start-domain executed successfully.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

> mvn glassfish:deploy
[INFO] --- maven-glassfish-plugin:2.1:deploy (default-cli) @ arquillian-sample ---
[INFO] Domain domain1 isn't started. Starting it for you.
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --user admin --echo --terse=false start-domain [options] ...
[INFO] asadmin --host localhost --port 4848 --user admin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --echo=true --terse=false start-domain --debug=true --domaindir C:\apps\glassfish-3.0.1\glassfish\domains --help=false --upgrade=false --verbose=false domain1
[INFO] There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
[INFO] Command start-domain failed.
[ERROR] Unable to start domain "domain1".
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
  1. 为什么插件检测不到域已经启动?
  2. 为什么我会收到所有“不推荐使用的语法”警告?

为了解决问题 #1,我只是尝试在服务器未运行时发出部署目标。这次部署目标成功启动服务器,但部署失败并显示消息“CLI136 端口 0 应为数值”。见下文:

> mvn glassfish:deploy
[INFO] --- maven-glassfish-plugin:2.1:deploy (default-cli) @ arquillian-sample ---
[INFO] Domain domain1 isn't started. Starting it for you.
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --user admin --echo --terse=false start-domain [options] ...
[INFO] asadmin --host localhost --port 4848 --user admin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --echo=true --terse=false start-domain --debug=true --domaindir C:\apps\glassfish-3.0.1\glassfish\domains --help=false --upgrade=false --verbose=false domain1
[INFO] Waiting for DAS to start ...
[INFO] Started domain: domain1
[INFO] Domain location: C:\apps\glassfish-3.0.1\glassfish\domains\domain1
[INFO] Log file: C:\apps\glassfish-3.0.1\glassfish\domains\domain1\logs\server.log
[INFO] Admin port for the domain: 4848
[INFO] Debug port for the domain: 9009
[INFO] Command start-domain executed successfully.
[INFO] Command deploy failed.
[ERROR] CLI136 Port 0 should be a numeric value.
[ERROR] Deployment of S:\Projects\archfirstunf\java\trunk\examples\arquillian-sample\target\arquillian-sample.war failed.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

我做错了什么?

这是我的插件配置:

<plugin>
    <groupId>org.glassfish.maven.plugin</groupId>
    <artifactId>maven-glassfish-plugin</artifactId>
    <version>2.1</version>
    <configuration>
        <glassfishDirectory>${glassfish.directory}</glassfishDirectory>
        <user>admin</user>
        <passwordFile>${glassfish.directory}/domains/domain1/config/domain-passwords</passwordFile>
        <domain>
            <name>domain1</name>
        </domain>
        <components>
            <component>
                <name>${project.artifactId}</name>
                <artifact>target/${project.build.finalName}.war</artifact>
            </component>
        </components>
        <debug>true</debug>
        <terse>false</terse>
        <echo>true</echo>
    </configuration>
</plugin>

【问题讨论】:

    标签: glassfish maven maven-3 maven-glassfish-plugin


    【解决方案1】:

    我正在使用以下配置(注意domain 元素中的httpPortadminPort):

    <plugin>
        <groupId>org.glassfish.maven.plugin</groupId>
        <artifactId>maven-glassfish-plugin</artifactId>
        <version>2.1</version>
        <configuration>
            <glassfishDirectory>${glassfish.directory}</glassfishDirectory>
            <user>admin</user>
            <passwordFile>${glassfish.directory}/domains/domain1/config/domain-passwords</passwordFile>
            <domain>
                <name>domain1</name>
                <httpPort>8080</httpPort>
                <adminPort>4848</adminPort>
            </domain>
            <components>
                <component>
                    <name>${project.artifactId}</name>
                    <artifact>target/${project.build.finalName}.war</artifact>
                </component>
            </components>
            <debug>true</debug>
            <terse>false</terse>
            <echo>true</echo>
        </configuration>
    </plugin>
    

    没有它们,事情就无法按预期工作(尽管它们应该是可选的)。但是启动、部署(无论是否启动服务器)等对我来说都很好。

    PS:我不记得这是否重要,但我使用的是 2.2-SNAPSHOT 版本的插件。


    更新:这是我使用的确切配置:

      <plugin>
        <groupId>org.glassfish.maven.plugin</groupId>
        <artifactId>maven-glassfish-plugin</artifactId>
        <version>2.2-SNAPSHOT</version>
        <configuration>
          <glassfishDirectory>${glassfish.home}</glassfishDirectory>
          <user>${domain.username}</user>
          <passwordFile>${glassfish.home}/domains/${project.artifactId}/master-password</passwordFile>
          <autoCreate>true</autoCreate>
          <debug>true</debug>
          <echo>true</echo>
          <skip>${test.int.skip}</skip>
          <domain>
            <name>${project.artifactId}</name>
            <httpPort>8080</httpPort>
            <adminPort>4848</adminPort> <!-- [ERROR] CLI136 Port 0 should be a numeric value. -->
          </domain>
          <components>
            <component>
              <name>${project.artifactId}</name>
              <!--artifact>${project.build.directory}/${project.build.finalName}.war</artifact-->
              <artifact>${project.build.directory}/${project.build.finalName}</artifact>
            </component>
          </components>
        </configuration>
      </plugin>
    

    这是我得到的输出:

    $ mvn glassfish:部署 [INFO] 正在扫描项目... ... [信息] [信息] --------------------------------------------- ------------------------- [信息] 构建 maven-glassfish-testcase Maven Webapp 1.0-SNAPSHOT [信息] --------------------------------------------- ------------------------- [信息] [信息] --- maven-glassfish-plugin:2.2-SNAPSHOT:deploy (default-cli) @ maven-glassfish-testcase --- ... [信息] asadmin --host localhost --port 4848 --user admin --passwordfile /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase/master-password --interactive=false --echo= true --terse=true 部署 --name maven-glassfish-testcase --force=false --precompilejsp=false --verify=false --enabled=true --generatermistubs=false --availabilityenabled=false --keepreposdir=false --keepfailedstubs=false --logReportedErrors=true --upload=false --help=false /home/pascal/Projects/stackoverflow/maven-glassfish-testcase/target/maven-glassfish-testcase [INFO] 应用程序已成功部署,名称为 maven-glassfish-testcase。 [信息] [信息] [信息] --------------------------------------------- ------------------------- [信息] 构建成功 [信息] --------------------------------------------- ------------------------- ...

    请注意,我没有收到任何奇怪的“已弃用”消息。而且一切正常。

    添加 httpPort 和 adminPort 增加了一个新的复杂性 - 现在我进行部署时身份验证失败(即使相同的身份验证正在通过 start-domain 目标)。

    > mvn glassfish:start-domain
    [INFO] --- maven-glassfish-plugin:2.2-SNAPSHOT:start-domain (default-cli) @ arquillian-sample ---
    [INFO] Deprecated syntax, instead use:
    [INFO] asadmin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --user admin --echo --terse=false start-domain [options] ...
    [INFO] asadmin --host localhost --port 4848 --user admin --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --echo=true --terse=false start-domain --debug=true --domaindir C:\apps\glassfish-3.0.1\glassfish\domains --help=false --upgrade=false --verbose=false domain1
    [INFO] Waiting for DAS to start ...........
    [INFO] Started domain: domain1
    [INFO] Domain location: C:\apps\glassfish-3.0.1\glassfish\domains\domain1
    [INFO] Log file: C:\apps\glassfish-3.0.1\glassfish\domains\domain1\logs\server.log
    [INFO] Admin port for the domain: 4848
    [INFO] Debug port for the domain: 9009
    [INFO] Command start-domain executed successfully.
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    
    > mvn glassfish:deploy
    [INFO] --- maven-glassfish-plugin:2.2-SNAPSHOT:deploy (default-cli) @ arquillian-sample ---
    [INFO] Deprecated syntax, instead use:
    [INFO] asadmin --port 4848 --host localhost --passwordfile C:\apps\glassfish-3.0.1\glassfish/domains/domain1/config/domain-passwords --interactive=false --user admin --echo --terse=false deploy [options] ...
    [INFO] Command deploy failed.
    [ERROR] Authentication failed for user: admin
    [ERROR] (Usually, this means invalid user name and/or password)
    [ERROR] Deployment of S:\Projects\archfirstunf\java\trunk\examples\arquillian-sample\target\arquillian-sample.war failed.
    [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".
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.973s
    [INFO] Finished at: Wed Nov 10 01:51:04 EST 2010
    [INFO] Final Memory: 10M/183M
    [INFO] ------------------------------------------------------------------------
    

    将版本更改为 2.2-SNAPSHOT 没有任何区别。顺便说一句,快照在 java.net 存储库中不可用 - 我必须去这里获取它:

        <pluginRepository>
            <id>ocean</id>
            <url>http://maven.ocean.net.au/snapshot</url>
            <releases>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </pluginRepository>
    

    【讨论】:

    • 好的,我开始运行了!问题出在密码上。我使用管理员用户进行所有操作,但显然主密码文件不存储管理员密码。我必须使用 标签来提供它。当然,将管理员密码保存在 pom 中并不理想,所以我想知道为什么这个密码不在 master-password 中。 config 目录中还有 2 个其他密码文件。所有这些密码文件的目的是什么?无论如何,感谢您对 Pascal 的所有帮助!
    • @Naresh:如图所示,我的passwordFile 指向我在domain creation time 生成的master-password 文件,这可能会有所不同。现在我再次考虑这一切,我不确定我做的是否正确,我认为我在滥用那个 master-password 文件。但由于它有效(可能是因为我使用的密码与 admin 密码相同),所以我从未真正挖掘过这个话题。
    • 您从哪里获得 2.2-SNAPSHOT?似乎不在download.java.net/maven/2/org/glassfish/maven/plugin/…
    猜你喜欢
    • 2014-04-23
    • 2011-03-14
    • 1970-01-01
    • 2018-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多