0

1.I have a very strange error in my web application, I will describe my environment soon after I describe the error better

  • Docker image: tomcat:9.0-jdk11
  • My location: pt_BR
  • class(ICU4j): com.ibm.icu.text.DateFormat
  1. Expected date formats:
  • 07/11/2022 - SHORT
  • 7 de nov. de 2022 - MEDIUM
  • 7 de novembro de 2022 - LONG
  • segunda-feira, 7 de novembro de 2022 - FULL
  1. The Problem: I have a report issuer using birt 4.10, when I migrated to docker I came across a problem where it seems that my dates are coming with the pt_PT pattern, different from the expected ones as mentioned in item 2, examples:
  • SHORT "07/11/22"
  • MEDIUM "07/11/2022"
  • LONG and FULL return me right
  1. I have already made the following attempts:
  • directly in the source I added a Locale.setDefault(new Locale("pt_BR"))
  • in the docker container I added the following lines in the dockerfile:
RUN apt update && apt install -y locales
RUN locale-gen --purge "pt_BR.UTF-8"
RUN echo -e 'LANG="pt_BR.UTF-8"\nLANGUAGE="pt_BR:pt:en"\nLC_ALL="pt_BR.UTF-8"\n' > /etc/default/locale

ENV LANG=pt_BR.UTF-8  
ENV LANGUAGE=pt_BR:pt:en
ENV LC_ALL=pt_BR.UTF-8
  • Return of the locale command in the container:
LANG=pt_BR.UTF-8
LANGUAGE=pt_BR:pt:en
LC_CTYPE="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_PAPER="pt_BR.UTF-8"
LC_NAME="pt_BR.UTF-8"
LC_ADDRESS="pt_BR.UTF-8"
LC_TELEPHONE="pt_BR.UTF-8"
LC_MEASUREMENT="pt_BR.UTF-8"
LC_IDENTIFICATION="pt_BR.UTF-8"
LC_ALL=pt_BR.UTF-8

I created a project that uses the same class and compiled a .jar ran it in the container and it returned the right format

I noticed that this only happens with my .war

Please help me I don't know what else to do

My dockerfile:

FROM tomcat:9.0-jdk11
# #--------------------------------------------------instalação das fontes--------------------------------------------------

RUN mkdir /root/downloads
RUN mkdir -p /opt/ipm/
RUN mkdir -p /usr/X11R6/lib/X11/fonts/truetype/
#Na pasta donwloads do servidor de testes esta o arquivo .gz
WORKDIR /root/downloads
RUN wget https://domain.restrict/updates/fonts.tar.gz
RUN tar -xzvf /root/downloads/fonts.tar.gz
RUN mv /root/downloads/fonts/truetype/* /usr/X11R6/lib/X11/fonts/truetype/
RUN ln -s /usr/X11R6/lib/X11/fonts/truetype/ /usr/share/fonts/custom
RUN fc-cache /usr/share/fonts/

RUN mv /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps/
RUN rm /usr/local/tomcat/'webapps.dist' -r

RUN apt update && apt install -y locales
RUN locale-gen --purge "pt_BR.UTF-8"
RUN echo -e 'LANG="pt_BR.UTF-8"\nLANGUAGE="pt_BR:pt:en"\nLC_ALL="pt_BR.UTF-8"\n' > /etc/default/locale

ENV LANG=pt_BR.UTF-8  
ENV LANGUAGE=pt_BR:pt:en
ENV LC_ALL=pt_BR.UTF-8
WORKDIR /usr/testes

CMD ["catalina.sh" "run"]

0 Answers0