archetype_root ├── pom.xml ├── README.md ├── src │ └── main │ └── resources │ ├── archetype-resources │ │ ├── bash.sh │ │ ├── Dockerfile │ │ ├── pom.xml │ │ ├── README.md │ │ ├── src │ │ │ ├── injection │ │ │ │ ├── HelloBean.java │ │ │ │ ├── HelloPojo.java │ │ │ │ └── Servlet.java │ │ │ └── META-INF │ │ │ └── persistence.xml │ │ └── web │ │ └── WEB-INF │ │ ├── beans.xml │ │ ├── META-INF │ │ │ ├── ejb-jar.xml │ │ │ └── MANIFEST.MF │ │ └── web.xml │ └── META-INF │ └── maven │ └── archetype-metadata.xml
mvn clean install
The following files will be created in the .m2 repository:
└── kirilo └── web-ejb ├── 1.0.0 │ ├── _remote.repositories │ ├── web-ejb-1.0.0.jar │ └── web-ejb-1.0.0.pom └── maven-metadata-local.xml
mvn archetype:generate \ -DarchetypeGroupId=com.github.Lozitsky \ -DarchetypeArtifactId=web-ejb \ -DarchetypeVersion=1.0.0 \ -DgroupId=com.kirilo.webejb \ -DartifactId=web-ejb \ -Dversion=1.0-SNAPSHOT \ -DinteractiveMode=false -X
new_project └── web-ejb ├── bash.sh ├── db ├── Dockerfile ├── pom.xml ├── README.md ├── src │ ├── com │ │ └── kirilo │ │ └── webejb │ │ └── injection │ │ ├── HelloBean.java │ │ ├── HelloPojo.java │ │ └── Servlet.java │ └── META-INF │ └── persistence.xml ├── test │ └── com │ └── kirilo │ └── webejb └── web └── WEB-INF ├── beans.xml ├── META-INF │ ├── ejb-jar.xml │ └── MANIFEST.MF └── web.xml
mvn packageThe following files will be added to the project into target folder:
target ├── classes │ └── com │ └── kirilo │ └── webejb │ └── injection │ ├── HelloBean.class │ ├── HelloPojo.class │ └── Servlet.class ├── generated-sources │ └── annotations ├── maven-archiver │ └── pom.properties ├── maven-status │ └── maven-compiler-plugin │ └── compile │ └── default-compile │ ├── createdFiles.lst │ └── inputFiles.lst ├── web-ejb-1.0-SNAPSHOT │ ├── META-INF │ └── WEB-INF │ ├── beans.xml │ ├── classes │ │ ├── com │ │ │ └── kirilo │ │ │ └── webejb │ │ │ └── injection │ │ │ ├── HelloBean.class │ │ │ ├── HelloPojo.class │ │ │ └── Servlet.class │ │ └── META-INF │ │ └── persistence.xml │ ├── META-INF │ │ ├── ejb-jar.xml │ │ └── MANIFEST.MF │ └── web.xml └── web-ejb.war
web-ejb.war ├── META-INF └── WEB-INF ├── beans.xml ├── classes │ ├── com │ │ └── kirilo │ │ └── webejb │ │ └── injection │ │ ├── HelloBean.class │ │ ├── HelloPojo.class │ │ └── Servlet.class │ └── META-INF │ └── persistence.xml ├── META-INF │ ├── ejb-jar.xml │ └── MANIFEST.MF └── web.xml
mvn package tomee:runafter typing in the terminal
curl localhost:8080/web-ejb/we will receive:
<html><body><h1>Hello simple WebServlet!</h1><h1>Hello EJB!!</h1><h1>Hello CDI!!</h1></body></html>Or type in the browser:
localhost:8080/web-ejb/
\$ cd archetype-root \$ mvn clean install \$ cd new_project \$ mvn archetype:generate \ -DarchetypeGroupId=com.github.Lozitsky \ -DarchetypeArtifactId=web-ejb \ -DarchetypeVersion=1.0.1 \ -DgroupId=com.kirilo.webejb \ -DartifactId=web-ejb \ -Dversion=1.0-SNAPSHOT \ -DinteractiveMode=false -X \$ cd web-ejb \$ mvn clean package tomee:runhttp://localhost:8080/web-ejb/JNDIServlet
ID Name Description Status Created date Last modified date 1 My first task The description of my first task TODO 2021-01-29 00:28:13 2021-01-29 00:28:13 2 My second task The description of my second task TODO 2021-01-29 00:28:13 2021-01-29 00:28:13
Startup inside Docker containers. Created by docker-compose.yml Added scripts for building a project and creating containers inside Docker. When done, the script redirects to the default browser page with JNDI information. After a few minutes, when the data source is ready, servlet will display information about the data source and create a link to a servlet with data from the database. Includes TomEE, Mysql, Adminer and hello-world container image
\$ cd archetype-root \$ mvn clean install \$ cd new_project \$ mvn archetype:generate \ -DarchetypeGroupId=com.github.Lozitsky \ -DarchetypeArtifactId=web-ejb \ -DarchetypeVersion=1.0.2.2 \ -DgroupId=com.kirilo \ -DartifactId=web_ejb \ -Dversion=1.0-SNAPSHOT \ -DinteractiveMode=false -X \$ cd web_ejb/infrastructure \$ sh mvn-clean-build-up.sh
org.apache.naming.NamingContext = comp Name "Resource/comp/ValidatorFactory" not found. org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager = TransactionManager org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager = TransactionSynchronizationRegistry java.lang.String = ComponentName Name "Resource/comp/BeanManager" not found. Name "Resource/comp/Validator" not found. org.apache.naming.NamingContext = com.kirilo.injection.Servlet com.kirilo.injection.HelloBean$$LocalBeanProxy = bean org.apache.openejb.resource.jdbc.managed.local.ManagedDataSource = MySQLDataSource MySQL is not ready. Please wait a few minutes... Try the command: 'docker ps' to check the health of the mysql container. Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Elapsed time: 0m 0s org.apache.naming.NamingContext = module java.lang.String = ModuleName Current Time is: 0:3:23 PM
org.apache.naming.NamingContext = comp Name "Resource/comp/ValidatorFactory" not found. org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager = TransactionManager org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager = TransactionSynchronizationRegistry java.lang.String = ComponentName Name "Resource/comp/BeanManager" not found. Name "Resource/comp/Validator" not found. org.apache.naming.NamingContext = com.kirilo.injection.Servlet com.kirilo.injection.HelloBean$$LocalBeanProxy = bean org.apache.openejb.resource.jdbc.managed.local.ManagedDataSource = MySQLDataSource - JDBC Connection is valid - URL: 'jdbc:mysql://db:3306/web_ejb?useSSL=false' - DatabaseProductName: 'MySQL' - DriverName: 'MySQL Connector/J' - DriverVersion: 'mysql-connector-java-8.0.21 (Revision: 33f65445a1bcc544eb0120491926484da168f199)' - UserName: 'admin_db@172.25.0.3' JNDIServlet Adminer Total load time: 1m 6s org.apache.naming.NamingContext = module java.lang.String = ModuleName Hello Servlet Current Time is: 0:5:23 PM
ID Name Description Status Created date Last modified date 1 My first task The description of my first task TODO 2021-02-09 08:44:40 2021-02-09 08:44:40 2 My second task The description of my second task TODO 2021-02-09 08:44:40 2021-02-09 08:44:40 3 My first task The description of my first task TODO 2021-02-09 08:45:03 2021-02-09 08:45:03 4 My second task The description of my second task TODO 2021-02-09 08:45:03 2021-02-09 08:45:03 5 My first task The description of my first task TODO 2021-02-09 08:45:30 2021-02-09 08:45:30 6 My second task The description of my second task TODO 2021-02-09 08:45:30 2021-02-09 08:45:30