1

尝试使用 Maven Cargo 插件而不是不支持热重新部署的 Maven GlassFish 插件。Cargo 在 GlassFish 本地现有安装的目标启动/运行上挂起,并占用高达 100% 的 CPU,直到我杀死它!我尝试使用纯文本密码,然后创建了一个密码文件,结果相同。在线搜索会出现各种 Cargo-GlassFish 配置的帖子,几乎所有的帖子都比我使用的版本旧,而且也没有帮助。附上 Maven 插件配置和调试日志。任何帮助表示赞赏。

Environment: Mac OS X Mavericks, Oracle JDK 1.7.0_45, GlassFish-4.0-b89, Maven 3.1.1, cargo-maven2-plugin 1.4.5

Maven 插件配置

<plugin>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-maven2-plugin</artifactId>
  <version>1.4.5</version>
  <configuration>
    <container>
      <containerId>glassfish4x</containerId>
      <type>installed</type>
      <output>${glassfish.installDirectory}/glassfish/domains/${glassfish.domainName}/logs/server.log</output>
      <!-- Fail if not started/stopped within 30 sec -->
      <timeout>30000</timeout>
    </container>
    <configuration>
      <type>existing</type>
      <home>${glassfish.installDirectory}/glassfish</home>
      <properties>
        <cargo.glassfish.domain.name>${glassfish.domainName}</cargo.glassfish.domain.name>
        <cargo.remote.username>${glassfish.adminUser}</cargo.remote.username>
        <cargo.remote.passwordFile>${glassfish.installDirectory}/admin.password</cargo.remote.passwordFile>
        <!-- Maven sets java.home property to JRE but we want JDK -->
      </properties>
    </configuration>
    <deployables>
      <deployable>
        <groupId>${project.groupId}</groupId>
        <artifactId>${project.artifactId}</artifactId>
        <type>${project.packaging}</type>
        <properties>
          <context>/${project.artifactId}</context>
        </properties>
      </deployable>
    </deployables>
  </configuration>
</plugin>

调试日志

[DEBUG] [2.ContainerStartMojo] Resolved artifact and dependencies:file:/Users/Abhijit/Repositories/maven/org/codehaus/cargo/cargo-core-container-glassfish/1.4.5/cargo-core-container-glassfish-1.4.5.jar]
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.5 for container glassfish4x
[DEBUG] Scheduling deployable for deployment: [groupId [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId [calculator-enc], type [war], location [null], pingURL [null]]
[DEBUG] Initial deployable values: groupId = [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId = [calculator-enc], type = [war], location = [null]
[DEBUG] Searching for an artifact that matches [name.abhijitsarkar.learning.webservices.jaxws.security:calculator-enc:war:null]...
[DEBUG] Checking artifact [name.abhijitsarkar.learning.webservices.jaxws.security:calculator-enc:war:null]...
[DEBUG] Computed deployable values: groupId = [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId = [calculator-enc], classifier = [null], type = [war], location = [/Users/Abhijit/Repositories/git/java-ee/jaxws-security/calculator-enc/target/calculator-enc-0.0.1-SNAPSHOT.war]
[DEBUG] Setting deployable property [context]:[/calculator-enc] for [/Users/Abhijit/Repositories/git/java-ee/jaxws-security/calculator-enc/target/calculator-enc-0.0.1-SNAPSHOT.war]
[DEBUG] Invoking setter method public synchronized void org.codehaus.cargo.container.deployable.WAR.setContext(java.lang.String) for deployable org.codehaus.cargo.container.deployable.WAR[calculator-enc-0.0.1-SNAPSHOT.war] with argument /calculator-enc
[DEBUG] Setting container timeout to [30000]
4

1 回答 1

3

对于可能遇到此问题的其他人,我花了 2 天时间通过 Cargo src 代码进行调试以找出问题所在。这两个<home>位置实际上都是需要的。下一个<container>应该指向 GlassFish 外部安装目录(其中包含另一个 glassfish 目录),下一个<configuration>应该指向 glassfish/domains 目录。有没有人向他们提到命名约定很糟糕?为什么不调用后者'<home>' <domainsDir>或实际上意味着它所读取的内容?

于 2013-11-06T02:55:41.660 回答