Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form core components breaks AEM core components implementation #817

Open
koffieislekker opened this issue Aug 14, 2023 · 3 comments
Open

Comments

@koffieislekker
Copy link

I have an AEM project that already installs the aem core components (2.22.12). I am not sure why the forms core components also embedds the aem core components (which I think causes the issue) since this can be installed/seperatly in your project pom.xml

Expected Behaviour

When trying to extend the AEM core components I expect the core component to be able to be injected properly.

Actual Behaviour

When installing the forms core component the aem sites project that extend an AEM core component breaks.

Reproduce Scenario (including but not limited to)

Adding a simple List implementation java class that injects the Core components List component breaks the component.

Steps to Reproduce

  1. Create a project
    mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=43 -D appTitle="My Site" -D appId="mysite" -D groupId="com.mysite" -D aemVersion=6.5.17 -D includeExamples=y -D includeFormscommunications=y -D includeFormsenrollment=y

  2. Create a simple List class (Could be any core component class)

  3. Go to the generated en.html (project must be built first) and add the List component to the page.

Platform and Version

Windows 11
Java 11.0.19

AEM Version (mention the exact version in case of cloud SDK)

AEM 6.5.17

AEM Forms Version

adobe-aemfd-win-pkg-6.0.968

Sample Code that illustrates the problem

package com.mysite.core.models;

@model(adaptables = SlingHttpServletRequest.class, adapters = {List.class}, resourceType =
MyCustomListImpl.RESOURCE_TYPE)
public class MyCustomListImpl implements List {

protected static final String RESOURCE_TYPE = "mysite/components/list";

@Self
@Via(type = ResourceSuperType.class)
private List list;

@Override
public Collection<ListItem> getListItems() {
    return list.getListItems();
}

}

Logs taken while reproducing problem

Caused by: org.apache.sling.models.factory.MissingElementsException: Could not inject all required fields into class com.mysite.core.models.MyCustomListImpl
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:754) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:428) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.createModel(ModelAdapterFactory.java:282) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.scripting.sightly.models.impl.SlingModelsUseProvider.provide(SlingModelsUseProvider.java:126) [org.apache.sling.scripting.sightly.models.provider:1.0.8]
at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:72) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
... 441 common frames omitted
Suppressed: org.apache.sling.models.factory.MissingElementException: Could not inject private com.adobe.cq.wcm.core.components.models.List com.mysite.core.models.MyCustomListImpl.list
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:738) [org.apache.sling.models.impl:1.4.16.B0002]
... 445 common frames omitted
Caused by: org.apache.sling.models.factory.ModelClassException: Could not create model from class org.apache.sling.models.impl.via.AbstractResourceTypeViaProvider$ResourceTypeForcingRequestWrapper: Could not inject all required fields into class com.mysite.core.models.MyCustomListImpl
at org.apache.sling.models.impl.ModelAdapterFactory.adapt(ModelAdapterFactory.java:1059) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.adaptIfNecessary(ModelAdapterFactory.java:1034) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.setField(ModelAdapterFactory.java:977) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.access$200(ModelAdapterFactory.java:115) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory$SetFieldCallback.inject(ModelAdapterFactory.java:475) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.injectElement(ModelAdapterFactory.java:575) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:733) [org.apache.sling.models.impl:1.4.16.B0002]
... 445 common frames omitted
Caused by: org.apache.sling.models.factory.MissingElementsException: Could not inject all required fields into class com.mysite.core.models.MyCustomListImpl
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:754) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:428) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.adapt(ModelAdapterFactory.java:1053) [org.apache.sling.models.impl:1.4.16.B0002]
... 451 common frames omitted
Suppressed: org.apache.sling.models.factory.MissingElementException: Could not inject private com.adobe.cq.wcm.core.components.models.List com.mysite.core.models.MyCustomListImpl.list
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:738) [org.apache.sling.models.impl:1.4.16.B0002]
... 453 common frames omitted
Caused by: org.apache.sling.models.factory.ModelClassException: Could not create model from class org.apache.sling.models.impl.via.AbstractResourceTypeViaProvider$ResourceTypeForcingRequestWrapper: Could not inject all required fields into class com.mysite.core.models.MyCustomListImpl
at org.apache.sling.models.impl.ModelAdapterFactory.adapt(ModelAdapterFactory.java:1059) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.adaptIfNecessary(ModelAdapterFactory.java:1034) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.setField(ModelAdapterFactory.java:977) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.access$200(ModelAdapterFactory.java:115) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory$SetFieldCallback.inject(ModelAdapterFactory.java:475) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.injectElement(ModelAdapterFactory.java:575) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:733) [org.apache.sling.models.impl:1.4.16.B0002]
... 453 common frames omitted
Caused by: org.apache.sling.models.factory.MissingElementsException: Could not inject all required fields into class com.mysite.core.models.MyCustomListImpl
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:754) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:428) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.adapt(ModelAdapterFactory.java:1053) [org.apache.sling.models.impl:1.4.16.B0002]
... 459 common frames omitted
Suppressed: org.apache.sling.models.factory.MissingElementException: Could not inject private com.adobe.cq.wcm.core.components.models.List com.mysite.core.models.MyCustomListImpl.list
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:738) [org.apache.sling.models.impl:1.4.16.B0002]
... 461 common frames omitted
Caused by: org.apache.sling.models.factory.ModelClassException: No injector returned a non-null value!
at org.apache.sling.models.impl.ModelAdapterFactory.injectElement(ModelAdapterFactory.java:615) [org.apache.sling.models.impl:1.4.16.B0002]
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:733) [org.apache.sling.models.impl:1.4.16.B0002]
... 461 common frames omitted

@royteeuwen
Copy link

@koffieislekker did this ever get solved or did you create an adobe support ticket for this?

@barshat7
Copy link
Contributor

@koffieislekker Can you try with the latest version for 6.5? It should be fixed in the 1.3.2 version

@rismehta
Copy link
Collaborator

rismehta commented Mar 5, 2024

@royteeuwen @koffieislekker I have created a hotfix for this over 6.5.17, https://github.com/adobe/aem-core-forms-components/releases/tag/core-forms-components-reactor-1.1.27-wcmB004.

Kindly verify whether this hotfix resolves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants