1. Problem phenomenon
upload image function, local test compilation needs to refer to the plug-in, otherwise the compilation does not pass.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>utf-8</encoding>
<compilerArguments>
<verbose />
<bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
<!–<bootclasspath>${java.home}\lib\rt.jar;${java.home}\lib\jce.jar</bootclasspath>–>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
Then the local test passed, but the release to the test environment reported an error.org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException
2. Reason
upload compressed images using the contents of the com.sun package, but the test environment with java openjdk, lib below the rt.jar without com/sun/image/codec/jpeg package, resulting in references to this class
3. Solution: Install the standard jdk
cd /etc
vim profile
export JAVA_HOME=/usr/local/jdk8
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$HOME/bin:$HOME/.local/bin:$PATH
source profile
java -version
Similar Posts:
- [Solved] MAVEN-COMPILER-PLUGIN Compile Error: FATAL ERROR: UNABLE TO FIND PACKAGE JAVA.LANG IN CLASSPATH OR BOOTCLASSPATH
- [Solved] Error: Package com.sun.xml.internal.bind.v2.model.core does not exist
- Maven warnning: ‘build.plugins.plugin.version’ is missing [How to Solve]
- [Solved] Dynamic Web Module 3.0 requires Java 1.6 or newer
- Usage of API documented as @since 1.8+
- [Solved] Spring Start Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project gulimall-coupon: There are test failures. Please refer to D:\m1\0613\mall-coup
- [Solved] Error:java: error: release version 5 not supported & Switch Unrecognized String
- How to Solve Maven Project Error: Cannot change version of project facet Dynamic web module to 3.0/3.1
- [Solved] Error:java: Compilation failed: internal java compiler error
- Dynamic Web Module 3.1 requires Java 1.7 or newer