Spring IllegalAccessError:尝试从类ValueFormatterWrapper

时间:2019-03-17 02:52:32

标签: java spring spring-mvc thymeleaf

我对Spring有一个奇怪的问题。我不认为我做错了什么,我怀疑这是Spring本身的问题,但我永远不能确定。在Internet上其他任何地方都找不到关于此错误的参考,因此我来StackOverflow寻求帮助。

我正在使用Spring Boot,并且正在解析百里香模板。解析模板时,我发现模板尝试解析th:field值时,会出现异常:Caused by: java.lang.IllegalAccessError: tried to access class org.springframework.web.servlet.tags.form.ValueFormatter from class org.springframework.web.servlet.tags.form.ValueFormatterWrapper

我不确定发生了什么,我发现如果我从模板中删除th:field,它会很好地处理模板。堆栈跟踪中没有对我的代码的引用,全部是Spring,Thymeleaf和Tomcat的东西。这使我相信这是一个实际的Spring错误。

一些堆栈跟踪如下:

Caused by: java.lang.IllegalAccessError: tried to access class org.springframework.web.servlet.tags.form.ValueFormatter from class org.springframework.web.servlet.tags.form.ValueFormatterWrapper
    at org.springframework.web.servlet.tags.form.ValueFormatterWrapper.getDisplayString(ValueFormatterWrapper.java:40)
    at org.thymeleaf.spring4.processor.SpringInputGeneralFieldTagProcessor.doProcess(SpringInputGeneralFieldTagProcessor.java:110)
    at org.thymeleaf.spring4.processor.AbstractSpringFieldTagProcessor.doProcess(AbstractSpringFieldTagProcessor.java:179)
    at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)
    at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)
    at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:918)
    at org.thymeleaf.engine.StandaloneElementTag.beHandled(StandaloneElementTag.java:228)
    at org.thymeleaf.engine.Model.process(Model.java:282)
    at org.thymeleaf.engine.Model.process(Model.java:290)
    at org.thymeleaf.engine.IteratedGatheringModelProcessable.processIterationModel(IteratedGatheringModelProcessable.java:367)
    at org.thymeleaf.engine.IteratedGatheringModelProcessable.process(IteratedGatheringModelProcessable.java:221)
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement(ProcessorTemplateHandler.java:1640)
    at org.thymeleaf.engine.CloseElementTag.beHandled(CloseElementTag.java:139)
    at org.thymeleaf.engine.Model.process(Model.java:282)
    at org.thymeleaf.engine.Model.process(Model.java:290)
    at org.thymeleaf.engine.IteratedGatheringModelProcessable.processIterationModel(IteratedGatheringModelProcessable.java:367)
    at org.thymeleaf.engine.IteratedGatheringModelProcessable.process(IteratedGatheringModelProcessable.java:221)
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement(ProcessorTemplateHandler.java:1640)
    at org.thymeleaf.engine.CloseElementTag.beHandled(CloseElementTag.java:139)
    at org.thymeleaf.engine.Model.process(Model.java:282)
    at org.thymeleaf.engine.Model.process(Model.java:290)
    at org.thymeleaf.engine.IteratedGatheringModelProcessable.processIterationModel(IteratedGatheringModelProcessable.java:367)
    at org.thymeleaf.engine.IteratedGatheringModelProcessable.process(IteratedGatheringModelProcessable.java:221)
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement(ProcessorTemplateHandler.java:1640)
    at org.thymeleaf.engine.CloseElementTag.beHandled(CloseElementTag.java:139)
    at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136)
    at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:661)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072)
    at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:352)
    at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984)
    ... 49 more

问题模板中的特定行是:

<input type="text" th:field="${configForm.configs[__${configIter.index}__].siteId}" th:text="${progressItemAttribute.attribute.name != null} ? ${progressItemAttribute.attribute.name} : 'null value!'"/>

0 个答案:

没有答案