Hi Logo,

On Thu, Jan 9, 2020 at 7:40 PM logo <l...@kreuser.name> wrote:

> Hi Alex,
>
>
>
> > Am 09.01.2020 um 17:51 schrieb Alex K <rightkickt...@gmail.com>:
> >
> > Hi all,
> >
> > I have two .war files that when deployed at a plain Debian 9 VM are
> working
> > fine.
> > I have prepared a docker file so as to deploy the same apps within a
> docker
> > container and for some reason one of the apps is not loading due to some
> > error.
> >
> > Dockerfile:
> > FROM debian:latest
>
> Why not using any of the different flavored tomcat images?
>
Tried to to that but I failed also with some other errors. Also I tried to
build the official tomcat image so as to change the default tomcat home
dir, as I wanted to be /opt/tomcat instead of /usr/local/tomcat. I will try
again to use such tomcat images, as going from scratch with debian it gives
me approx 1 GB image size which is somehow big to deploy.


> https://hub.docker.com/_/tomcat <https://hub.docker.com/_/tomcat>
>
> You get a working jdk (oracle, adopt, openjdk) and don’t have to build the
> system yourself.
> That may help to get the base running and then copy your file to the
> correct spots.
>
>
> > USER root
> >
> > ENV CATALINA_HOME /opt/tomcat
> > ENV PATH $CATALINA_HOME/bin:$PATH
> > RUN mkdir -p "$CATALINA_HOME"
> > WORKDIR $CATALINA_HOME
> >
> > # Install packages
> > RUN apt update && apt install default-jdk -y && groupadd tomcat &&
> useradd
> > -s /bin/false -g tomcat -d $CATALINA_HOME tomcat
> > COPY apache-tomcat-8.5.50.tar.gz /tmp/
> >
> > RUN tar xzvf /tmp/apache-tomcat-8.5.50.tar.gz -C /opt/tomcat
> > --strip-components=1
> >
> > ADD app.war $CATALINA_HOME/webapps/
> > ADD orbeon.war $CATALINA_HOME/webapps/
> > ADD server.xml $CATALINA_HOME/conf/
> > ADD web.xml $CATALINA_HOME/conf/
> > ADD mariadb-java-client-2.4.1.jar $CATALINA_HOME/lib
> > ADD setenv.sh $CATALINA_HOME/bin/
> >
> > RUN chgrp -R tomcat $CATALINA_HOME && \
> >    chown -R tomcat webapps/ work/ temp/ logs/ && \
> >    chmod -R g+r conf && \
> >    chmod g+x conf && \
> >    chmod 750 $CATALINA_HOME/bin/setenv.sh && \
> >    rm -f /tmp/apache-tomcat-8.5.50.tar.gz;
> >
> > EXPOSE 8443
> > CMD ["catalina.sh", "run"]
> >
> > I have tried also several other ways, by using directly other docker
> tomcat
> > images everytime resulting with some error.
> >
> > The error I am getting now is:
> >
> > 10:21:32.201 WARN  c.h.c.c.s.CubaXmlWebApplicationContext  - Exception
> > encountered during context initialization - cancelling refresh attempt:
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name 'org.springframework.security.filterChains': Cannot
> resolve
> > reference to bean
> > 'org.springframework.security.web.DefaultSecurityFilterChain#0' while
> > setting bean property 'sourceList' with key [0]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name
> > 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot
> > create inner bean '(inner bean)#27690bd5' of type
> >
> [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]
> > while setting constructor argument with key [4]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name '(inner bean)#27690bd5': Cannot resolve reference to bean
> > 'clientAuthenticationEntryPoint' while setting constructor argument;
> nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> Error
> > creating bean with name 'clientAuthenticationEntryPoint' defined in class
> > path resource [com/haulmont/addon/restapi/rest-dispatcher-spring.xml]:
> > Instantiation of bean failed; nested exception is
> > org.springframework.beans.BeanInstantiationException: Failed to
> instantiate
> >
> [org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint]:
> > Constructor threw exception; nested exception is
> > java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
> > 10:21:32.243 ERROR c.h.a.r.a.r.RestAPIDispatcherServlet    - Context
> > initialization failed
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name 'org.springframework.security.filterChains': Cannot
> resolve
> > reference to bean
> > 'org.springframework.security.web.DefaultSecurityFilterChain#0' while
> > setting bean property 'sourceList' with key [0]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name
> > 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot
> > create inner bean '(inner bean)#27690bd5' of type
> >
> [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]
> > while setting constructor argument with key [4]; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name '(inner bean)#27690bd5': Cannot resolve reference to bean
> > 'clientAuthenticationEntryPoint' while setting constructor argument;
> nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> Error
> > creating bean with name 'clientAuthenticationEntryPoint' defined in class
> > path resource [com/haulmont/addon/restapi/rest-dispatcher-spring.xml]:
> > Instantiation of bean failed; nested exception is
> > org.springframework.beans.BeanInstantiationException: Failed to
> instantiate
> >
> [org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint]:
> > Constructor threw exception; nested exception is
> > java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
> >
> >
>
> javax.xml.bind libs are no longer bundled from JDK 11 onwards. You have to
> add them to the (WEB-INF/) lib directory yourself ...
>
It seems I had a version issue. Using debian:latest at Dockerfile was
deploying the Debian 10 instead of 9, where I initially tested the app.

Using the following docker file I was able to successfully deploy:

FROM debian:stretch
USER root

ENV CATALINA_HOME /opt/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME

# Install packages
RUN apt update && apt install default-jdk -y && groupadd tomcat && useradd
-s /bin/false -g tomcat -d $CATALINA_HOME tomcat
COPY iforms_files/apache-tomcat-8.5.50.tar.gz /tmp/

RUN tar xzvf /tmp/apache-tomcat-8.5.50.tar.gz -C /opt/tomcat
--strip-components=1

ADD iforms_files/app.war $CATALINA_HOME/webapps/
ADD iforms_files/orbeon.war $CATALINA_HOME/webapps/
ADD iforms_files/server.xml $CATALINA_HOME/conf/
ADD iforms_files/mariadb-java-client-2.4.1.jar $CATALINA_HOME/lib
ADD iforms_files/setenv.sh $CATALINA_HOME/bin/

RUN chgrp -R tomcat $CATALINA_HOME && \
    chown -R tomcat webapps/ work/ temp/ logs/ && \
    chmod -R g+r conf && \
    chmod g+x conf && \
    chmod 750 $CATALINA_HOME/bin/setenv.sh && \
    rm -f /tmp/apache-tomcat-8.5.50.tar.gz;

EXPOSE 8443
CMD ["catalina.sh", "run"]


> With the above tomcat images you could also go back to an older JDK (9 or
> even 8).
>
> > Since I am not very familiar with tomcat, I would appreciate any pointers
> > how to troubleshoot this.
> >
> > Thanx,
> > Alex
>
> Peter
>
>

Reply via email to