Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FISH-5687/FISH-1467 Integrate HotSwap Agent in Payara Platform #5394

Merged
merged 7 commits into from
Sep 17, 2021

Conversation

jGauravGupta
Copy link
Contributor

@jGauravGupta jGauravGupta commented Aug 30, 2021

Description

This is an experimental feature PR to integrate the Payara Platform with the HotSwap Agent.
HotSwap Agent is enabled by jvm-option -XX:HotswapAgent where VM name Dynamic Code Evolution is added to the option to skip this option for JDK with Hotspot vm.

Important Info

Todo

  1. Currently, the HotSwap agent instrumenting all classloaders and loaded classes that need to be filtered and activate to the application classloader.
  2. Modifying annotation or descriptor data is currently not supported and should be fixed under the following tickets:
    • FISH-1467 - Web Container
    • FISH-5650 - EJB Container
    • FISH-5706 - JPA Container
    • FISH-5707 - Resources Container
    • FISH-5708 - CDI Container
    • FISH-5709 - Security Container
    • FISH-5710 - Connectors Container

Testing

Testing Performed

Manual tested on JDK11

Step to test the feature

  • To test this feature, download the Patched JDK 11.
  • Add the Payara Server to the Apache NetBeans IDE.
  • Enable the Hot Deploy from the Properties of the registered server
  • Start the Payara Server from command-line (starting the Payara Server from IDE is not recommended currently as VM name support need to be added to the domain.xml parser in the IDE tools)
  • Deploy the application from the IDE
  • Change the Source code e.g Servlet
  • You should see the similar following message in the server.log file.
HOTSWAP AGENT: 18:27:33.362 RELOAD (org.hotswap.agent.config.PluginManager) - Reloading classes [com.mycompany.mavenproject.NewServlet] (autoHotswap)]]
  • And on refreshing the browser, changes should be reflected instantly.

@jGauravGupta jGauravGupta changed the title FISH-5687 Integrate HotSwap Agent in Payara Platform FISH-5687/FISH-1467 Integrate HotSwap Agent in Payara Platform Sep 9, 2021
@rdebusscher
Copy link

Is it required to use the patched JDK or can this also work with the HotSwapAgent added as agent to any other JDK 11?

@jGauravGupta
Copy link
Contributor Author

Hi @rdebusscher, As of now, It requires patched JDK 11.
https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases

Copy link

@rdebusscher rdebusscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code remarks

Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit hard to review all the code but appears to work!

@eliotmartin eliotmartin merged commit 494f2b0 into payara:master Sep 17, 2021
cubastanley added a commit to cubastanley/Payara that referenced this pull request Oct 18, 2021
@newk5
Copy link

newk5 commented Oct 22, 2021

Hello, I tried to use this feature but we use Java8 so I used this JDK: https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08

However when deploying our app we get this error:

java.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLEngineImpl
	at sun.security.ssl.SSLContextImpl$AbstractTLSContext.createSSLEngineImpl(SSLContextImpl.java:610)
	at sun.security.ssl.SSLContextImpl.engineCreateSSLEngine(SSLContextImpl.java:202)
	at javax.net.ssl.SSLContext.createSSLEngine(SSLContext.java:361)
	at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:190)
	at org.glassfish.grizzly.ssl.SSLEngineConfigurator.createSSLEngine(SSLEngineConfigurator.java:162)
	at org.glassfish.grizzly.ssl.SSLBaseFilter$SSLTransportFilterWrapper.handleRead(SSLBaseFilter.java:1122)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
	at java.lang.Thread.run(Thread.java:748)
]]

Running on Payara 5.2021.8 Linux
@jGauravGupta Does this feature not work with JDK8?

@jGauravGupta
Copy link
Contributor Author

Hi @newk5 ,

This feature currently only supports https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases

@newk5
Copy link

newk5 commented Oct 22, 2021

I see. Is support for Java8 planned for the future?

@newk5
Copy link

newk5 commented Oct 22, 2021

An update on this for anyone who is also using Java8

I was able to get it working using an older JDK8 (181) and using the DCEVM installer (here ) to patch the JDK.

As mentioned above, you'll have to start payara from the command line, it doesn't work if you try to start it from NetBeans.

@jGauravGupta I'm using Netbeans 12.5, do you know if this fix has already been applied to Netbeans for the next version (12.6) ? Or maybe is there a JIRA ticket I can follow up to know about the status of this?

VM name support need to be added to the domain.xml parser in the IDE tools)

@jGauravGupta
Copy link
Contributor Author

PR to enable HotSwap JVM options in the Apache NetBeans: apache/netbeans#3259

@newk5
Copy link

newk5 commented Oct 23, 2021

Thanks! I'll keep an eye on it, hopefully it gets merged soon 👍

JamesHillyard pushed a commit to JamesHillyard/Payara that referenced this pull request Oct 28, 2021
FISH-5687/FISH-1467 Integrate HotSwap Agent in Payara Platform
JamesHillyard added a commit to JamesHillyard/Payara that referenced this pull request Dec 23, 2021
@mnyakushev
Copy link

Hello, I want to add custom plugin to hotswap agent.
According to this page I need register plugin package in hotswap-agent.properties.
Can I put hotswap-agent.properties file somewhere in Payara or JDK folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants