[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Hotdeployment with HotSwapAgent  XML
Forum Index -> Development
Author Message
rheinrichs

Power User
[Avatar]

Joined: 08/05/2009 10:05:36
Messages: 209
Offline

Hi all,

I'm working for a project that is continually being expanded over 10 years.
The "hot deployment" was always a pain point.
It works for a while, until someone move classes or miss to update config.
While debugging with IntelliJ a hot replace works only for existing methods. For new methods a restart of Tomcat was needed.

Since a week I update the startup script with the JetBrain VM like documented here:
https://www.captaincasa.com/docu/eclnt_risc_hotswap/

*Very nice*

It works “out of the box” with existing projects. It took about an hour and the project is now hot replacement able! (with new methods, update existing source, etc.)
In the first step I miss to create the config “hotswap-agent.properties”. That won’t work!
After successful update the tomcat config step-by-step (like docu) everything is running fine now.

Curious? Check yourself – it works!
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Hi Roland,
thanks for sharing your experience!
Kind regards! Björn

Björn Müller, CaptainCasa GmbH
nnikolov



Joined: 14/11/2017 07:13:44
Messages: 1
Offline

Hi,

We have been developing our project for 7 years now and it has grown significantly. Currently it contains 4600+ classes, 39 subprojects and 22 of them require deployment.
The deployment of different projects takes from 20 seconds to 2 minutes depending on the project and the workstation. We haven't used hot deploy at all, probably only in the beginning.
We tried HotSwapAgent framework, and it seems to work fine for our project. The setup was pretty easy, we just followed the guide from CC and it worked flawlessly.

Regards, Nikolay
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Thanks Nikolay! ;-)

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Problems with Tomcat 10.

Just had some mail ping pong with a user that is trying to get HotSwapAgent up and runnint with Tomcat 10 (jakarta). When following the original documentation then the Tomcat-plugin of HotSwapAgent was creating a bug:

Code:
        Caused by: org.apache.catalina.LifecycleException: Failed to start component [WebappLoader[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/App]]]
                 at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
                 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
                 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4747)
                 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:683)
                 ... 37 more
         Caused by: java.lang.IllegalArgumentException: No such field class org.apache.catalina.loader.ParallelWebappClassLoader.repositories on ParallelWebappClassLoader
   context: App
   delegate: false
 ----------> Parent Classloader:
 java.net.URLClassLoader@6404f418
 
                 at org.hotswap.agent.util.ReflectionHelper.get(ReflectionHelper.java:149)
                 at org.hotswap.agent.plugin.tomcat.TomcatPlugin.addRepositoriesAtStart(TomcatPlugin.java:168)
                 at org.hotswap.agent.plugin.tomcat.TomcatPlugin.init(TomcatPlugin.java:116)
                 at org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:398)
                 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                 ... 40 more
 


It sounds strange, but the Tomcat-plugin is not required for CaptainCasa development activities (you do not directly work with servlets/filters/...!). So when switching this plugin off, then Tomcat properly starts and it seems after first tests that code-replacement is properly working.

Switching off the Tomcat-plugin is just a simple configuration file, please read the details in the updated documentation: https://www.captaincasa.com/docu/eclnt_risc_hotswap/index.html?ifrunningtomcat10addbasicconfigurationfiletotomcatlib

Kind regards! Björn

Björn Müller, CaptainCasa GmbH
wwillemsens

Power User

Joined: 14/11/2016 18:05:48
Messages: 32
Offline

Thanks for figuring this out!!

It still didn't work...

But when I also added Log4j2 and JdkPlugin to the disabledPlugins in hotswap-agent.properties in tomcat/lib, it started working.

Looks great

Kind regards
Wim
ngromov


[Avatar]

Joined: 02/10/2020 12:54:23
Messages: 4
Offline

HotSwapAgent jdk17 + Tomcat9064 - Refrain from loading libraries redundantly/unnecessarily.

in case of bypassing the conflict between redundant loading of libraries, such as Hibernate, where startup produces an error similar to:

Code:
 Caused by: java.lang.ClassFormatError: Duplicate method name "_buildSessionFactory" with signature "(Lorg.hibernate.service.ServiceRegistry;)Lorg.hibernate.SessionFactory;" in class file org/hibernate/cfg/Configuration
 



you should probably set the argument -XX:HotswapAgent to ``core`` instead of ``fatjar``.

The properly way is just to use the variable ``disabledPlugins`` and extend it by ``Hibernate`` to exclude one (more here .). It should be like ``disabledPlugins=Hibernate``

Both ways worked for me good.
[ICQ]
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team