I did everythin' like in Spring documentation to deploy my app on AWS. But got an error:
deploy-demo.service: Failed at step EXEC spawning /opt/deploy-demo/deploy-demo.jar: Exec format error
Sep 07 21:22:10 ip-172-31-45-166 systemd[1]: deploy-demo.service: Main process exited, code=exited, status=203/EXEC
My deploy-demo.service file located in /etc/systemd/system/deploy-demo.service with settings:
[Unit]
Description=deploy-demo
After=syslog.target
[Service]
User=gitlab-runner
ExecStart=/opt/deploy-demo/deploy-demo.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
deploy-demo.jar and deploy-demo.conf located in /opt/deploy-demo/
deploy-demo.conf file contains
RUN_ARGS="--spring.datasource.url=jdbc:postgresql://here_is_should_be_my_host:5432/helpfast --spring.datasource.username=postgres --spring.datasource.password=adminadmin"
All permissions seems to me correct:
drwxr-xr-x 2 gitlab-runner gitlab-runner 4096 Sep 7 21:21 ./
drwxr-xr-x 3 root root 4096 Sep 7 20:31 ../
-r-------- 1 gitlab-runner gitlab-runner 200 Sep 7 21:21 deploy-demo.conf
-r-x------ 1 gitlab-runner gitlab-runner 42645024 Sep 7 20:31 deploy-demo.jar*
Any ideas are highly appreciated!
Related
I have this java file, it has to be executed using the following command otherwise it defaults to ipv6 and effectively useless for my use-case
-jar Djava.net.preferIPv4Stack=true EdOwl-Springboot.jar
I tried following this guide: https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/
However using this shows:
root#edowl:~# systemctl status EdOwl-Springboot.service
● EdOwl-Springboot.service - EdowlSpringboot
Loaded: loaded (/etc/systemd/system/EdOwl-Springboot.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2022-02-22 11:28:26 UTC; 10s ago
Main PID: 186854 (code=exited, status=203/EXEC)
Tasks: 0 (limit: 614)
Memory: 0B
CGroup: /system.slice/EdOwl-Springboot.service
Feb 22 11:28:36 edowl.online systemd[1]: EdOwl-Springboot.service: Scheduled restart job, restart counter is at 125919.
Feb 22 11:28:36 edowl.online systemd[1]: Stopped EdowlSpringboot.
Feb 22 11:28:36 edowl.online systemd[1]: Started EdowlSpringboot.
Feb 22 11:28:36 edowl.online systemd[186888]: EdOwl-Springboot.service: Failed to execute command: No such file or directory
Feb 22 11:28:36 edowl.online systemd[186888]: EdOwl-Springboot.service: Failed at step EXEC spawning /bin/java: No such file or directory
Feb 22 11:28:36 edowl.online systemd[1]: EdOwl-Springboot.service: Main process exited, code=exited, status=203/EXEC
Feb 22 11:28:36 edowl.online systemd[1]: EdOwl-Springboot.service: Failed with result 'exit-code'.
the service file is as follows:
[Unit]
Description=EdowlSpringboot
[Service]
WorkingDirectory=/home
ExecStart=/bin/java -Xms128m -Xmx256m -jar Djava.net.preferIPv4Stack=true EdOwl-Springboot.jar
Type=simple
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
The file is located in the /home dir
I am certain it is the exec start line that is messing this up, is it necessary to state: /bin/java -Xms128m -Xmx256mor am I messing up something else here?
Suggestions are welcome cheers
The JVM argument java.net.preferIPv4Stack should be prefixed with -D instead you have D
Also, as others pointed out in comments check your java path it might be /usr/bin/java.
So, change the command to /usr/bin/java -Xms128m -Xmx256m -jar -Djava.net.preferIPv4Stack=true EdOwl-Springboot.jar
We've got a Java application that generates word documents using a 3rd party (Asposee but I don't think it matters here). The app is built from a simple Docker file:
FROM openjdk:10-jdk-slim
COPY target/*.jar /opt/
CMD $JAVA_HOME/bin/java $JAVA_OPTS -jar /opt/*.jar
When we build the application locally (mvn package then docker build) and run the application inside k8s it works well.
However, when we build the image in our CI/CD pipeline with Jenkins we get a runtime exception when running through a specific process which apparently requires additional fonts:
Caused by: java.lang.NullPointerException: null
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1288)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:765)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:440)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:385)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
In that case the project is buit in Jenkins, compiled by the docker image maven:3.5.4-jdk-10-slim.
I've checked both jar files (locally and from jenkins) and the class files are the same (as expected).
In both cases it's the same base image so I don't understand what could be the difference. Is something different in Docker when building locally vs inside another Docker container?
EDIT
We've looked into both docker images and found the following difference.
Since locally built image ls -l /usr/lib returns:
drwxr-xr-x 2 root root 4096 May 3 2017 X11
drwxr-xr-x 5 root root 4096 Apr 26 00:00 apt
drwxr-xr-x 2 root root 4096 May 26 08:31 binfmt.d
drwxr-xr-x 2 root root 4096 Jun 6 01:50 cgmanager
drwxr-xr-x 2 root root 4096 Jun 6 01:50 dbus-1.0
drwxr-xr-x 2 root root 4096 Jun 6 01:51 dconf
drwxr-xr-x 3 root root 4096 Jun 6 01:51 debug
drwxr-xr-x 3 root root 4096 Apr 20 10:08 dpkg
drwxr-xr-x 2 root root 4096 Jun 6 01:50 environment.d
drwxr-xr-x 3 root root 4096 Apr 25 04:56 gcc
drwxr-xr-x 2 root root 4096 Jun 6 01:51 glib-networking
drwxr-xr-x 2 root root 4096 Apr 26 00:00 init
drwxr-xr-x 1 root root 4096 Jun 6 01:51 jvm
drwxr-xr-x 3 root root 4096 Jun 6 01:50 kernel
lrwxrwxrwx 1 root root 20 Mar 4 09:49 libnih-dbus.so.1 -> libnih-dbus.so.1.0.0
-rw-r--r-- 1 root root 34824 Mar 4 09:49 libnih-dbus.so.1.0.0
lrwxrwxrwx 1 root root 15 Mar 4 09:49 libnih.so.1 -> libnih.so.1.0.0
-rw-r--r-- 1 root root 92184 Mar 4 09:49 libnih.so.1.0.0
drwxr-xr-x 3 root root 4096 Mar 29 19:47 locale
drwxr-xr-x 3 root root 4096 Jun 6 01:50 lsb
drwxr-xr-x 1 root root 4096 Jul 21 2017 mime
drwxr-xr-x 2 root root 4096 Jun 6 01:50 modprobe.d
drwxr-xr-x 2 root root 4096 May 26 08:31 modules-load.d
-rw-r--r-- 1 root root 198 Jan 13 23:36 os-release
drwxr-xr-x 3 root root 4096 Jun 6 01:51 ssl
drwxr-xr-x 1 root root 4096 Jun 6 01:50 systemd
drwxr-xr-x 2 root root 4096 Jun 6 01:50 sysusers.d
drwxr-xr-x 2 root root 4096 Jul 21 2017 tar
drwxr-xr-x 15 root root 4096 Feb 11 20:06 terminfo
drwxr-xr-x 1 root root 4096 Jun 6 01:50 tmpfiles.d
drwxr-xr-x 1 root root 4096 Apr 26 00:00 udev
drwxr-xr-x 1 root root 16384 Jun 6 01:51 x86_64-linux-gnu
But inside Jenkins built image ls -l /usr/lib returns:
drwxr-xr-x 5 root root 4096 Jun 25 00:00 apt
drwxr-xr-x 3 root root 4096 Jul 3 01:00 debug
drwxr-xr-x 3 root root 4096 Apr 20 10:08 dpkg
drwxr-xr-x 3 root root 4096 Jun 17 03:36 gcc
drwxr-xr-x 2 root root 4096 Jun 25 00:00 init
drwxr-xr-x 1 root root 4096 Jul 3 01:00 jvm
drwxr-xr-x 1 root root 4096 Jul 12 11:00 locale
drwxr-xr-x 3 root root 4096 Jul 3 01:00 lsb
drwxr-xr-x 1 root root 4096 May 16 07:47 mime
-rw-r--r-- 1 root root 198 Jan 13 23:36 os-release
drwxr-xr-x 3 root root 4096 Jul 3 01:00 ssl
drwxr-xr-x 3 root root 4096 Apr 20 10:08 systemd
drwxr-xr-x 2 root root 4096 May 16 07:47 tar
drwxr-xr-x 15 root root 4096 May 21 08:54 terminfo
drwxr-xr-x 2 root root 4096 Jun 25 00:00 tmpfiles.d
drwxr-xr-x 3 root root 4096 Jun 25 00:00 udev
drwxr-xr-x 2 root root 4096 May 3 2017 X11
drwxr-xr-x 1 root root 4096 Jul 3 01:00 x86_64-linux-gnu
This is really puzzling as I thought Docker would always produce the same image from identical Dockerfiles
With openjdk:8u111-jdk-alpine, installing dejavu fix the problem:
For example:
Dockerfile:
FROM openjdk:8u111-jdk-alpine
# Needed to fix 'Fontconfig warning: ignoring C.UTF-8: not a valid language tag'
ENV LANG en_GB.UTF-8
# JRE fails to load fonts if there are no standard fonts in the image; DejaVu is a good choice,
# see https://github.com/docker-library/openjdk/issues/73#issuecomment-207816707
RUN apk add --update ttf-dejavu && rm -rf /var/cache/apk/*
VOLUME /tmp
COPY /target/*.jar app.jar
ENTRYPOINT ["java","-Xmx100m","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Just add the following in your Dockerfile
RUN apk add --no-cache fontconfig ttf-dejavu
Installing libfontconfig1 solved the problem for me (source):
RUN apt-get install -y libfontconfig1 && rm -rf /var/lib/apt/lists/*
I think we found the problem.
When running on Jenkins we use the docker:dind (Docker inside docker) Docker image to provide the docker command in the build. This image is based on Alpine linux. When running docker info we get the following:
On Mac:
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
On Jenkins:
Kernel Version: 4.4.115-k8s
Operating System: Alpine Linux v3.7 (containerized)
Alpine linux must be missing those fonts. We fixed the problem by manually installing them in the Dockerfile:
RUN apt-get update \
&& apt-get install --assume-yes apt-utils \
&& apt-get install --assume-yes software-properties-common \
&& apt-get install --assume-yes dbus \
&& apt-get install --assume-yes cgmanager \
&& apt-get install --assume-yes glib-networking \
&& apt-get install --assume-yes libnih-dbus-dev \
&& apt-get install --assume-yes dconf-cli \
&& apt-get install --assume-yes fontconfig
Not sure this is the minimum required libraries but those did the trick :D
If you trying to do in Java/Spring boot , adding following in Dockerfile worked for me in java 11.
# Font packages to be added for java 11
RUN apk update \
&& apk add fontconfig \
&& apk add ttf-dejavu
RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so && \
ln -s /lib/libuuid.so.1 /usr/lib/libuuid.so.1 && \
ln -s /lib/libc.musl-x86_64.so.1 /usr/lib/libc.musl-x86_64.so.1
ENV LD_LIBRARY_PATH /usr/lib
If you are running it on local with Docker Desktop and using docker file to create the image.
Please make changes in Dockerfile from FROM openjdk:8-jdk-alpine to FROM adoptopenjdk/openjdk11:ubi
Problem NullPointerException with fonts occurs when you use openjdk docker image in alpine version for example :
adoptopenjdk/openjdk11:jre-11.0.11_9-alpine.
You need change image to full version: adoptopenjdk/openjdk11:jre-11.0.11_9
I also got the same issue while running below command and restart app server resolved this issue.
Yup install fontconfig
When stopping/starting a deployment via the WebLogic Admin console, sometimes we get the following error:
Unable to access application source information in '/opt/product/oracle/local/managedservers/mydomain/servers/serverA/stage/apputil/apputil.war'
for application 'apputil’.
The specific error is: [Deployer:149158] No application files
exist at '/opt/product/oracle/local/managedservers/mydomain/servers/serverA/stage/apputil/apputil.war'
Yet, if I stop and start the managed server, the deployment appears to come back.
My question is, WHY do these war files disappear from the managed server seemingly randomly, while the server is running? This typically happens after we haven't touched a deployment for some time (6 months). Other war files for other deployments are there. It does not affect the running of the app, until we try to stop/start it.
This is what the filesystem looks like before and after.
[oracle#serverA stage]$ pwd;ls -alstr
/opt/product/oracle/local/managedservers/mydomain/servers/serverA/stage
total 20
4 drwxr-x--- 8 oracle dba 4096 Mar 19 2014 ..
4 drwxr----- 3 oracle dba 4096 Mar 19 2014 app-crypto-util
4 drwxr----- 2 oracle dba 4096 Mar 19 2014 appadmin
4 drwxr----- 2 oracle dba 4096 Mar 19 2014 appsm
4 drwxr----- 5 oracle dba 4096 May 1 15:29 .
[oracle#serverA stage]$ ls
appadmin app-crypto-util appsm
Restart managed server here...
[oracle#serverA stage]$ ls
appdmin app-crypto-util appsm apputil
[oracle#serverA stage]$ ls -alstr
total 24
4 drwxr-x--- 8 oracle dba 4096 Mar 19 2014 ..
4 drwxr----- 3 oracle dba 4096 Mar 19 2014 app-crypto-util
4 drwxr----- 2 oracle dba 4096 Mar 19 2014 appadmin
4 drwxr----- 2 oracle dba 4096 Mar 19 2014 appsm
4 drwxr----- 2 oracle dba 4096 Jun 25 14:35 apputil
4 drwxr----- 6 oracle dba 4096 Jun 25 14:35 .
[oracle#serverA stage]$ ls -alstr apputil/apputil.war
28660 -rw-r----- 1 oracle dba 29347298 Jun 25 14:35 apputil/apputil.war
This may happen when AdminServer & Managed Server are in different machines, or the war is being sent from a different machine to AS.
use arguments: -remote -upload
i.e.:
java weblogic.Deployer -adminurl t3://200.10.10.125:7001 -verbose -username weblogic -password welcome1 -deploy -targets WLCluster -name sample -remote -source sample.war -upload
Referring to the stage directory modification date, it appears this dir is created/edited when an event occur, maybe by a script, and if it is the case, the problem should come from that script when copying apps wars.
So in my POV when stopping a deployment, maybe weblogic stop the apputil managed server, wich delete the war from th stage dir, and when starting a deployment after stopping it, it does not start the specified managed server before, and try to redeploy all apps wich cause the exception.
I am basically a mysql guy and new in hadoop and trying to import one mysql table on my hadoop system by sqoop and using below command but getting error. I search on net but not getting any possible solution.
I will be very thankful for your support.
[hduser#localhost ~]$ sqoop-import --connect jdbc:mysql://192.168.12.172:3306/test --username root -P --table users_log
Error:
15/02/25 16:26:40 ERROR tool.ImportTool: Encountered IOException running import job: java.io.FileNotFoundException: File does not exist: hdfs://localhost:9000/home/hduser/sqoop/lib/hsqldb-1.8.0.10.jar
Even This file exist on same path, details are below-
[hduser#localhost ~]$ ls -lh /home/hduser/sqoop/lib/
total 5.1M
-rwxr-xr-x 1 hduser hadoop 220K Aug 1 2014 ant-contrib-1.0b3.jar
-rwxr-xr-x 1 hduser hadoop 36K Aug 1 2014 ant-eclipse-1.0-jvm1.2.jar
-rwxr-xr-x 1 hduser hadoop 392K Aug 1 2014 avro-1.7.5.jar
-rwxr-xr-x 1 hduser hadoop 167K Aug 1 2014 avro-mapred-1.7.5-hadoop2.jar
-rwxr-xr-x 1 hduser hadoop 236K Aug 1 2014 commons-compress-1.4.1.jar
-rwxr-xr-x 1 hduser hadoop 107K Aug 1 2014 commons-io-1.4.jar
-rwxr-xr-x 1 hduser hadoop 691K Aug 1 2014 hsqldb-1.8.0.10.jar
-rwxr-xr-x 1 hduser hadoop 227K Aug 1 2014 jackson-core-asl-1.9.13.jar
-rwxr-xr-x 1 hduser hadoop 763K Aug 1 2014 jackson-mapper-asl-1.9.13.jar
-rwxr-xr-x 1 hduser hadoop 932K Mar 11 2014 mysql-connector-java-5.1.30-bin.jar
-rwxr-xr-x 1 hduser hadoop 29K Aug 1 2014 paranamer-2.3.jar
-rwxr-xr-x 1 hduser hadoop 1.2M Aug 1 2014 snappy-java-1.0.5.jar
-rwxr-xr-x 1 hduser hadoop 93K Aug 1 2014 xz-1.0.jar
hdfs://localhost:9000/ is hadoop hdfs address.
you can change property in your app or upload your jar on hdfs.
You display ls command of your linux file system but hdfs://localhost:9000/ is addres of hadoop hdfs file system.
Please execute below commands which will resolve your problem. It will copy your files in HDFS system.
hdfs dfs -copyFromLocal /opt/hadoop/sqoop-1.4.6 hdfs://localhost:9000/opt/hadoop/sqoop-1.4.6
hdfs dfs -copyFromLocal /opt/hadoop/sqoop-1.4.6/lib hdfs://localhost:9000/opt/hadoop/sqoop-1.4.6/lib
Note : please treat below curly braces inline section as one line
{hdfs dfs -copyFromLocal /opt/hadoop/sqoop-1.4.6/sqoop-1.4.6.jar hdfs://localhost:9000/opt/hadoop/sqoop-1.4.6/sqoop-1.4.6.jar}
Similarly copy any file which is not able to get by HDFS system.
Note : In above command /opt/hadoop/sqoop-1.4.6 is my system sqoop installation location
Thanks, Iqubal Mustafa Kaki
I'm trying to deploy a small Lift webapp to a Jetty container but I get several exceptions. I pasted a small excerpt of the stack trace below. I can provide the full stack trace if needed. I goggled all three problems but I couldn't find anything useful to solve it.
I created my app.war file in sbt with the package command and just dropped the web archive inside Jetty webapps folder.
~$ whereis jetty8
jetty8: /etc/jetty8 /usr/share/jetty8
~$ ls -al /usr/share/jetty8/
total 16
drwxr-xr-x 4 root root 4096 Feb 28 13:25 .
drwxr-xr-x 107 root root 4096 Feb 28 16:12 ..
lrwxrwxrwx 1 root root 20 Jul 30 2013 contexts -> /etc/jetty8/contexts
lrwxrwxrwx 1 root root 11 Jul 30 2013 etc -> /etc/jetty8
lrwxrwxrwx 1 root root 25 Jul 30 2013 javadoc -> ../doc/libjetty8-java/api
drwxr-xr-x 3 root root 4096 Feb 28 13:25 lib
lrwxrwxrwx 1 root root 15 Jul 30 2013 logs -> /var/log/jetty8
drwxr-xr-x 2 root root 4096 Feb 28 13:25 resources
lrwxrwxrwx 1 root root 40 Jul 30 2013 start.jar -> ../java/jetty8-start-8.1.3.v20120416.jar
lrwxrwxrwx 1 root root 23 Jul 30 2013 webapps -> /var/lib/jetty8/webapps
I'm using Scala 2.10.3, Lift 2.6-M2, SBT 0.13.1, Jetty 8.1.3.v20120416 and Java 8 on Linaro Ubuntu Server 13.10.
Stacktrace[excerpt]:
ERROR in ch.qos.logback.core.FileAppender[FILE] - openFile(console.devmode.log,true) call failed. java.io.FileNotFoundException: console.devmode.log (Permission denied)
at java.io.FileNotFoundException: console.devmode.log (Permission denied)
at at java.io.FileOutputStream.open(Native Method)
ERROR net.liftweb.db.StandardDBVendor - Unable to get database connection. url=jdbc:h2:lift_proto.db;AUTO_SERVER=TRUE
org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.FileNotFoundException: /usr/share/jetty8/lift_proto.db.lock.db (Permission denied)"; "/usr/share/jetty8/lift_proto.db.lock.db" [90031-167]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) ~[h2-1.3.167.jar:1.3.167]
at org.h2.message.DbException.get(DbException.java:158) ~[h2-1.3.167.jar:1.3.167]
ERROR n.liftweb.http.provider.HTTPProvider - Failed to Boot! Your application may not run properly
java.lang.NullPointerException: Looking for Connection Identifier ConnectionIdentifier(lift) but failed to find either a JNDI data source with the name lift or a lift connection manager with the correct name
at net.liftweb.db.DB$$anonfun$newConnection$2.apply(DB.scala:190) ~[lift-db_2.10-2.6-M2.jar:2.6-M2]