cxf 动态调用 WebService No compiler detected, make sure you are running on top of a JDK instead of a JRE

cxf,动态,调用,webservice,no,compiler,detected,make,sure,you,are,running,on,top,of,jdk,instead,jre · 浏览次数 : 293

小编点评

The error message indicates that the cxf compiler could not be found on your system. This means that Spring Boot could not compile your Java application. Here's how to fix the issue: **1. Make sure you are running on a JDK instead of a JRE:** * Check your system's Java version using the `java -version` command. * If the version is JRE, you need to install and configure a JDK. * You can download the JDK from the official Oracle website. **2. Add the JDK installation directory to your PATH environment variable:** * This will allow the cxf compiler to be found by the Spring Boot build process. * You can set the PATH variable in several ways: * Set the environment variable directly: `export PATH="$PATH:/path/to/jdk/bin"` * Set the environment variable in your `.bashrc` file: `export PATH="/path/to/jdk/bin:$PATH"` * Set the environment variable in your `springbootdemo.properties` file: `spring.jndi.environment-variable=PATH` **3. Restart the Spring Boot application:** After setting the PATH variable, restart the Spring Boot application. **4. Verify that the cxf compiler is found:** Once you have set up the environment variables, you should be able to compile your Spring Boot application without errors. **Additional Notes:** * You may need to adjust the path to the `JAVA_HOME` variable to point to the correct JDK installation directory. * If you have multiple JDKs installed, you may need to specify the full path to the `java` executable in the `PATH` variable. * Make sure you have the necessary permissions to execute the compiled application.

正文

WebService cxf No compiler detected, make sure you are running on top of a JDK instead of a JRE

[2022-11-14 09:55:01.644] ERROR [scheduling-1] ZysoftServiceImpl.java:384 - No compiler detected, make sure you are running on top of a JDK instead of a JRE.
java.lang.IllegalStateException: No compiler detected, make sure you are running on top of a JDK instead of a JRE.
	at org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:193)
	at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:141)
	at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:136)
	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.compileJavaSrc(DynamicClientFactory.java:639)
	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:389)
	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:244)
	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:237)
	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:192)

安装 JDK 默认使用 JRE 环境,新增 JAVA_HOME 环境变量,指向 JDK 目录即可
image
image

把jdk安装目录\lib\tools.jar复制到jre安装目录\lib文件夹下

java -jar springbootdemo.jar
#启动命令修改为
"%JAVA_HOME%\bin\java" -jar springbootdemo.jar

与cxf 动态调用 WebService No compiler detected, make sure you are running on top of a JDK instead of a JRE相似的内容: