在没有Tomcat管理器的情况下从jenkins自动部署war文件 [英] Auto-Deploy war file from jenkins without Tomcat's Manager

查看:182
本文介绍了在没有Tomcat管理器的情况下从jenkins自动部署war文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个自动脚本或类似的东西,通过jenkins将war文件自动部署到tomcat-server。 tomcat管理器未启用,因此部署到容器插件几乎是一个错过,因为它需要管理器处于活动状态。目前我正在通过scp将war文件推送到tomcat,但是tomcat似乎在每次尝试时崩溃。我还尝试了maven-tomcat-deploy替代方案,它还需要tomcat的管理器才能处于活动状态。还有另一种方法可以将war文件自动部署到我的tomcat吗?

I want to build an automatic script or something equivalent to auto-deploy war-files to a tomcat-server via jenkins. The tomcat manager is not enabled, so the "Deploy to container Plugin" is pretty much a miss, since it needs the manager to be active. At the moment I'm pushing the war files to the tomcat via scp, however the tomcat seems to crash on every other try. I also tried the maven-tomcat-deploy alternative, which also needs the tomcat's manager to be active. Is there another way to auto-deploy the war files to my tomcat?

推荐答案

据我所知你需要经理上传战争或复制它。

As far as I know you either need the manager to upload the war or copy it.

如果Tomcat在重新部署后崩溃,我会检查是否没有来自Tomcat类加载器将其类加载到实例的实例的引用其类由您的应用程序类加载器加载。
当GC启动对应用程序加载实例的引用时,会导致该类进而导致引用所有类的类加载器。因此GC无法清除它们所占用的内存。

If Tomcat crashes after redeployment I'd check if there's no reference from an instance with its class loaded by the Tomcat classloader to an instance with its class loaded by your application classloader. When the GC kicks in the reference to your application loaded instance leads to the class which in turn leads to the classloader which references all the classes. So the GC can't clear the memory they take.

我遇到的Tomcat重新部署失败的大部分(如果不是全部)问题都是由这种引用引起的问题。因此,旧部署将保留在内存中,但不会发生任何事情。您可以增加分配的内存,但这只会推迟崩溃。

Most, if not all, of the issues I encountered with Tomcat failing redeployment have been caused by this kind of referencing issue. Because of this the old deployment will stay in memory though nothing will happen with it. You can increase the allocated memory but this will only postpone the crash.

这篇关于在没有Tomcat管理器的情况下从jenkins自动部署war文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆