Java 调 webservice 报如下错误
[2023-11-07 17:01:02.315] ERROR [scheduling-1] ToHisApiImpl.java:106 - 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) at com.vipsoft.his.hospital.service.impl.GoodwillcisServiceImpl.archiveFile(GoodwillcisServiceImpl.java:85) at com.vipsoft.his.hospital.service.impl.ToHisApiImpl.syncReport(ToHisApiImpl.java:92) at com.vipsoft.his.hospital.schedule.HisTaskJob.syncReport(HisTaskJob.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
安装 JDK 默认使用 JRE 环境,新增 JAVA_HOME 环境变量,指向 JDK 目录即可
新增 JAVA_HOME 环境变量
修改 Path 环境变量
如果还是不行,修改运行命令
java -jar XXX.jar
改成
"%JAVA_HOME%/BIN/JAVA" -jar XXX.jar
(XXX为你自己打包好的jar包名称)