-
Notifications
You must be signed in to change notification settings - Fork 23
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-8152 Micro Maven - Devmode - Store session state #284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tried to test with hot deploy activated I had this error when saving a file in the project: [2024-01-21T20:33:29.796-0300] [] [INFO] [] [PayaraMicro] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1705880009796] [levelValue: 800] Payara Micro 6 #badassmicrofish (build 883) ready in 10,351 (ms)
[ERROR]
org.openqa.selenium.NoSuchWindowException: no such window: target window already closed
from unknown error: web view not found
(Session info: chrome=120.0.6099.225)
Build info: version: '4.16.1', revision: '9b4c83354e'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.17'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [02f91b1e1549a23c4228fc400de8842a, executeScript {script=document.title = 'Building HelloDev-1.0-SNAPSHOT';, args=[]}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 120.0.6099.225, chrome: {chromedriverVersion: 120.0.6099.109 (3419140ab66..., userDataDir: C:\Users\luise\AppData\Loca...}, f
edcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:53213}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:53213/
devtoo..., se:cdpVersion: 120.0.6099.225, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 02f91b1e1549a23c4228fc400de8842a
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance (Constructor.java:490)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException (W3CHttpResponseCodec.java:200)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode (W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode (W3CHttpResponseCodec.java:52)
at org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:191)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute (DriverCommandExecutor.java:200)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:175)
at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:523)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript (RemoteWebDriver.java:468)
at fish.payara.maven.plugins.micro.AutoDeployHandler.updateTitle (AutoDeployHandler.java:350)
at fish.payara.maven.plugins.micro.AutoDeployHandler.run (AutoDeployHandler.java:200)
at java.lang.Thread.run (Thread.java:829)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm, Linux, OpenJDK 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This pull request enhances the Micro Maven plugin for Payara Micro by introducing a new configuration property, keepState. This property allows for the persistence of session state across multiple redeployments during the development process. By default, the
keepState
property is set tofalse
for thestart
mojo andtrue
for thedev
mojo.Use Case Testing
To validate this enhancement, a test servlet (NewServlet) has been created. The servlet utilizes the HttpSession to store and increment a session attribute ("count") with each request. The keepState property ensures that the session state is maintained across auto-reload processes, providing a seamless development experience for session-dependent functionalities.
Instructions for Testing
Build Payara Micro v5.59.0-SNAPSHOT:
https://github.com/payara/Payara-Enterprise/pull/1067
Create the Test Servlet:
Utilize the provided NewServlet class in your project.
This servlet handles GET requests, maintains a session count, and responds with the updated count.
Start Payara Micro Instance:
Use the following command to activate dev mode:
Alternatively, for auto-deploy with hot-deploy, use the following command:
The addition of the keepState property enhances the development workflow with the Micro Maven plugin, providing flexibility in managing session state persistence.
Depends on:
Payara Community 6 - payara/Payara#6526
Payara Enterprise 5 - https://github.com/payara/Payara-Enterprise/pull/1067
Payara Enterprise 6 - https://payara.atlassian.net/browse/FISH-8213