Docker with wildfly-jar-maven-plugin

83 views
Skip to first unread message

Adriano Aguiar

unread,
May 22, 2024, 2:14:05 PM5/22/24
to WildFly
I'm trying to build a system in Docker, but it doesn't respond. From the log, I see that when starting, it connects to the database and does not show any errors. However, I don't know if it needs any additional configuration. I'm using the wildfly-jar-maven-plugin and when I run the jar directly, it works normally. However, when placing the jar inside Docker, it does not respond. I would like to know if there is anything else that needs to be done. Below are docker configurations:


Dockerfile:

FROM openjdk:17-jdk-slim-buster

RUN mkdir -p /opt


COPY target/*.jar /opt/comercial-nfe-bootable.jar
EXPOSE 8080
CMD java -Xms${JAVA_XMS:-512m} -Xmx${JAVA_XMX:-3072m} -jar /opt/comercial-nfe-bootable.jar


version: '3.1'

services:
  api:
    image: comercial-2apex
    build: .
    environment:
      - POSTGRESQL_USER=postgres
      - POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD:-12345678}
      - POSTGRESQL_DATABASE=adriano
      - POSTGRESQL_DATASOURCE=comercialDS
      - POSTGRESQL_SERVICE_PORT=5432
      - POSTGRESQL_HOST=192.168.18.78
    ports:
      - 8080:8080
   
    networks:
      - comercial-2apex-network
     
    container_name: comercial-2apex
   
networks:
    comercial-2apex-network:
      driver: bridge

Jean Francois Denise

unread,
May 23, 2024, 4:45:18 AM5/23/24
to Adriano Aguiar, WildFly
Hi Adriano,
I suspect that it is a network issue. By default the server will listen on 127.0.0.1. Could you check your start log?
You can do it in 2 ways:
* Add the <cloud/> element to the plugin configuration
* Or, in your Dockerfile adds -b=0.0.0.0 when launching the jar

Hope that helps.
JF 

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/51c7bda2-e907-4947-b7b0-ad49af727a53n%40googlegroups.com.

Adriano Aguiar

unread,
May 23, 2024, 6:20:14 AM5/23/24
to Jean Francois Denise, WildFly
Thanks Jean, I managed to solve it by running this script: /interface=public:write-attribute(name=inet-address,value=0.0.0.0)
--
Adriano Aguiar
Desenvolvedor em Tecnologia da Informação
Desenvolvimento Web (PHP, Javascript, AJAX, Java EE, JSP);
Frameworks ( jQuery, JSF)
Arquiteto de Sistemas (UML, RUP)
Administrador e Programador em SGDB (Oracle PL/SQL, MySQL, SQL ANSI, PostgreSQL);
Servidores de Aplicações (Apache, Tomcat e Glassfish);

Jean Francois Denise

unread,
May 23, 2024, 7:15:17 AM5/23/24
to Adriano Aguiar, WildFly
Adriano,
you found a nice alternate solution. To give context to readers, the WildFly Bootable JAR Maven Plugin allows you to execute CLI scripts to fine tune your config once the server has been provisioned and 
prior to creating the executable jar file. You can find information in the Bootable JAR documentation: http://docs.wildfly.org/bootablejar/#wildfly_jar_configuring_build_cli

JF

Adriano Aguiar

unread,
May 23, 2024, 7:34:53 AM5/23/24
to Jean Francois Denise, WildFly
Thanks for the link, that's where I was able to see the solution and now my system is perfect using wildfly Multi Tenant
Reply all
Reply to author
Forward
0 new messages