简体   繁体   English

用货物重新部署远程玻璃鱼失败

[英]Redeploy remote glassfish with cargo fails

I'm currently trying to use cargo to deploy an application on a remote glassfish 3.1.2 through atlassian's bamboo. 我正在尝试使用货物通过atlassian竹子在远程glassfish 3.1.2上部署应用程序。 This is a development environment so the same application with a different version number will be deployed on the same context root every time. 这是一个开发环境,因此每次都会在同一个上下文根目录中部署具有不同版本号的相同应用程序。

But every-time I execute the job with the maven goal : 但每次我都以maven的目标执行这项工作:

org.codehaus.cargo:cargo-maven2-plugin:redeploy

I keep getting the error : 我一直收到错误:

11-Jun-2013 15:13:48    Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.2:redeploy failed: Deployment has failed: Action failed Deploying application to target server failed; Error occurred during deployment: Application with name myapp-1.4.8 is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name. Please see server.log for more details.
11-Jun-2013 15:13:48    
11-Jun-2013 15:13:48            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
11-Jun-2013 15:13:48            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
11-Jun-2013 15:13:48            ... 19 more
11-Jun-2013 15:13:48    Caused by: org.codehaus.cargo.util.CargoException: Deployment has failed: Action failed Deploying application to target server failed; Error occurred during deployment: Application with name myapp-1.4.8 is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name. Please see server.log for more details.
11-Jun-2013 15:13:48    
11-Jun-2013 15:13:48            at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.waitForProgressObject(AbstractJsr88Deployer.java:285)
11-Jun-2013 15:13:48            at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.deploy(AbstractJsr88Deployer.java:123)
11-Jun-2013 15:13:48            at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.redeploy(AbstractJsr88Deployer.java:207)
11-Jun-2013 15:13:48            at org.codehaus.cargo.maven2.DeployerRedeployMojo.performDeployerActionOnSingleDeployable(DeployerRedeployMojo.java:50)
11-Jun-2013 15:13:48            at org.codehaus.cargo.maven2.AbstractDeployerMojo.performDeployerActionOnAllDeployables(AbstractDeployerMojo.java:180)
11-Jun-2013 15:13:48            at org.codehaus.cargo.maven2.AbstractDeployerMojo.doExecute(AbstractDeployerMojo.java:97)
11-Jun-2013 15:13:48            at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:432)
11-Jun-2013 15:13:48            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
11-Jun-2013 15:13:48            ... 20 more
11-Jun-2013 15:13:48    [ERROR] 
11-Jun-2013 15:13:48    [ERROR] 
11-Jun-2013 15:13:48    [ERROR] For more information about the errors and possible solutions, please read the following articles:
11-Jun-2013 15:13:48    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
11-Jun-2013 15:13:48    [ERROR] 
11-Jun-2013 15:13:48    [ERROR] After correcting the problems, you can resume the build with the command

What I need is for the cargo plugin to force redeployment regardless of the fact that an application (older version) already exists for that context root. 我需要的是货物插件强制重新部署,而不管该上下文根已经存在应用程序(旧版本)。

If I was running the asadmin command manually I could easily add the --force parameter and it would work. 如果我手动运行asadmin命令,我可以轻松添加--force参数,它可以工作。

I have an additional constraint, I cannot install a local version of glassfish on the server hosting the bamboo instance so I cannot use stuff like the maven sh plugin to manually build the asadmin command. 我有一个额外的约束,我无法在托管Bamboo实例的服务器上安装本地版本的glassfish所以我不能使用像maven sh插件这样的东西来手动构建asadmin命令。

Below is the relevant pom.xml fragment : 下面是相关的pom.xml片段:

<build>
        <finalName>myapp-${project.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.2</version>
                <configuration>
                    <container>
                        <containerId>glassfish3x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.remote.username>${cargo.remote.username}</cargo.remote.username>
                            <cargo.remote.password>${cargo.remote.password}</cargo.remote.password>
                            <cargo.glassfish.admin.port>${cargo.glassfish.admin.port}</cargo.glassfish.admin.port>
                            <cargo.hostname>${cargo.hostname}</cargo.hostname>
                        </properties>
                    </configuration>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.glassfish.deployment</groupId>
                        <artifactId>deployment-client</artifactId>
                        <version>3.1.1</version>

                    </dependency>
                </dependencies>
            </plugin>

Any ideas? 有任何想法吗?

Had the same problem. 有同样的问题。 Solved it using the suggestion from Marlon by just adding runtime args as follows: 使用Marlon的建议通过添加运行时args解决了它,如下所示:

          ...
          <configuration>
            <type>runtime</type>
            <properties>
              <cargo.runtime.args>force=true</cargo.runtime.args>
              <cargo.hostname>${hostname}</cargo.hostname>
              <cargo.remote.username>${username}</cargo.remote.username>
              <cargo.remote.password>${password}</cargo.remote.password>
            </properties>
          </configuration>
          ...

Apparently cargo does a deploy, not a redeploy. 显然货物是部署,而不是重新部署。

I finally found out how to accomplish this by slightly modifying the way I was deploying and versioning my application and using glassfish's application versioning system. 我终于通过稍微修改我部署和版本化我的应用程序以及使用glassfish的应用程序版本控制系统的方式来了解如何实现这一目标。 Below is the link to a small blog post that I wrote to show how to accomplish this : 以下是我写的一篇小博客文章的链接,以展示如何完成此任务:

blog post - deploy to remote glassfish using cargo plugin 博客文章 - 使用货物插件部署到远程glassfish

Other way that works for me was using maven-glassfish-plugin , I configured the plugin correctly, I left the pom as a redeploy execution 其他适用于我的方法是使用maven-glassfish-plugin ,我正确配置了插件,我将pom作为重新部署执行

    <execution>
            <id>gf-deploy</id>
            <phase>package</phase>
            <goals>
                <goal>redeploy</goal>
            </goals>
        </execution>

then I modified the asadmin.bat file, and, after the lines where the script is calling the appserver-cli.jar file I added some lines, notice that redeploy calls an undeploy and a deploy command so the maven glassfish plugin's trick here is print something when the undeploy command runs (Tihs will confuse the maven plugin as if the undeploy command were success always), but, when the asadmin command is deploy the flow will run normal. 然后我修改了asadmin.bat文件,在脚本调用appserver-cli.jar文件的行之后我添加了一些行,注意重新部署调用undeploy和deploy命令,这样maven glassfish插件的技巧就是print当undeploy命令运行时(Tihs会混淆maven插件,好像undeploy命令总是成功),但是,当asadmin命令部署时,流将正常运行。

:run
if NOT %1 == undeploy goto :end
%JAVA% -jar "%~dp0..\lib\client\appserver-cli.jar" %*
ECHO "TEST"
:end

if %1 == undeploy goto :end1
%JAVA% -jar "%~dp0..\lib\client\appserver-cli.jar" %*
:end1

after do this modification reploy is alaways working so great! 在做了这个修改后,重新组装是一个非常好的工作!

You might need to set up a new glassfish server admin user in the admin realm. 您可能需要在管理域中设置新的glassfish服务器管理员用户。 Check out the following http://beforeuquit.blogspot.com/ 查看以下http://beforeuquit.blogspot.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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