diff --git a/docker/Dockerfile b/docker/Dockerfile index b1872955b06e1de629af0c5cefd3e00743d2e5ad..d2dc7d62473dc018f28fbfbbc71a3e1b1f8bd07b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,8 +9,8 @@ RUN --mount=type=cache,id=mvncache,target=/root/.m2/repository,rw \ ### Then we add the builded war to a JEE server. -#FROM payara/server-full:5.2021.9-jdk11 as server -FROM brunoe/payara:jdk11-6 as server +FROM payara/server-full:5.2021.9-jdk11 as server +#FROM brunoe/payara:jdk11-6 as server ARG STORE_PASSWORD=changeit ## Download the JDBC driver @@ -43,5 +43,7 @@ FROM server as production # $DEPLOY_DIR #COPY --from=build /app/wsApp/target/*.war \ # $DEPLOY_DIR -COPY --from=build /app/jsf/target/*.war \ +#COPY --from=build /app/jsf/target/*.war \ +# $DEPLOY_DIR +COPY --from=build /app/ear/target/*.ear \ $DEPLOY_DIR \ No newline at end of file diff --git a/docker/payara/Dockerfile b/docker/payara/Dockerfile index 05665875fe4ed02f90440ff3b1b421cf46017b37..c0415edc2e9827ceda7b005e31e888d0405c2fba 100644 --- a/docker/payara/Dockerfile +++ b/docker/payara/Dockerfile @@ -8,13 +8,15 @@ FROM eclipse-temurin:11-jdk # 8181: https EXPOSE 4848 9009 8080 8181 -# Payara version (5.183+) #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_VERSION=6.2021.1.Alpha1 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 # Initialize the configurable environment variables diff --git a/ear/pom.xml b/ear/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d656870aa35789dabd003536230ee86b166f5b58 --- /dev/null +++ b/ear/pom.xml @@ -0,0 +1,95 @@ +<?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> + </dependencies> + + <build> + <finalName>personManager</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-ear-plugin</artifactId> + <version>3.2.0</version> + <configuration> + <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> + <contextRoot>/rest</contextRoot> + </webModule> + <webModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>jsf</artifactId> + <bundleFileName>jsf.war</bundleFileName> + <contextRoot>/jsf</contextRoot> + </webModule> + <webModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>wsApp</artifactId> + <bundleFileName>wsApp.war</bundleFileName> + <contextRoot>/ws</contextRoot> + </webModule> + <ejbModule> + <groupId>fr.univtln.bruno.samples.jee91</groupId> + <artifactId>business</artifactId> + <bundleFileName>business.jar</bundleFileName> + </ejbModule> + </modules> + </configuration> + </plugin> + </plugins> + </build> + + +</project> \ No newline at end of file diff --git a/jsf/src/main/resources/insert.sql b/ear/src/main/application/insert.sql similarity index 100% rename from jsf/src/main/resources/insert.sql rename to ear/src/main/application/insert.sql diff --git a/jsf/src/main/resources/META-INF/log4j.properties b/ear/src/main/application/log4j.properties similarity index 100% rename from jsf/src/main/resources/META-INF/log4j.properties rename to ear/src/main/application/log4j.properties diff --git a/restApp/src/main/resources/META-INF/persistence.xml b/ear/src/main/application/persistence.xml similarity index 92% rename from restApp/src/main/resources/META-INF/persistence.xml rename to ear/src/main/application/persistence.xml index 18fe3bac73127e9a827bed24e72d412c334bdcc5..98e834c17457047b4274b909e5a88cdd1e853f7d 100644 --- a/restApp/src/main/resources/META-INF/persistence.xml +++ b/ear/src/main/application/persistence.xml @@ -5,6 +5,7 @@ version="3.0"> <persistence-unit name="myappPU" transaction-type="JTA"> <jta-data-source>jdbc/my-h2-pool</jta-data-source> + <jar-file>lib/fr.univtln.bruno.samples.jee91-entites-1.0-SNAPSHOT.jar</jar-file> <class>fr.univtln.bruno.samples.jee91.dao.Person</class> <properties> diff --git a/entites/src/main/resources/META-INF/beans.xml b/entites/src/main/resources/META-INF/beans.xml index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..efd69bc2d38663ae2f69879265843f8ff04aac04 100644 --- a/entites/src/main/resources/META-INF/beans.xml +++ b/entites/src/main/resources/META-INF/beans.xml @@ -0,0 +1,5 @@ +<?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 diff --git a/jsf/pom.xml b/jsf/pom.xml index d5f2855adc5d82f07e03c3c5167b0e0b849000d3..ae4730cd39b79b5b54c46d085c16d0826fa00013 100644 --- a/jsf/pom.xml +++ b/jsf/pom.xml @@ -67,6 +67,13 @@ <artifactId>all-themes</artifactId> <version>${all-themes.version}</version> </dependency--> + + <dependency> + <groupId>org.glassfish</groupId> + <artifactId>jakarta.faces</artifactId> + <version>3.0.1</version> + </dependency> + </dependencies> <build> diff --git a/jsf/src/main/resources/META-INF/persistence.xml b/jsf/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index e900259cf5ea473bb81e5f25c9f8716ceb87f03f..0000000000000000000000000000000000000000 --- a/jsf/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?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> - <validation-mode>CALLBACK</validation-mode> - <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 diff --git a/pom.xml b/pom.xml index 7b344197500b639a8eace92c5927a761b8b3c160..03aa942867f0b47de61aef08cffff24cd3556c57 100644 --- a/pom.xml +++ b/pom.xml @@ -8,14 +8,19 @@ <modules> + <module>utils</module> + + <module>entites</module> + <module>dao</module> + <module>business</module> <module>restApp</module> - <module>wsApp</module> - <module>dao</module> - <module>wsClient</module> - <module>entites</module> - <module>utils</module> + <module>websocketApp</module> <module>jsf</module> + <module>ear</module> + + <module>websocketClient</module> + </modules> <packaging>pom</packaging> diff --git a/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java b/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java index ece5bca64f1f17fcfebc60078f3ad54573fa6e56..5e8e933a80afc176a4784d0f0af77724005c9064 100644 --- a/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java +++ b/restApp/src/main/java/fr/univtln/bruno/samples/jee91/rs/JAXRSConfiguration.java @@ -4,7 +4,7 @@ package fr.univtln.bruno.samples.jee91.rs; import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; -@ApplicationPath("resources") +@ApplicationPath("/") public class JAXRSConfiguration extends Application { } \ No newline at end of file diff --git a/restApp/src/main/resources/insert.sql b/restApp/src/main/resources/insert.sql deleted file mode 100644 index e74e7ffef4c148ef8820cf85f012ce24599f7e1f..0000000000000000000000000000000000000000 --- a/restApp/src/main/resources/insert.sql +++ /dev/null @@ -1,4 +0,0 @@ -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 diff --git a/wsApp/pom.xml b/websocketApp/pom.xml similarity index 100% rename from wsApp/pom.xml rename to websocketApp/pom.xml diff --git a/wsApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java b/websocketApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java similarity index 100% rename from wsApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java rename to websocketApp/src/main/java/fr/univtln/bruno/samples/jee91/ws/WSServer.java diff --git a/wsApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java b/websocketApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java similarity index 100% rename from wsApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java rename to websocketApp/src/test/java/fr/univtln/bruno/samples/SampleTest.java diff --git a/wsClient/pom.xml b/websocketClient/pom.xml similarity index 100% rename from wsClient/pom.xml rename to websocketClient/pom.xml diff --git a/wsClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java b/websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java similarity index 100% rename from wsClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java rename to websocketClient/src/main/java/fr/univtln/bruno/samples/jee91/wsclient/WsClient.java diff --git a/wsApp/src/main/resources/META-INF/log4j.properties b/websocketClient/src/main/resources/log4j.properties similarity index 100% rename from wsApp/src/main/resources/META-INF/log4j.properties rename to websocketClient/src/main/resources/log4j.properties diff --git a/wsApp/src/main/resources/META-INF/persistence.xml b/wsApp/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 2cc799781f7801097a6abc19442f1889451888fd..0000000000000000000000000000000000000000 --- a/wsApp/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?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 diff --git a/wsClient/src/main/resources/log4j.properties b/wsClient/src/main/resources/log4j.properties deleted file mode 100644 index b26344f037fddc8848b1789a4ef4b1f2be4ddb5c..0000000000000000000000000000000000000000 --- a/wsClient/src/main/resources/log4j.properties +++ /dev/null @@ -1,17 +0,0 @@ -log4j.rootLogger=debug, stdout, R - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout - -# Pattern to output the caller's file name and line number. -log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n - -log4j.appender.R=org.apache.log4j.RollingFileAppender -log4j.appender.R.File=wqClient.log - -log4j.appender.R.MaxFileSize=100KB -# Keep one backup file -log4j.appender.R.MaxBackupIndex=1 - -log4j.appender.R.layout=org.apache.log4j.PatternLayout -log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n \ No newline at end of file