JakartaEE

Successor of JavaEE/JEE that moved to Eclipse. The packages names moved from javax to jakarta..

Jakarta EE 10 - run in docker

Go to https://start.jakarta.ee/ and generate a starter zip with:

   1 cd ~/Downloads/
   2 mv jakartaee-hello-world.zip /tmp/
   3 cd /tmp/
   4 unzip jakartaee-hello-world.zip 
   5 cd jakartaee-hello-world/
   6 mvn -version     
   7 # Apache Maven 3.6.3
   8 sudo apt install openjdk-17-jdk
   9 java -version
  10 # openjdk version "17.0.6" 2023-01-17
  11 mvn clean install
  12 docker build -t jee-image .
  13 docker run -d --rm -p 8080:8080 -p 9990:9990 --name app jee-image
  14 docker exec -it app bash 
  15 cd /opt/jboss/wildfly/bin
  16 sh add-user.sh admin admin
  17 # Updated user 'admin' to file '/opt/jboss/wildfly/standalone/configuration/mgmt-users.properties'
  18 # Updated user 'admin' to file '/opt/jboss/wildfly/domain/configuration/mgmt-users.properties'
  19 Open http://localhost:9990/console/index.html
  20 exit 
  21 curl http://localhost:8080/jakartaee-hello-world/rest/hello?name=userx
  22 # {"hello":"userx"}
  23 curl http://localhost:8080/jakartaee-hello-world/
  24 
  25 docker exec -it app bash
  26 java -version
  27 # openjdk version "17.0.7" 2023-04-18
  28 pwd
  29 /opt/jboss/wildfly
  30 find . -name *war
  31 #./standalone/tmp/jakartaee-hello-world.war
  32 #./standalone/deployments/jakartaee-hello-world.war
  33 exit
  34 # http://localhost:9990/console/index.html#standalone-server
  35 # Product Name WildFly Full
  36 # Product Version 28.0.1.Final
  37 

Change code

In src/main/java/org/eclipse/jakarta/hello/HelloWorldResource.java change @Path("hello") to @Path("helloworld") .

In src/main/webapp/index.html change rest/hello to rest/helloworld .

   1 mvn clean install 
   2 docker cp target/jakartaee-hello-world.war app:/opt/jboss/wildfly/standalone/deployments/jakartaee-hello-world.war
   3 # http://localhost:8080/jakartaee-hello-world/rest/helloworld
   4 # http://localhost:8080/jakartaee-hello-world/rest/helloworld?name=aaa
   5 

Java/JakartaEE (last edited 2023-05-26 09:44:20 by 127)