Skip to content

Lozitsky/OSSRH-64309

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WEB JPA CDI EJB Archetype


Prepare the project structure. Define default folders and files.

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
Go to the folder of the created project and type:
mvn clean install
The archetype is created.

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
Create a new folder in the work directory and type:
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 

The project template is created and will be look like as follows:

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
Go to the folder of the created project and type:
mvn package

The 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
The following files will be attached to the war archive:
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

Run with TomEE APP Server

mvn package tomee:run

after 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/

Hello simple WebServlet!

Hello EJB!!

Hello CDI!!



web-ejb:1.0.1

\$ 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:run
http://localhost:8080/web-ejb/JNDIServlet

Task details

IDNameDescriptionStatusCreated dateLast modified date
1My first taskThe description of my first taskTODO2021-01-29 00:28:132021-01-29 00:28:13
2My second taskThe description of my second taskTODO2021-01-29 00:28:132021-01-29 00:28:13



web-ejb:1.0.2



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
Script Automatically builds a project and redirects to the default browser page
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
Click on the 'JNDIServlet' link

Task details

IDNameDescriptionStatusCreated dateLast modified date
1My first taskThe description of my first taskTODO2021-02-09 08:44:402021-02-09 08:44:40
2My second taskThe description of my second taskTODO2021-02-09 08:44:402021-02-09 08:44:40
3My first taskThe description of my first taskTODO2021-02-09 08:45:032021-02-09 08:45:03
4My second taskThe description of my second taskTODO2021-02-09 08:45:032021-02-09 08:45:03
5My first taskThe description of my first taskTODO2021-02-09 08:45:302021-02-09 08:45:30
6My second taskThe description of my second taskTODO2021-02-09 08:45:302021-02-09 08:45:30

About

WEB JPA CDI EJB Archetype. Startup inside Docker containers. Includes TomEE, Mysql, Adminer and hello-world container image.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published