Expand my Community achievements bar.

AEM 6.2 to 6.5 - NoClassFoundDefError & Jackson Exception (Bean Mapping Failed)

Avatar

Level 2

Problem Description – Attached the logs for reference.

-          We have three bundles in our project common, integration, ui-business. All the three bundles are in active state post upgrade from AEM 6.2 to AEM 6.5.

-          But few of the components in integration and ui-business were in unsatisfied state instead of active state.

-          We noticed No Class Found Error Exceptions in the logs

Scenario

1. We were getting no class found errors when a java class of integration or ui-business bundle imports a java class (having Fasterxml Jackson imports) from the other bundle - - common bundle

-          To fix this, we have added <Embed-Dependency>jackson-annotations;scope=runtime|compile,jackson-databind;scope=runtime|compile,jackson-core;scope=runtime|compile</Embed-Dependency> in the POM files of integration and ui-business.

-          After this POM changes all the components related to project became active.

-          Now we are getting another Jackson exception related to date parsing, this is occurring while mapping web service json response to a bean class using Jackson mapper object.

Attached the logs for your reference.

2. Jackson Exception

-          We have Fasterxml Jackson json annotations in the bean class which tells important configuration like date format required for parsing while mapping web service response to the bean class.

But somehow in runtime, none of the Jackson annotations present in the bean class (common) are recognized

The logic for mapping using Jackson api is written in Integration bundle. 

Sample bean class – Our assumption is none of the below Jackson annotations are recognized in runtime in integration bundle where Jackson mapper object is trying to map web service response json to below bean class present in common bundle.

@JsonIgnoreProperties(ignoreUnknown = true)

@JsonInclude(Include.NON_NULL)

public class Bean extends AbstractDefaultBean {

       private Date registered;

              @JsonDeserialize(using = CustomDateDeserializer.class)

              public Date getRegistered() {

                    return this.registered;

              }

              @JsonDeserialize(using = CustomDateDeserializer.class)

              public void setRegistered(Date registered) {

                    this.registered = registered;

       }

}

-          Does anyone notice similar issue, please provide your suggestion

0 Replies