gpt4 book ai didi

jenkins - 如何使用 Jenkins 在 GlassFish 4 服务器中部署 war 文件

转载 作者:行者123 更新时间:2023-12-02 00:30:21 25 4
gpt4 key购买 nike

我正在使用 Jenkins 在 GlassFish 4 服务器中部署一个 war 文件。但是无法部署Glassfish 4 服务器中的 war 文件。
我正在遵循以下过程。

enter image description here

但它在构建时给出了以下错误。

ERROR: Build step failed with exception org.codehaus.cargo.util.CargoException: Cannot create the DeploymentManager at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.getDeploymentManager(AbstractJsr88Deployer.java:356) at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.redeploy(AbstractJsr88Deployer.java:192) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:77) at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:147) at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:117) at hudson.FilePath.act(FilePath.java:1047) at hudson.FilePath.act(FilePath.java:1025) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:114) at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeploy(PasswordProtectedAdapterCargo.java:93) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:64) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635) at hudson.model.Run.execute(Run.java:1819) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Caused by: javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException: Could not get DeploymentManager; No registered DeploymentFactory handles this URI at javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.getDeploymentManager(DeploymentFactoryManager.java:117) at org.codehaus.cargo.container.glassfish.GlassFish3xRemoteDeployer.getDeploymentManager(GlassFish3xRemoteDeployer.java:82) at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.getDeploymentManager(AbstractJsr88Deployer.java:352) ... 18 more javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException: Could not get DeploymentManager; No registered DeploymentFactory handles this URI at javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.getDeploymentManager(DeploymentFactoryManager.java:117) at org.codehaus.cargo.container.glassfish.GlassFish3xRemoteDeployer.getDeploymentManager(GlassFish3xRemoteDeployer.java:82) at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.getDeploymentManager(AbstractJsr88Deployer.java:352) at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.redeploy(AbstractJsr88Deployer.java:192) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:77) at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:147) at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:117) at hudson.FilePath.act(FilePath.java:1047) at hudson.FilePath.act(FilePath.java:1025) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:114) at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeploy(PasswordProtectedAdapterCargo.java:93) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:64) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635) at hudson.model.Run.execute(Run.java:1819) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Build step 'Deploy war/ear to a container' marked build as failure Finished: FAILURE

最佳答案

我能够使用以下两种方法中的任何一种方法部署到 glassfish 4:

  1. 方法一使用新版Deploy to container Plugin

    你可以从github克隆following(注意:你可以尝试使用新版本的插件)

    https://github.com/jenkinsci/deploy-plugin/tree/205715c3556ade8d8665de677ebb41e35ee64793

    现在构建项目,在目标文件夹中,您可以找到可以在 jenkins 中安装的 deploy.hpi 文件。此版本支持 Glassfish 4。

    手动安装插件:How to install a plugin in Jenkins manually

  2. 方法 2 在 jenkins 中添加以下作为执行 shell。根据需要更新值并创建 glassfish 密码文件。它将取消部署 ear 文件并部署新文件。

#!/bin/bash

# FOR JENKINS

# Update following values as required
GLASSFISH_PASSWORD_FILE_PATH=/home/pwd

ASADMIN_PATH="/home/glassfish4/glassfish/bin/asadmin"
ASADMIN_BASE_CMD="$ASADMIN_PATH --host 10.13.209.100 --port 9048 --user admin2 --passwordfile $GLASSFISH_PASSWORD_FILE_PATH"

DEPLOY_EAR_FILE_PATH="Dummy-project-ear/target"
DEPLOY_EAR_FILE_NAME="Dummy-project-ear-1.0-SNAPSHOT.ear"

UNDEPLOY_EAR_NAME="Dummy-project-ear-1.0-SNAPSHOT"

# Commands

$ASADMIN_BASE_CMD list-applications
$ASADMIN_BASE_CMD undeploy $UNDEPLOY_EAR_NAME
$ASADMIN_BASE_CMD deploy $DEPLOY_EAR_FILE_PATH/$DEPLOY_EAR_FILE_NAME

关于jenkins - 如何使用 Jenkins 在 GlassFish 4 服务器中部署 war 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52160923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com