Trying to deploy my web app through Kubernetes cluster and I receive this error that prevents my pod from running. It fails with a BackOff error. When I run 'kubectl logs pod xxx' to try and understand more about the pod, this is what populates:
2022-06-28 04:12:44.198 INFO 1 --- [ main] c.b.webconsole.WebconsoleApplication : Starting WebconsoleApplication v0.0.1-SNAPSHOT on webapp-deployment-66c555cd6b-8svtv with PID 1 (/app.jar started by root in /)
2022-06-28 04:12:44.200 INFO 1 --- [ main] c.b.webconsole.WebconsoleApplication : No active profile set, falling back to default profiles: default
2022-06-28 04:12:44.682 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-06-28 04:12:44.722 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 36ms. Found 11 JPA repository interfaces.
2022-06-28 04:12:45.195 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): xxxx (https)
2022-06-28 04:12:45.221 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-06-28 04:12:45.221 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.33]
2022-06-28 04:12:45.271 WARN 1 --- [ main] o.a.tomcat.util.scan.StandardJarScanner : Failed to scan [jar:file:/app.jar!/BOOT-INF/lib/spring-webmvc-5.2.5.RELEASE.jar!/] from classloader hierarchy
This sets off a bunch of IOExceptions in which IntelliJ is unable to open the root Jar file(s) for:
- spring-webmvc-5.2.5.RELEASE.jar
- jstl-1.2.jar
etc. So I'm wondering why this is happening?
Here's my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.blackbook</groupId>
<artifactId>webconsole</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>webconsole</name>
<description>Web console for EMM guide BlackBook</description>
<packaging>jar</packaging>
<properties>
<java.version>18.0.1.1</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-jasper -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>9.0.33</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/taglibs/standard -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<!-- Android Management API dependency -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-androidmanagement</artifactId>
<version>v1-rev20200221-1.30.9</version>
</dependency>
<!-- Google Play EMM API dependency for AdminWebToken-->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-androidenterprise</artifactId>
<version>v1-rev20200801-1.30.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<!-- When making changes, server will automatically perform the restart -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.30.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Here's my Dockerfile:
# For Java 18,
FROM openjdk:18
COPY target/webconsole-0.0.1-SNAPSHOT.jar app.jar
EXPOSE xxxx
ENTRYPOINT ["java","-jar","/app.jar"]
Not sure if my version of Java is the issue, wondering if anyone has run into this using openjdk18?
CodePudding user response:
All I needed to do was target a lower jdk!