常见问题
大约 8 分钟
一、更多常见问题
二、前端编译项目时报错
报错信息
展开
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /home/yptuser/.local/share/pnpm/store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 1490, reused 1427, downloaded 0, added 327
Progress: resolved 1490, reused 1427, downloaded 0, added 1327
Progress: resolved 1490, reused 1427, downloaded 0, added 1366
.../esbuild@0.11.23/node_modules/esbuild postinstall$ node install.js
.../esbuild@0.11.3/node_modules/esbuild postinstall$ node install.js
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall$ node lib/install.js
.../node_modules/optipng-bin postinstall$ node lib/install.js
.../esbuild@0.11.23/node_modules/esbuild postinstall: Done
.../node_modules/pngquant-bin postinstall$ node lib/install.js
.../esbuild@0.11.3/node_modules/esbuild postinstall: Done
Progress: resolved 1490, reused 1427, downloaded 0, added 1427, done
.../node_modules/optipng-bin postinstall: optipng pre-build test passed successfully
.../node_modules/optipng-bin postinstall: Done
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: Command failed: /home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/mozjpeg@7.1.1/node_modules/mozjpeg/vendor/cjpeg -version
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: /home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/mozjpeg@7.1.1/node_modules/mozjpeg/vendor/cjpeg: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/mozjpeg@7.1.1/node_modules/mozjpeg/vendor/cjpeg)
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: mozjpeg pre-build test failed
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: compiling from source
.../node_modules/pngquant-bin postinstall: pngquant pre-build test passed successfully
.../node_modules/pngquant-bin postinstall: Done
.../node_modules/vue-demi postinstall$ node ./scripts/postinstall.js
.../node_modules/vue-demi postinstall: Done
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: Error: Command failed: /bin/sh -c ./configure --enable-static --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/mozjpeg@7.1.1/node_modules/mozjpeg/vendor" --bindir="/home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/mozjpeg@7.1.1/node_modules/mozjpeg/vendor" --libdir="/home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/mozjpeg@7.1.1/node_modules/mozjpeg/vendor"
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: ./configure: line 13633: PKG_PROG_PKG_CONFIG: command not found
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: ./configure: line 13812: syntax error near unexpected token `libpng,'
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: ./configure: line 13812: `PKG_CHECK_MODULES(libpng, libpng, HAVE_LIBPNG=1,'
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for a BSD-compatible install... /usr/bin/install -c
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether build environment is sane... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for a thread-safe mkdir -p... /bin/mkdir -p
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for gawk... gawk
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether make sets $(MAKE)... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether make supports nested variables... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether make supports nested variables... (cached) yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for style of include used by make... GNU
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for gcc... gcc
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether the C compiler works... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for C compiler default output file name... a.out
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for suffix of executables...
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether we are cross compiling... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for suffix of object files... o
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether we are using the GNU C compiler... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether gcc accepts -g... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for gcc option to accept ISO C89... none needed
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether gcc understands -c and -o together... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking dependency style of gcc... none
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to run the C preprocessor... gcc -E
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for gcc... (cached) gcc
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether we are using the GNU C compiler... (cached) yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether gcc accepts -g... (cached) yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for gcc option to accept ISO C89... (cached) none needed
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether gcc understands -c and -o together... (cached) yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking dependency style of gcc... (cached) none
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for ar... ar
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking the archiver (ar) interface... ar
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking dependency style of gcc... none
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking the archiver (ar) interface... (cached) ar
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking build system type... x86_64-pc-linux-gnu
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking host system type... x86_64-pc-linux-gnu
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to print strings... printf
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for a sed that does not truncate output... /bin/sed
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for grep that handles long lines and -e... /bin/grep
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for egrep... /bin/grep -E
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for fgrep... /bin/grep -F
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for ld used by gcc... /usr/bin/ld
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if the linker (/usr/bin/ld) is GNU ld... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking the name lister (/usr/bin/nm -B) interface... BSD nm
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether ln -s works... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking the maximum length of command line arguments... 1572864
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for /usr/bin/ld option to reload object files... -r
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for objdump... objdump
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to recognize dependent libraries... pass_all
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for dlltool... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to associate runtime and link libraries... printf %s\n
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for archiver @FILE support... @
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for strip... strip
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for ranlib... ranlib
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking command to parse /usr/bin/nm -B output from gcc object... ok
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for sysroot... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for a working dd... /bin/dd
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to truncate binary pipes... /bin/dd bs=4096 count=1
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for mt... mt
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if mt is a manifest tool... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for ANSI C header files... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for sys/types.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for sys/stat.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for stdlib.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for string.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for memory.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for strings.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for inttypes.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for stdint.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for unistd.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for dlfcn.h... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for objdir... .libs
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if gcc supports -fno-rtti -fno-exceptions... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for gcc option to produce PIC... -fPIC -DPIC
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if gcc PIC flag -fPIC -DPIC works... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if gcc static flag -static works... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if gcc supports -c -o file.o... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if gcc supports -c -o file.o... (cached) yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking dynamic linker characteristics... GNU/Linux ld.so
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking how to hardcode library paths into programs... immediate
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether stripping libraries is possible... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking if libtool supports shared libraries... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether to build shared libraries... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether to build static libraries... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether ln -s works... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking size of size_t... 8
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether compiler supports pointers to undefined structures... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking whether __SUNPRO_C is declared... no
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: checking for pow in -lm... yes
.../mozjpeg@7.1.1/node_modules/mozjpeg postinstall: at /home/yptuser/.jenkins/workspace/web-pro/node_modules/.pnpm/execa@0.7.0/node_modules/execa/index.js:231:11
解决方法
服务器缺少某些库,请自行安装
# ubuntu
sudo apt-get install zlib1g-dev liblzo2-dev uuid-dev pkg-config automake
sudo apt-get install libtool automake autoconf nasm
# centos
yum install zlib1g-dev liblzo2-dev uuid-dev pkg-config automake
yum install libtool automake autoconf nasm
三、验证码无法加载
报错信息
展开
[lamp-portal-server:12081::] 2021-12-24 17:59:21.069[ERROR] 26021 [] [XNIO-2 task-1:1864746] [io.undertow.request.?:?] UT005023: Exception handling request to /anno/captcha
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.InternalError: java.lang.reflect.InvocationTargetException
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1082)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at top.tangyh.basic.xss.filter.XssFilter.doFilter(XssFilter.java:66)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
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:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
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:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
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:119)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
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:280)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
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:260)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:247)
at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:265)
at java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:861)
at com.wf.captcha.ArithmeticCaptcha.graphicsImage(ArithmeticCaptcha.java:73)
at com.wf.captcha.ArithmeticCaptcha.out(ArithmeticCaptcha.java:45)
at top.tangyh.lamp.portal.service.impl.ValidateCodeServiceImpl.create(ValidateCodeServiceImpl.java:48)
at top.tangyh.lamp.portal.controller.ProtaloauthController.captcha(ProtaloauthController.java:313)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
... 63 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:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
... 83 common frames omitted
Caused by: java.lang.NullPointerException: null
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:377)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:322)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
... 88 common frames omitted
解决方案
服务器安装宋体
yum install fontconfig
fc-cache --force
然后重启java程序
若是docker部署,需要在docker镜像内部安装。
四、后端启动时报错:找不到或无法加载主类 top.tangyh.lamp.OauthServerApplication
报错信息
解决方案
- https://www.cnblogs.com/wqbin/p/13039565.html
- https://blog.csdn.net/qq_36525906/article/details/122468216
五、SQL执行时,参数值被替换
问题描述
传递的参数: AAA_BBB、 AAA%BBB
执行SQL时变成:AAA\_BBB、 AAA\%BBB
原因
因为_ 和% 是mysql的模糊查询关键字,模糊查询时,Wraps会自动将关键字进行替换。
如下图,entityname字段中有2条数据,分别是“B组招聘人员”和“B组招聘_员”,当前端传递“B组招聘_员”进行查询时,会将2条数据都查出来。
实现位置
public class LbQueryWrap<T> extends AbstractLambdaWrapper<T, LbQueryWrap<T>>
implements Query<LbQueryWrap<T>, T, SFunction<T, ?>> {
private static final long serialVersionUID = -6842140106034506889L;
/**
* 查询字段
*/
private SharedString sqlSelect = new SharedString();
/**
* 是否跳过空值(lamp项目扩展)
*/
private boolean skipEmpty = true;
/**
* 不建议直接 new 该实例,使用 Wrappers.lambdaQuery(entity)
*/
public LbQueryWrap() {
this((T) null);
}
/**
* 不建议直接 new 该实例,使用 Wrappers.lambdaQuery(entity)
*/
public LbQueryWrap(T entity) {
super.setEntity(entity);
super.initNeed();
//覆盖之前的entity
if (entity != null) {
super.setEntity(replace(BeanUtil.toBean(entity, getEntityClass())));
}
}
/**
* 替换 实体对象中类型为String 类型的参数,并将% 和 _ 符号转义
*
* @param source 源对象
* @return 最新源对象
*/
public static <T> T replace(Object source) {
if (source == null) {
return null;
}
Class<?> srcClass = source.getClass();
Field[] fields = ReflectUtil.getFields(srcClass);
for (Field field : fields) {
Object classValue = ReflectUtil.getFieldValue(source, field);
if (classValue == null) {
continue;
}
//final 和 static 字段跳过
if (Modifier.isFinal(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) {
continue;
}
if (!(classValue instanceof String)) {
continue;
}
TableField tableField = AnnotationUtil.getAnnotation(field, TableField.class);
if (tableField == null) {
continue;
}
String condition = tableField.condition();
if (StrUtil.isEmpty(condition) || StrUtil.equalsAny(condition, SqlCondition.EQUAL, SqlCondition.NOT_EQUAL)) {
continue;
}
String srcValue = (String) classValue;
if (srcValue.contains(PERCENT) || srcValue.contains(UNDERSCORE)) {
String tarValue = StrHelper.keywordConvert(srcValue);
ReflectUtil.setFieldValue(source, field, tarValue);
}
}
return (T) source;
}
}
public class LbQueryWrap<T> extends AbstractLambdaWrapper<T, LbQueryWrap<T>>
implements Query<LbQueryWrap<T>, T, SFunction<T, ?>> {
@Override
public LbQueryWrap<T> like(SFunction<T, ?> column, Object val) {
return super.like(this.checkCondition(val), column, keywordConvert(val));
}
@Override
public LbQueryWrap<T> likeLeft(SFunction<T, ?> column, Object val) {
return super.likeLeft(this.checkCondition(val), column, keywordConvert(val));
}
@Override
public LbQueryWrap<T> likeRight(SFunction<T, ?> column, Object val) {
return super.likeRight(this.checkCondition(val), column, keywordConvert(val));
}
/**
* 忽略实体中的某些字段,实体中的字段默认是会除了null以外的全部进行等值匹配
* 再次可以进行忽略
*
* @param column 这个是传入的待忽略字段的set方法
* @param val 值
*/
@Override
public LbQueryWrap<T> notLike(SFunction<T, ?> column, Object val) {
return super.notLike(this.checkCondition(val), column, keywordConvert(val));
}
/**
* mybatis plus like查询转换
*/
public static String keywordConvert(String value) {
if (StrUtil.isBlank(value)) {
return StrPool.EMPTY;
}
value = value.replaceAll(StrPool.PERCENT, "\\\\%");
value = value.replaceAll(StrPool.UNDERSCORE, "\\\\_");
return value;
}
public static Object keywordConvert(Object value) {
if (value instanceof String) {
return keywordConvert(String.valueOf(value));
}
return value;
}
}
六、config-dev.properties 文件显示乱码
七、访问系统时,经常超时?
https://github.com/dromara/lamp-cloud/discussions/254
👆🏻👆🏻👆🏻上面是评论区,对系统、本页文档什么疑问,可以在评论区留言。
❗️❗️❗️若评论区无法显示,请使用"手机热点"或"科学上网"。
❗️❗️❗️若评论区无法显示,请使用"手机热点"或"科学上网"。