fix: 配置文件修改。

This commit is contained in:
tianyongbao
2025-12-22 22:46:51 +08:00
parent 7c4317bf2f
commit 46926c971c
2 changed files with 42 additions and 0 deletions

View File

@@ -5,6 +5,12 @@ FROM openjdk:17
LABEL maintainer="Intc" LABEL maintainer="Intc"
# 安装字体库,解决验证码生成时的字体加载问题
RUN apt-get update && apt-get install -y \
fontconfig \
fonts-dejavu-core \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /intc/server/logs \ RUN mkdir -p /intc/server/logs \
/intc/server/temp \ /intc/server/temp \
/intc/skywalking/agent /intc/skywalking/agent

View File

@@ -28,6 +28,7 @@ import org.springframework.web.method.annotation.MethodArgumentTypeMismatchExcep
import org.springframework.web.servlet.NoHandlerFoundException; import org.springframework.web.servlet.NoHandlerFoundException;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
/** /**
* 全局异常处理器 * 全局异常处理器
@@ -140,6 +141,41 @@ public class GlobalExceptionHandler {
public void handleRuntimeException(AsyncRequestTimeoutException e) { public void handleRuntimeException(AsyncRequestTimeoutException e) {
} }
/**
* 反射调用异常(InvocationTargetException)
* 解包获取真正的异常原因
*/
@ExceptionHandler(InvocationTargetException.class)
public R<Void> handleInvocationTargetException(InvocationTargetException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
Throwable targetException = e.getTargetException();
if (targetException != null) {
log.error("请求地址'{}',反射调用发生异常: {}", requestURI, targetException.getMessage(), targetException);
return R.fail(targetException.getMessage());
}
log.error("请求地址'{}',反射调用发生未知异常.", requestURI, e);
return R.fail("系统内部错误,请联系管理员");
}
/**
* InternalError 异常处理
* 通常由底层JVM错误或反射调用错误引起
*/
@ExceptionHandler(InternalError.class)
public R<Void> handleInternalError(InternalError e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
Throwable cause = e.getCause();
if (cause instanceof InvocationTargetException) {
Throwable targetException = ((InvocationTargetException) cause).getTargetException();
if (targetException != null) {
log.error("请求地址'{}',发生系统内部错误(InvocationTargetException): {}", requestURI, targetException.getMessage(), targetException);
return R.fail(targetException.getMessage());
}
}
log.error("请求地址'{}',发生系统内部错误: {}", requestURI, e.getMessage(), e);
return R.fail("系统内部错误: " + (e.getMessage() != null ? e.getMessage() : "请联系管理员"));
}
/** /**
* 拦截未知的运行时异常 * 拦截未知的运行时异常
*/ */