Sunday, July 30, 2023

[java] [maven] [dropwizard] DropWizard HelloWorld API from scratch

[0] Preparation.

[1] Make project directory

[2] Create pom file

[3] Create source directory

[4] Complete the pom file

The full pom file would be as follows:

[5] Add Dropwizard files

  • Configuration Class File
  • Application Class File
  • Representation Class File
  • Resource Class File
  • Health Check Class File (optional)
  • Config File

[5.1] Configuration


[5.2] Application


[5.3] Representation


[5.4] Resource


[5.5] HealthCheck


[5.6] Config


[6] Compile and run

Read More

[java] [maven] [dropwizard] Running a Dropwizard application in IntelliJ IDEA, Eclipse and NetBeans


Dropwizard is a framework for building RESTful web services in Java. Similar to Spring Boot, Dropwizard applications are packaged into an executable fat JAR file. In addition to executing a Dropwizard application from the command line, you can increase your productivity by configuring your IDE to do that for you. I’m going to be looking at how to run a Dropwizard application in IntelliJ IDEA, Eclipse and NetBeans.

To execute a Dropwizard application, its main method needs to be called with the correct arguments. When you execute a JAR file from the command line, the JVM reads the entry point to your application from the MANIFEST.MF file. It contains key-value pairs and the key we’re interested in is Main-Class. In a Dropwizard application, this is set to your Applicaiton class.


Read More

[java] [maven] [dropwizard] Dropwizard with JDBI

[0] Preparation.

[1] Clone project

[2] Compile Maven project

Note: you may get error like "Blocked mirror for repositories". This is due to the use of unsecured http. Open pom.xml file and replace "http://" with "https://"

[3] Run migration (h2 database)

Note: you may get error like "Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException". This is due to the JAXB APIs considered to be Java EE APIs and therefore are no longer contained on the default classpath in Java SE 9. In Java 11, they are completely removed from the JDK.

Add the following codes to the dependency section of pom.xml file

[4] Run application

The application will be opened at port 8082 (refer below console output)

Read More

[java] [maven] [dropwizard] [mysql] Dropwizard on host with MySQL on docker

[0] Preparation.

[1] Clone project

[2] Change directory to the project root

[3] Compile Maven project

If you get error invalid target release 11, it could be that your java sdk is not 11. Install JDK 11 first and then set JAVA_HOME path for the JDK 11.

[4] Setup MySQL to run in Docker

Note:you may need to check the name of the container by running docker console command first.

docker ps

[5] Run migration

[6] Run application

[7] Test

[8] Check MySQL Database using container terminal

[9] Check MySQL Database using DBeaver on host

Read More

[java] [maven] [intellij] How to Write Unit Tests in Java

[0] preparation.

[1] Git clone project.

[2] Change directory to the project root.

[3] Open project using IntelliJ IDE.



follow the next steps at


Read More

[docker] [dockerhub] Create a new Docker Image, Run as Container

Start working in a new project directory.

Create demo index.html file.

Create Dockerfile and copy the index.html into the container. (save as .Dockerfile)

Build image.

Run container from image.

Read More

[docker] [dockerhub] Pull Docker Image from Docker Hub and Run it

Pull Image from Docker Hub.

Run the downloaded Docker Image & Access the Application.

Browse the application at http://localhost/hello.

Read More

Saturday, July 29, 2023

[java] [maven] [pom] what is Project Object Model (POM) file?


Maven projects, dependencies, builds, artifacts are modeled and described by an XML file called a Project Object Model. 

The POM tells Maven what sort of project it is dealing with and how to modify default behavior to generate output from source. 

In the same way a Java web application has a web.xml that describes, configures, and customizes the application, a Maven project is defined by the presence of a pom.xml. 

It is a descriptive declaration of a project for Maven; it is the figurative “map” that Maven needs to understand what it is looking at when it builds your project.


Maven: The Complete Reference - 3.2. The POM

Maven Getting Started Guide

Introduction to Maven

Read More

Friday, July 28, 2023

[java] [maven] [dropwizard] [docker] helloworld dropwizard-0-9-2 docker build and run

Note: the following notes is based on windows powershell environment

[0] Continue from the previous post


[1] Create Dockerfile at project root

[2] Build image

[3] Run container from image

[4] Browse the page.



Read More

[java] [maven] [dropwizard] helloworld dropwizard-0-9-2 from scratch

This exercise attempt to recreate the dropwizard helloworld app using PowerShell console, notepad, Java and Maven.

Note: the following notes is based on windows powershell environment

[1] make new project directory

[2] change directory to the project directory

[3] create pom file

[4] create source code directory

[5] change directory to source code directory

[6] create package directory

[7] change directory to package directory

[8] create java file (

[9] create java file (

[10] create java file in sub folder (resources/

[11] create java file in another sub folder (api/

create yml file at project root (hello-world.yml)

compile package

run jar file

Read More

[java] [maven] [dropwizard] helloworld dropwizard-0-9-2

Note: the following notes is based on windows powershell environment

[1] clone github repo

[2] change directory into the project directory

[3] get maven package

[4] run jar file

Read More

Wednesday, July 26, 2023

[docker] [minikube] Create a Deployment


[0] Create a minikube cluster


[1] Create a deployment

[1].Use the kubectl create command to create a Deployment that manages a Pod. The Pod runs a Container based on the provided Docker image.

[2].View the Deployment:

[3].View the Pod:

[4].View cluster events:

[5].View the kubectl configuration:

[2].Create a Service

[1].Expose the Pod to the public internet using the kubectl expose command:

[2].View the Service you created:

[3].Run the following command:





Read More

[docker] [minikube] installation



minikube installation requires hyper-v

however hyper-v may not be available on certain windows version e.g. windows 10 home edition

the following is the alternative approach using docker

[0] Run Docker

Run Docker as administrator

[1] Install minikube via Chocolatey

 minikube start --driver=docker

[2] Open Dashboard

minikube dashboard



Read More

[java] [maven] [dropwizard] HelloWorld demo REST service


[1] Clone DropWizard HelloWorld demo from github

git clone

[2] Build (maven) application

cd into the folder dropwizard-helloworld

run maven command

mvn package

[3] Run (java) application

java -jar target/dropwizard-helloworld-1.0-SNAPSHOT.jar server hello-world.yml

[4] Test via browser



Read More

[java] [maven] Create Your First Maven Project


[0] Pre-requisite

[0.1] Java

[0.2] Maven

[1] Create New Project

Select menu File/New/Project...

Type the name of the project

Click Create.

Maven will automatically create POM and Java file.

[2] Run

select menu Build/Build Project...

Alternatively, right-click file, select menu run

Read More

Monday, July 3, 2023

[laravel] [jetstream] installation

[1] Create Laravel project

Launch a terminal and run the following command:

[2] Install JetStream LiveWire Frontend Framework

After the project has been created, you can navigate to the application directory and start Laravel Sail:


Laravel Jetstream:

Read More

[laravel] [sail] [breeze] [bootcamp] chirper project setup

For Windows user:

The following command is linux-based which may not be properly executed under windows environment. It is recommended that Windows Subsystem for Linux (WSL) is installed and used for this exercise. Refer

[1] Get chirper docker project

Launch a terminal and run the following command:

[2] start project

After the project has been created, you can navigate to the application directory and start Laravel Sail:

When developing applications using Sail, you may execute Artisan, NPM, and Composer commands via the Sail CLI instead of invoking them directly:

[3] Installing Laravel Breeze

Open a new terminal in your chirper project directory and install your chosen stack with the given commands:

Breeze will install and configure your front-end dependencies for you, so we just need to start the Vite development server to automatically recompile our CSS and refresh the browser when we make changes to our Blade templates:

In case vite is injecting wrong url eg using ip address , add the server hrm entries in the vite.config.js file as follows:


Laravel Bootcamp:

Sail Service:

Read More