A memo when I tried "Talking about writing a Java application in Eclipse and publishing it in Kubernetes with a Liberty container (Part 1)"

I wondered what to do to containerize a little legacy thing, and when I tried it with reference to the following site, I stumbled on some, so make a note.

https://qiita.com/MahoTakara/items/1f2d160aeb129eec50ce#kuberntes%E3%81%A7%E3%81%AE%E5%8B%95%E4%BD%9C%E3%83%86%E3%82%B9%E3%83%88

(I'm really sorry for posting because it's a memo writing level. I learned a lot. I won't ask you to request editing!)

Notes

Things that people who are new to Docker tend to make mistakes

--If the target PC is used with VPN, an error will occur at minikube start and it will not start. When I used the Start command during a VPN connection with my Cisco Anyconnect, it failed to start with an error. --After running Libert in Eclipse or testing with Docker CE, if you do not drop Liberty as appropriate, it is difficult to analyze the cause because the site is running even though it should have been stopped, or it is not reflected even though it was corrected. To do. That's why amateurs are ... (self-deprecation). The docker stop command stops Docker.

Partial improvement of the program

Of the programs, ViewSessionObject.java seems to be slimy if param1 is not included, so I wrote a code to avoid nullpo with Try-catch. It's sloppy.

ViewSessionObject.java


        response.setContentType("text/plain; charset=UTF-8"); 
        PrintWriter out = response.getWriter(); 
        InetAddress ia = InetAddress.getLocalHost();
        out.println("Host Name = " + ia.getHostName());
        out.println("IPaddr    = " + ia.getHostAddress());
        try {
	        HttpSession session = request.getSession();
	        SessionObject so = (SessionObject)session.getAttribute("param1");
	        out.println("param1    = " + so.getParam1());
        }catch(Exception e) {
        	out.println("param1    = " + "null data");
        }
        //response.getWriter().append("Served at: ").append(request.getContextPath());

But I don't know how Liberty in Docker can tell if it's all loaded.

What are you guys doing when you test? .. I don't believe it's a shame to wait somehow. ..

Recommended Posts

A memo when I tried "Talking about writing a Java application in Eclipse and publishing it in Kubernetes with a Liberty container (Part 1)"
I wrote a Lambda function in Java and deployed it with SAM
I tried to modernize a Java EE application with OpenShift.
I tried OCR processing a PDF file with Java part2
I tried to make a machine learning application with Dash (+ Docker) part2 ~ Basic way of writing Dash ~
I tried to build a Firebase application development environment with Docker in 2020
I tried to make a talk application in Java using AI "A3RT"
Let's create a TODO application in Java 2 I want to create a template with Spring Initializr and make a Hello world
I tried to make a machine learning application with Dash (+ Docker) part3 ~ Practice ~
I built a Java EE environment on AWS and tried running a web application
When I tried to use a Wacom tablet with ubuntu 20.04, I didn't recognize it.
I tried to break a block with java (1)
I tried to create a shopping site administrator function / screen with Java and Spring
Create a Java (Gradle) project with VS Code and develop it on a Docker container
Let's create a TODO application in Java 11 Exception handling when accessing TODO with a non-existent ID
[Java] Precautions when referencing a reference type in a parent class and instantiating it in a child class
[Azure] I tried to create a Java application for free ~ Connect with FTP ~ [Beginner]
Create a Java (Maven) project with VS Code and develop it on a Docker container
I tried Mastodon's Toot and Streaming API in Java
I tried to create a Clova skill in Java
I tried to make a login function in Java
I tried OCR processing a PDF file with Java
What I learned when building a server in Java
[Java] A technique for writing constructors, getters, and setters in one shot with IntelliJ IDEA.
Easy to make LINE BOT with Java Servlet Part 2: I tried image messages and templates