Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the characteristics of Java technology stack

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "what are the characteristics of Java technology stack", the content of the explanation is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "what are the characteristics of Java technology stack"!

Java stack

How the War package is loaded under Tomcat or Jetty.

The classic delivery form of JAVA applications is WAR packages. There are two ways to deploy WAR packages using Tomcat or Jetty under Docker:

1. Put the WAR package in the Docker image: this benefit is that the resulting Docker image is self-contained, eliminating the need to publish a separate WAR package. Examples of Dockerfile are as follows:

FROM jetty:7.0

MAINTAINER xyz

ADD sample.* / usr/local/jetty/webapps/

The disadvantage of this approach is that each time the WAR package is updated, the Docker image needs to be rebuilt.

two。 Mount the WAR package as an external data volume: do not put the WAR package in the mirror. The advantage of this approach is that every time the WAR package is updated, the Docker image does not need to be updated. However, additional WAR package distribution mechanisms are required. Considering that there should be a WAR package distribution mechanism, this scheme may be more flexible and familiar. However, the disadvantage of this scheme is that the portability of Docker is damaged, because in each environment, there must be a WAR packet under the specified path of the host, so that Docker can mount it.

Sidecar mode released by JAVA

The concept of container groups in Caicloud ensures that containers in container groups can:

Run on the same host machine at all times

Share the same externally mounted data volume

These two features enable us to implement the following sidecar pattern:

This has achieved the benefit of killing two birds with one stone:

Because the WAR package of the application is not built into the Jetty container, the version management of the application and the middleware such as Jetty can be carried out separately. For example, if the version of Jetty needs to be upgraded, we do not need to rebuild N images (assuming there are N different applications or WAR packages).

On the other hand, by using sidecar to "move" the application WAR package, we don't have to worry about portability: as long as the app-sidecar container and the Jetty container are defined in a container group, Caicloud will ensure that the application War will always "run with the Jetty container."

Using Docker Jetty in development mode

The above method of using the War package is to use Docker as the carrier for software distribution. Sometimes developers also use Docker as the local development environment (local developers modify the code and run the current code locally in the form of Docker). It is important to note that if the local code files are added to the Docker image through COPY or ADD, then even if mvn jetty:run is used in Docker, mvn will not be able to reflect changes in local files and code in real time. One solution is to connect to the local code file by mounting the data volume.

Log in Docker Jetty mode

In non-Docker mode, the Jetty log is written to the specified location based on the Jetty configuration file, for example: / var/log/jetty. In Docker mode, for example, using the official Jetty image, the log file is completely cancelled, for example, in Dockerfile of Jetty 9.2.10: sed-I'/ jetty-logging/d' etc/jetty.conf

In this way, Jetty logs are written to standard output and are uniformly managed by Docker or Caicloud platforms.

Thank you for your reading, the above is the content of "what are the characteristics of Java technology stack". After the study of this article, I believe you have a deeper understanding of the characteristics of Java technology stack, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report