当我尝试单独部署时,我遇到了错误。
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSessionListener
at java.base/java.net.URLClassLoader$1.run(Unknown Source) ~[na:na]
at java.base/java.net.URLClassLoader$1.run(Unknown Source) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.base/java.net.URLClassLoader.findClass(Unknown Source) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[na:na]
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[PivotalMySQLWeb-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Unknown Source) ~[na:na]
... 41 common frames omitted
Caused by: java.util.zip.ZipException: invalid distance too far back
at java.base/java.util.zip.InflaterInputStream.read(Unknown Source) ~[na:na]
at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:52) ~[PivotalMySQLWeb-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at java.base/jdk.internal.loader.Resource.getBytes(Unknown Source) ~[na:na]
at java.base/java.net.URLClassLoader.defineClass(Unknown Source) ~[na:na]
at java.base/java.net.URLClassLoader.access$100(Unknown Source) ~[na:na]
... 50 common frames omitted
当我试图推进我的本地PCF时,我的误差低于此值。
...分段
warning [/tmp/app/BOOT-INF/lib/tomcat-embed-core-8.5.11.jar]: 804742 extra bytes at beginning or within zipfile
(attempting to process anyway)
warning [/tmp/app/BOOT-INF/lib/tomcat-embed-core-8.5.11.jar]: 804742 extra bytes at beginning or within zipfile
(attempting to process anyway)
-----> Java Buildpack Version: v3.13 (offline) | https://github.com/cloudfoundry/java-buildpack.git#03b493f
-----> Downloading Open Jdk JRE 1.8.0_121 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_121.tar.gz (found in cache)
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.3s)
-----> Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (found in cache)
Memory Settings: -Xms681574K -XX:MetaspaceSize=104857K -Xss349K -Xmx681574K -XX:MaxMetaspaceSize=104857K
-----> Downloading Container Certificate Trust Store 2.0.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-certificate-trust-store/container-certificate-trust-store-2.0.0_RELEASE.jar (found in cache)
Adding certificates to .java-buildpack/container_certificate_trust_store/truststore.jks (0.9s)
-----> Downloading Spring Auto Reconfiguration 1.10.0_RELEASE from https://java-buildpack.cloudfoundry.org/auto-reconfiguration/auto-reconfiguration-1.10.0_RELEASE.jar (found in cache)
warning [/tmp/app/BOOT-INF/lib/tomcat-embed-core-8.5.11.jar]: 804742 extra bytes at beginning or within zipfile
(无论如何试图处理)
答案 0 :(得分:0)
看起来你的一些JAR很糟糕。当您使用Maven或Gradle下载应用程序的依赖项时,可能会发生Maven / Gradle无法下载JAR但失败的JAR被缓存的情况。缓存的JAR始终用于前进,因为它是缓存。然后你会得到像你所看到的错误。
最简单的方法是进入缓存并删除列出的JAR的目录。 Maven缓存位于function changeColorConstructor(greenLimit, redLimit) {
console.log('1. Green Limit in Constructor shell: ' + greenLimit);
return function (metric) {
var color;
console.log('3. Green Limit in returned function: ' + greenLimit);
if (metric >= greenLimit) {
console.log('Green');
color = '#56C621'; // green
} else if (metric < greenLimit && metric > redLimit) {
console.log('Yellow');
color = '#F2E607'; // yellow
} else if (metric <= redLimit) {
console.log('Red');
color = '#C64C20'; // red
} else {
color = '#C0C0C0'
}
return color;
};
}
var indexColor = changeColorConstructor(5000, 10000);
console.log('2. Returned function: ' + indexColor);
console.log('4. Output from production function: ' + indexColor(5000));
之下,gradle为~/.m2/repository
。只需在这些文件夹下查找~/.gradle/caches
(或任何JAR提供错误)并删除。然后重建您的应用并再次部署。