无法在运行时在Tomcat启动和NoSuchFieldError上构造String值的实例

时间:2019-04-01 16:28:41

标签: java maven spring-mvc tomcat nosuchfieldexception

我现在有3天了这个问题,这让我发疯。我的项目使用Spring MVC和Apache Tomcat。在Tomcat-8.0.24启动时,出现错误;

  

无法构造的实例   ie.revenue.schemas.common.revenue_types_v1.RegistrationType来自   字符串值“ DPD”:值不是声明的Enum实例名称之一

但是,我要部署的程序会运行到最后一页,在最后一页,我将汇总到调用上述RegistrationType的域。在这里,我得到一个java.lang.NoSuchField错误:DPD。

我反编译有问题的jar,并且DPD字段存在。该jar文件不在我们的项目范围内,可以导入,我们无法控制此jar文件的编辑。

有趣的是,这是一个共享项目,而我的同事在本地没有这个问题,而该项目在我们的集成环境中运行良好。我尚未进行任何本地更改,因此该项目应能平稳运行。

在过去的几天里,我尝试了我发现的所有与该问题相关的一切,没有任何运气,包括;

  • 下载了最新的Apache Tomcat版本
  • 重新下载Eclipse
  • 在classpath和tomcat webapps文件夹中检查了重复的jars
  • 已删除项目,并再次从git克隆
  • 已清理并更新了所有课程文件
  • 启动前从tomcat webapps文件夹中删除项目
Exception at Tomcat startup

Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not co
nstruct instance of ie.revenue.schemas.common.revenue_types_v1.RegistrationType
from String value 'DPD': value not one of declared Enum instance names: [ACT, AT
T, BET, CAND_E, CAT, CGT, CT, CUST, DIRT, DWT, ELEV, EORI, EUST, EVAT, EXCISE, I
EGEVR, IL, INTR, IT, IUT, LAET, NEW_VAT, PAYE, PREM, PSWT, RCT, RPT, RTSO, SPIA,
 SSIA, STMP, TAIN, TAXC, TRT, VAT, VIES, VRT]
 at [Source: java.io.StringReader@2f6c52f4; line: 1, column: 2681] (through refe
rence chain: ie.revenue.common.revqueue.model.RevQueueWrapper["theObject"]->ie.r
evenue.schemas.crs.services.registration.register.register_request.v1.RegisterRe
quest["registrationTypes"])
        at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(Invali
dFormatException.java:55)
        at com.fasterxml.jackson.databind.DeserializationContext.weirdStringExce
ption(DeserializationContext.java:742)
        at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize
(EnumDeserializer.java:91)
        at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize
(EnumDeserializer.java:20)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deser
ialize(CollectionDeserializer.java:227)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deser
ialize(CollectionDeserializer.java:204)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deser
ialize(CollectionDeserializer.java:23)
        at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize
(SettableBeanProperty.java:525)
        at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAn
dSet(FieldProperty.java:106)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserial
ize(BeanDeserializer.java:242)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOth
er(BeanDeserializer.java:155)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(Bea
nDeserializer.java:126)
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializ
er._deserializeTypedForId(AsPropertyTypeDeserializer.java:118)
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializ
er.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:87)

-----------------------------------------------------------------------------

Exception at runtime

Caused by: java.lang.NoSuchFieldError: DPD
    at ie.revenue.drivers.business.services.endpoint.impl.DriversEndPointServiceImpl.processAutoRegistration(DriversEndPointServiceImpl.java:997)
    at ie.revenue.drivers.business.services.endpoint.impl.DriversEndPointServiceImpl.autoRegisterForDPD(DriversEndPointServiceImpl.java:982)
    at ie.revenue.drivers.business.services.endpoint.impl.DriversEndPointServiceImpl.updateBankDetails(DriversEndPointServiceImpl.java:1091)
    at ie.revenue.drivers.business.services.endpoint.impl.DriversEndPointServiceImpl.submitRegistration(DriversEndPointServiceImpl.java:171)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
    at ie.revenue.common.revstore.transactional.RevTransactionalAspect.revTransactionalAdvice(RevTransactionalAspect.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at com.sun.proxy.$Proxy93.submitRegistration(Unknown Source)
    at ie.revenue.drivers.business.services.impl.RegistrationDriversServiceImpl.submitRegistration(RegistrationDriversServiceImpl.java:547)
    at ie.revenue.drivers.business.services.impl.RegistrationDriversServiceImpl.submitFormDrivers(RegistrationDriversServiceImpl.java:89)
    at ie.revenue.drivers.web.controller.RegistrationDriversController.submitDeclaration(RegistrationDriversController.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:69)
    at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:267)
    ... 79 more

0 个答案:

没有答案