Recently, I need to maintain and deploy multiple versions of the same application on the same server (each with different customizations based on customer’s need).
Could you please advise on how to achieve this?
More specifically:
Shall I have different Jetty instances or just different “jetty base” directories each belonging to one version?
How to start specific versions and stop others?
Any possible drawbacks or conflicts by doing multiple live deployments on the same server?
Shall I have different Jetty instances or just different “jetty base” directories each belonging to one version
Application configuration (JNDI resources, JVM properties) is stored in the “jetty-base” directory. So you should create different “jetty base” directories for each version.
How to start specific versions and stop others?
You can navigate to the “jetty-base” directory for the specific application version and run:
java -jar c:\work\jetty-home\start.jar
You can stop specific version:
By "kill" command in the Unix-like systems
Or using stop port https://wiki.eclipse.org/Jetty/Howto/Secure_Termination
Any possible drawbacks or conflicts by doing multiple live deployments on the same server?
You should specify different HTTP ports for each application version. Also “app.home” property (specified on the step 8 Deployment in WAR - CUBA Platform. Developer’s Manual) must be unique for each application version.
I followed above steps, and currently have 2 “jetty-base” folders for each of the 2 versions I deployed.
I have modified start.ini in each version, so that each uses different ports. (I have uncommented jetty.http.port and also changed the port in agentlib so that I can launch both versions at the same time).
When I start both versions by running “java -jar c:\work\jetty-home\start.jar” in the specific application version, I have no issue. Both start successfully and I got the login screen of each version.
However, when I click on login, I get the following error:
ERROR [qtp31705400-15] com.haulmont.cuba.web.AppUI - Unable to init ui
org.springframework.remoting.RemoteConnectFailureException: Could not connect to HTTP invoker remote service at [cuba_LoginService]; nested exception is java.net.ConnectException: Connection refused: connect
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:206) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:147) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
[qtp31705400-60] com.haulmont.cuba.web.AppUI - Unable to init ui
org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [cuba_LoginService];
nested exception is java.io.StreamCorruptedException: invalid stream header: 3C21646F
at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:226)
Note that now when I start the first app (running on default port 8080), I have no issue.
However, when I start the second app, I got above issue, and then both app fail. (the running one stops working).
Clearly, there is still some conflict between the 2 apps.
Also, note that I have added the below to build WAR as per your suggestion:
Please change a cuba.connectionUrlList property in the buildWar task to http://localhost:8081/billing-core. It’s an URL for core WAR module in the qdc application.
Thanks for pointing this out.
Finally, both instances are starting successfully now.
However, I am getting randomly (almost every few seconds) a “session expired issue” in each instance: Session Expired, Pay attention to any unsaved data, and click here to continue.
Then I have to click to resume working.
Could this be due to the fact that both instances have the same app name: billing?