Skip to content
Snippets Groups Projects
Commit f5debcd1 authored by Emmanuel Bruno's avatar Emmanuel Bruno
Browse files

Merge branch 'feature/ear' into develop

parents 5f88ea4d d9501649
Branches
No related tags found
No related merge requests found
Showing
with 175 additions and 95 deletions
.idea .idea
README.md README.md
docker-compose.yml
.gitignore
*.log
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
1. COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up --build -d 1. COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up --build -d
2. Visit 2. Visit
1. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample 1. curl http://localhost:8080/restApp/sample
2. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/hello 2. curl http://localhost:8080/restApp/sample/hello
3. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/main 3. curl http://localhost:8080/restApp/sample/main
4. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons 4. curl http://localhost:8080/restApp/sample/persons
5. curl -H "Content-Type: application/json" \ 5. curl -H "Content-Type: application/json" \
-X POST \ -X POST \
-d '{"name":"Jeanne"}' \ -d '{"name":"Jeanne"}' \
http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons http://localhost:8080/restApp/sample/persons
6. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403 6. curl http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons/843c8236-6c6b-450e-9aa3-211a9b897403
7. curl -H "Accept: text/xml" http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons 7. curl -H "Accept: text/xml" http://localhost:8080/restApp-1.0-SNAPSHOT/resources/sample/persons
## Import "real" certificate ## Import "real" certificate
......
# syntax=docker/dockerfile:1.3 # syntax=docker/dockerfile:1.3
### First we build the application in docker in a controlled env ### First we build the application in docker in a controlled env
FROM maven:3.8.3-eclipse-temurin-11 as build FROM maven:3.8.4-eclipse-temurin-11 as build
WORKDIR /app WORKDIR /app
COPY ./ /app/ # COPY pom.xml /app/pom.xml
RUN --mount=type=cache,id=mvncache,target=/root/.m2/repository,rw \ COPY . /app/
mvn -B clean package
RUN --mount=type=cache,id=mvncache,target=/root/.m2/repository,rw \
mvn -B package
### Then we add the builded war to a JEE server. ### Then we add the builded war to a JEE server.
#FROM payara/server-full:5.2021.9-jdk11 as server #FROM payara/server-full:5.2021.9-jdk11 as server
...@@ -43,5 +44,7 @@ FROM server as production ...@@ -43,5 +44,7 @@ FROM server as production
# $DEPLOY_DIR # $DEPLOY_DIR
#COPY --from=build /app/jee/wsApp/target/*.war \ #COPY --from=build /app/jee/wsApp/target/*.war \
# $DEPLOY_DIR # $DEPLOY_DIR
COPY --from=build /app/jee/jsf/target/*.war \ #COPY --from=build /app/jee/jsf/target/*.war \
# $DEPLOY_DIR
COPY --from=build /app/jee/ear/target/*.ear \
$DEPLOY_DIR $DEPLOY_DIR
\ No newline at end of file
# FROM azul/zulu-openjdk:8u222 as mypayara # FROM azul/zulu-openjdk:8u222 as mypayara
#FROM eclipse-temurin:17-jdk #FROM eclipse-temurin:17-jdk
FROM eclipse-temurin:11-jdk FROM eclipse-temurin:11.0.13_8-jdk-focal
# Default payara ports to expose # Default payara ports to expose
# 4848: admin console # 4848: admin console
# 9009: debug port (JPDA) # 9009: debug port (JPDA)
# 8080: http # 8080: http
# 8181: https # 8181: https
EXPOSE 4848 9009 8080 8181 EXPOSE 4848 9009 8080 8181 8686
# Payara version (5.183+)
#ARG PAYARA_VERSION=5.2021.9 #ARG PAYARA_VERSION=5.2021.9
ARG PAYARA_VERSION=6.2021.1.Alpha1
ARG PAYARA_PKG=https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/${PAYARA_VERSION}/payara-${PAYARA_VERSION}.zip
#ARG PAYARA_SHA1=81c43f3c537ec74a813b48172758866615e1e792 #ARG PAYARA_SHA1=81c43f3c537ec74a813b48172758866615e1e792
ARG PAYARA_VERSION=6.2021.1.Alpha1
ARG PAYARA_SHA1=0262f8af7e52b318109ed43f8a31a1e93f111bbf ARG PAYARA_SHA1=0262f8af7e52b318109ed43f8a31a1e93f111bbf
ARG PAYARA_PKG=https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/${PAYARA_VERSION}/payara-${PAYARA_VERSION}.zip
ARG TINI_VERSION=v0.19.0 ARG TINI_VERSION=v0.19.0
# Initialize the configurable environment variables # Initialize the configurable environment variables
......
set-hazelcast-configuration --enabled=true --dynamic=true set-hazelcast-configuration --enabled=true --dynamic=true
add-library /tmp/h2.jar add-library /tmp/h2.jar
#create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH" My-H2-pool create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE" My-H2-pool
create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL" My-H2-pool #create-jdbc-connection-pool --datasourceclassname org.h2.jdbcx.JdbcDataSource --restype javax.sql.ConnectionPoolDataSource --property password=password:user=user:url="jdbc:h2:tcp://db:9092/payara;MODE=PostgreSQL" My-H2-pool
create-jdbc-resource --connectionpoolid My-H2-pool jdbc/my-h2-pool create-jdbc-resource --connectionpoolid My-H2-pool jdbc/my-h2-pool
# set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.cert-nickname=mycert # set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.cert-nickname=mycert
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
bean-discovery-mode="all">
</beans>
\ No newline at end of file
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<artifactId>maven-ejb-plugin</artifactId> <artifactId>maven-ejb-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<configuration> <configuration>
<ejbVersion>3.0</ejbVersion> <ejbVersion>3.1</ejbVersion>
<generateClient>true</generateClient> <generateClient>true</generateClient>
</configuration> </configuration>
</plugin> </plugin>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jee9.1</artifactId>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common-persistence</artifactId>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>entites</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jee9.1</artifactId>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>restApp</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>wsApp</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>jsf</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>dao</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>common-persistence</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>personManager</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<version>8</version>
<displayName>Person manager</displayName>
<!-- If I want maven to generate the application.xml, set this to true -->
<generateApplicationXml>true</generateApplicationXml>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
<skinnyWars>true</skinnyWars>
<modules>
<webModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>restApp</artifactId>
<!--bundleFileName>restApp.war</bundleFileName-->
</webModule>
<webModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>jsf</artifactId>
<!--bundleFileName>jsf.war</bundleFileName-->
</webModule>
<webModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>wsApp</artifactId>
<!--bundleFileName>wsApp.war</bundleFileName-->
</webModule>
<ejbModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId>
<!--bundleFileName>business.jar</bundleFileName-->
</ejbModule>
<jarModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>common-persistence</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
...@@ -13,25 +13,15 @@ ...@@ -13,25 +13,15 @@
<properties> <properties>
<primefaces.version>11.0.0-RC2</primefaces.version> <primefaces.version>11.0.0-RC2</primefaces.version>
<!--primefaces.version>11.0.0-SNAPSHOT</primefaces.version-->
<omnifaces.version>4.0-M12</omnifaces.version>
<all-themes.version>1.0.10</all-themes.version> <all-themes.version>1.0.10</all-themes.version>
</properties> </properties>
<!--repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>https://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories-->
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId> <groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId> <artifactId>business</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>ejb</type>
<!--type>ejb-client</type--> <!--type>ejb-client</type-->
</dependency> </dependency>
...@@ -41,40 +31,18 @@ ...@@ -41,40 +31,18 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/jakarta.faces/jakarta.faces-api -->
<dependency>
<groupId>jakarta.faces</groupId>
<artifactId>jakarta.faces-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<!--dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>${omnifaces.version}</version>
</dependency-->
<dependency> <dependency>
<groupId>org.primefaces</groupId> <groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId> <artifactId>primefaces</artifactId>
<version>${primefaces.version}</version> <version>${primefaces.version}</version>
<classifier>jakarta</classifier> <classifier>jakarta</classifier>
</dependency> </dependency>
<!--dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>${all-themes.version}</version>
</dependency-->
</dependencies> </dependencies>
<build> <build>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<h3 style="text-align: center"><h:outputText value="#{viewPersonBean.message}"/></h3> <h3 style="text-align: center"><h:outputText value="#{viewPersonBean.message}"/></h3>
<div class="card"> <div class="card">
<p:dataTable var="person" value="#{viewPersonBean.persons}"> <p:dataTable var="person" value="#{viewPersonBean.persons}" lazy="true">
<p:column headerText="UUID"> <p:column headerText="UUID">
<h:outputText value="#{person.uuid}"/> <h:outputText value="#{person.uuid}"/>
</p:column> </p:column>
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
<module>jsf</module> <module>jsf</module>
<module>restApp</module> <module>restApp</module>
<module>wsApp</module> <module>wsApp</module>
<module>ear</module>
<module>common-persistence</module>
</modules> </modules>
<dependencies> <dependencies>
...@@ -29,14 +31,6 @@ ...@@ -29,14 +31,6 @@
<artifactId>jakarta.jakartaee-api</artifactId> <artifactId>jakarta.jakartaee-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<groupId>fr.univtln.bruno.samples.jee91</groupId> <groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId> <artifactId>business</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>ejb</type>
<!--type>ejb-client</type--> <!--type>ejb-client</type-->
</dependency> </dependency>
......
...@@ -4,7 +4,7 @@ package fr.univtln.bruno.samples.jee91.rs; ...@@ -4,7 +4,7 @@ package fr.univtln.bruno.samples.jee91.rs;
import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application; import jakarta.ws.rs.core.Application;
@ApplicationPath("resources") @ApplicationPath("/")
public class JAXRSConfiguration extends Application { public class JAXRSConfiguration extends Application {
} }
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">
<persistence-unit name="myappPU" transaction-type="JTA">
<jta-data-source>jdbc/my-h2-pool</jta-data-source>
<class>fr.univtln.bruno.samples.jee91.dao.Person</class>
<properties>
<property name="jakarta.persistence.schema-generation.database.action" value="drop-and-create" />
<property name="jakarta.persistence.schema-generation.scripts.action" value="drop-and-create" />
<property name="jakarta.persistence.schema-generation.scripts.create-target" value="sampleCreate.ddl" />
<property name="jakarta.persistence.schema-generation.scripts.drop-target" value="sampleDrop.ddl" />
<property name="jakarta.persistence.sql-load-script-source" value="insert.sql" />
</properties>
</persistence-unit>
</persistence>
\ No newline at end of file
INSERT INTO "public"."person" ("name", "uuid") VALUES ('Yves', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870B25A000916801FE374FCFAC5DCF94C11');
INSERT INTO "public"."person" ("name", "uuid") VALUES ('Pierre', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870B8F28F7D3945291756DAC7325DF44938');
INSERT INTO "public"."person" ("name", "uuid") VALUES ('Marie', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F73745369674269747378709AA3211A9B897403843C82366C6B450E');
INSERT INTO "public"."person" ("name", "uuid") VALUES ('Jeanne', 'ACED00057372000E6A6176612E7574696C2E55554944BC9903F7986D852F0200024A000C6C65617374536967426974734A000B6D6F7374536967426974737870BC1580AEB48C0F0C0B3C82E884AA4C3C');
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<groupId>fr.univtln.bruno.samples.jee91</groupId> <groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId> <artifactId>business</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>ejb</type>
<!--type>ejb-client</type--> <!--type>ejb-client</type-->
</dependency> </dependency>
......
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">
<persistence-unit name="myappPU" transaction-type="JTA">
<jta-data-source>jdbc/my-h2-pool</jta-data-source>
<class>fr.univtln.bruno.samples.jee91.dao.Person</class>
</persistence-unit>
</persistence>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment