FROM jboss/wildfly:21.0.2.Final
RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin
ADD ./dockerfolder/backend/main/mysql-connector-java-8.0.13.jar /opt/jboss/wildfly/modules/com/mysql/driver/main/mysql-connector-java-8.0.13.jar
ADD ./dockerfolder/backend/main/module.xml /opt/jboss/wildfly/modules/com/mysql/driver/main/module.xml
ADD ./dockerfolder/backend/main/mysql-connector-java-8.0.13.jar /opt/jboss/wildfly/modules/com/mysql/driver/main/mysql-connector-java-8.0.13.jar
ADD ./dockerfolder/backend/main/module.xml /opt/jboss/wildfly/modules/com/mysql/driver/main/module.xml
ADD ./dockerfolder/backend/main/mysql-connector-java-8.0.13.jar /opt/jboss/wildfly/modules/system/layers/base/com/mysql/driver/main/mysql-connector-java-8.0.13.jar
ADD ./dockerfolder/backend/main/module.xml /opt/jboss/wildfly/modules/system/layers/base/com/mysql/driver/main/module.xml
COPY ./dockerfolder/backend/standalone.xml /opt/jboss/wildfly/standalone/configuration/standalone.xml
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql.driver">
<resources>
<resource-root path="mysql-connector-java-8.0.13.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
<subsystem xmlns="urn:jboss:domain:datasources:6.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:/MySqlDS" pool-name="MySqlDS">
<connection-url>jdbc:mysql://127.0.0.1:3306/Mydatabase</connection-url>
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>rootpassword</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql.driver">
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
at org.jboss.ironjacamar.jdbcadapters@1.4.23.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
... 35 more
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
at com.mysql.driver@8.0.13//com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
at org.jboss.ironjacamar.jdbcadapters@1.4.23.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
... 35 more
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
$ sudo docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name
sudo docker ps -a
sudo docker run --net host -p 8080:8080 -p 9990:9990 -d image-id
jdbc:mysql://127.0.0.1:3306/Mydatabase
version: "3.8"
services:
mysql_db:
image: mysql:8.0
networks:
- jsf-app-network
container_name: mysql_db
restart: always
volumes:
- ./database-initialization:/docker-entrypoint-initdb.d/
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=rootpassword
- MYSQL_DATABASE=Mydatabase
healthcheck:
test: mysql --user=root --password=rootpassword Mydatabase -e 'select count(*) from user;'
interval: 10s
timeout: 300s
retries: 10
api_service:
image: jboss/wildfly:21.0.2.Final
networks:
- jsf-app-network
container_name: api_service
build:
context: .
dockerfile: DockerfileJDK
restart: on-failure
ports:
- 8080:8080
- 9990:9990
environment:
MYSQL_USER: root
MYSQL_PASSWORD: rootpassword
MYSQL_DATABASE: Mydatabase
MYSQL_HOST: mysql_db
depends_on:
mysql_db:
condition: service_healthy
networks:
jsf-app-network:
external: false
name: jsf-app-network
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
cd /wildfly-21.0.2.Final/bin
./standalone.sh&
[standalone@localhost:9990 /] module add --name=com.mysql.driver --dependencies=javax.api,javax.transaction.api --resources=/PATH/TO/mysql-connector-java-8.0 .13.jar
/wildfly-21.0.2.Final/modules/system/layers/base/com/mysql/driver/main
/wildfly-21.0.2.Final/modules/com/mysql/driver/main
/wildfly-21.0.2.Final/modules/system/layers/base/com/mysql/driver/main
[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql/:add(driver-module-name=com.mysql.driver,driver-name=mysql,jdbc-compliant=false,driver-class- name=com.mysql.cj.jdbc.Driver)
<datasources>
<datasource >
...
</datasource>
<drivers>
...
<driver name="mysql" module="com.mysql.driver">
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
</driver>
</drivers>
</datasources>
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
|