今天下载orange-admin项目,不过下载下来运行出现一些问题。
1、涉及到XMLStreamException的几个类都出现下面的错误
The package javax.xml.stream is accessible from more than one module: <unnamed>, java.xml
ctrl-shift-t 可以找到这个引入是哪些包里包括的,看到下面有一个xml-apis也包含了,应该需要去掉这个才行
运行工程,输入dependency:tree 如下:运行
运行出来后,搜索会出现
从上面可以看到poi-ooxml包含了这个,所以需要去掉这个,如下:
2、解决了编译问题,运行又出现下面问题
Unable to make field protected java.lang.reflect.InvocationHandler
java
INFO ] [2024-07-27 14:04:33] [main] ==> Started WebAdminApplication in 13.577 seconds (process running for 14.219)
[ERROR] [2024-07-27 14:04:33] [main] ==> Application run failed
java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h accessible: module java.base does not "opens java.lang.reflect" to unnamed module @125290e5
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at cn.hutool.core.util.ReflectUtil.setAccessible(ReflectUtil.java:1122)
at cn.hutool.core.util.ReflectUtil.getFieldValue(ReflectUtil.java:271)
at cn.hutool.core.util.ReflectUtil.getFieldValue(ReflectUtil.java:239)
at com.orangeforms.common.datafilter.interceptor.MybatisDataFilterInterceptor.loadInfoWithDataFilter(MybatisDataFilterInterceptor.java:97)
at com.orangeforms.common.datafilter.listener.LoadDataFilterInfoListener.onApplicationEvent(LoadDataFilterInfoListener.java:23)
at com.orangeforms.common.datafilter.listener.LoadDataFilterInfoListener.onApplicationEvent(LoadDataFilterInfoListener.java:1)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:174)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:445)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at org.springframework.boot.context.event.EventPublishingRunListener.ready(EventPublishingRunListener.java:109)
at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:80)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
at org.springframework.boot.SpringApplicationRunListeners.ready(SpringApplicationRunListeners.java:80)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
at com.orangeforms.webadmin.WebAdminApplication.main(WebAdminApplication.java:21)
[INFO ] [2024-07-27 14:04:33] [main] ==> Pausing ProtocolHandler ["http-nio-8082"]
看到相关使用 JDK17+ 版本时,需要为服务启动项 VM Options 添加选项 --add-opens java.base/java.lang.reflect=ALL-UNNAMED。
STS是在下面两个地方增加
1、是启动参数,在SpringToolSuite4.ini
增加--add-opens java.base/java.lang.reflect=ALL-UNNAMED,如下
2、同时需要再下面增加如下
这样就能正常运行了