验证码接口无法请求成功

Blade 已结 2 74
xm_rdx
xm_rdx 2024-12-12 13:56

一、该问题的重现步骤是什么?

1. 请求/blade-auth/oauth/captcha接口

2. jdk17模块化对反射进行安全处理,按照官网文档配置启动参数再次启动项目,仍然无法解决该问题!!!!

3.


二、你期待的结果是什么?实际看到的又是什么?

正确返回验证码

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

blade-boot 4.2.0 centos

四、请提供详细的错误堆栈信息,这很重要。

jakarta.servlet.ServletException: Handler dispatch failed: java.lang.InternalError: java.lang.reflect.InvocationTargetException

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1104)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)

at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:527)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)

at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)

at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)

at org.springblade.core.log.filter.LogTraceFilter.doFilter(LogTraceFilter.java:48)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at org.springblade.core.boot.request.BladeRequestFilter.doFilter(BladeRequestFilter.java:67)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:142)

at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:82)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:362)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:278)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)

at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)

at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)

at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)

at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)

at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)

at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)

at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)

at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)

at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)

at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)

at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)

at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)

at io.undertow.server.Connectors.executeRootHandler(Connectors.java:395)

at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)

at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)

at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)

at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)

at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)

at java.base/java.lang.Thread.run(Thread.java:842)

Caused by: java.lang.InternalError: java.lang.reflect.InvocationTargetException

at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:87)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)

at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:75)

at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:248)

at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:266)

at java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:863)

at com.wf.captcha.SpecCaptcha.graphicsImage(SpecCaptcha.java:76)

at com.wf.captcha.SpecCaptcha.out(SpecCaptcha.java:45)

at com.wf.captcha.base.Captcha.toBase64(Captcha.java:127)

at com.wf.captcha.SpecCaptcha.toBase64(SpecCaptcha.java:50)

at org.springblade.core.oauth2.endpoint.OAuth2TokenEndPoint.captcha(OAuth2TokenEndPoint.java:175)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:188)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:926)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:831)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)

... 62 common frames omitted

Caused by: java.lang.reflect.InvocationTargetException: null

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)

at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:85)

... 83 common frames omitted

Caused by: java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration

at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1269)

at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224)

at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106)

at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706)

at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358)

at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)

at java.desktop/sun.font.SunFontManager.(SunFontManager.java:315)

at java.desktop/sun.awt.FcFontManager.(FcFontManager.java:35)

at java.desktop/sun.awt.X11FontManager.(X11FontManager.java:56)

... 89 common frames omitted


五、若有更多详细信息,请在下面提供。

2条回答
  •  xm_rdx
    xm_rdx (楼主)
    2024-12-12 15:55

    启动命令再加 -Djava.awt.fonts=/usr/share/fonts,验证码正常返回

提交回复