InjectionUtils can not access a member of class DateTimeZoneBuilder$PrecalculatedZone

偶尔善良 提交于 2019-12-25 09:41:42

问题


I am trying to send a post request with cxf implementation. But I am getting

java.lang.IllegalAccessException: Class org.apache.cxf.jaxrs.utils.InjectionUtils can not access a member of class org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone with modifiers "public"

My method interface is :

@GET
@Path("history")
HistoryResult getHistory(@Valid @QueryParam("") HistoryParameters historyParameters)

HistoryParameters has two joda time LocalDate : public class HistoryParameters {

    @NotNull
    @QueryParam("historyType")
    private HistoryType historyType;

    @FieldDescription(title = "Archive from date", value = "Archive from date")
    @QueryParam("archiveFromDate")
    private LocalDate archiveFromDate;

    @FieldDescription(title = "Archive to date", value = "Archive to date")
    @QueryParam("archiveToDate")
    private LocalDate archiveToDate;

    public HistoryParameters() {

    }
    ...
}

Here the stacktrace :

java.lang.IllegalAccessException: Class org.apache.cxf.jaxrs.utils.InjectionUtils can not access a member of class org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) at java.lang.reflect.Method.invoke(Method.java:599) at org.apache.cxf.jaxrs.utils.InjectionUtils.extractFromMethod(InjectionUtils.java:324) at org.apache.cxf.jaxrs.utils.InjectionUtils.extractFromMethod(InjectionUtils.java:316) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1147) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(InjectionUtils.java:1174) at org.apache.cxf.jaxrs.utils.InjectionUtils.extractValuesFromBean(InjectionUtils.java:1109) at org.apache.cxf.jaxrs.client.AbstractClient.addMatrixQueryParamsToBuilder(AbstractClient.java:677) at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleQueries(ClientProxyImpl.java:455) at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:178) at com.sun.proxy.$Proxy78.getHistoryEntries(Unknown Source)


回答1:


I fixed my issue instead of using @QueryParam("") which introspect all attributes, I used @BeanParam annotation but be careful @QueryParam inside the pojo (HistoryParameters in my example) have to be set on setter.



来源:https://stackoverflow.com/questions/26839963/injectionutils-can-not-access-a-member-of-class-datetimezonebuilderprecalculate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!