Sling resolver differences in OSGi vs JEE Adaptive Forms

liviu_chis19 26-01-2016

I recently tried migrating an adaptive form from an OSGI AEM Forms instance on a Mac (I know it's for dev only but I would hope this works) to a JEE instance via the package manager and received some errors.

It seemed as though the OSGi instance sets its sling:resourceType properties using relative paths, which would make sense coming from a Sites background. So when I look at the structure in crx/de, I see

<path_to_form>/jcr:content/guideContainer/layout -> sling:resourceType=fd/af/layouts/defaultGuideLayout which is a relative path

When importing to JEE, this gives me the following error: javax.servlet.jsp.JspException: Could not find script fd/af/layouts/defaultGuideLayout/defaultGuideLayout.jsp

If I then go into crx/de and manually change that to an absolute path - <path_to_form>/jcr:content/guideContainer/layout -> sling:resourceType=/libs/fd/af/layouts/defaultGuideLayout, the problem goes away. This is strange because all other components have relative sling:resourceTypes and have no problem.

Even stranger is the error I got when I assigned the "Caption and Error on Top of Widget inside the Field box" in the Configure Field Layout dropdown of the Styling tab on a field in the form. Again, this gave an error when moving the package to JEE due to relative paths. Setting that value in OSGi set the following property:

<path_to_field_node> -> fieldLayout=fd/af/layouts/field/afCaptionErrorOnTop

Again, on JEE, that gave the error: javax.servlet.jsp.JspException: Could not find script fd/af/layouts/field/afCaptionErrorOnTop

 

I then tried setting that value directly on my JEE server to see what it would be set to. Sure enough, it's an absolute path again - /libs/fd/af/layouts/field/afCaptionErrorOnTop/afCaptionErrorOnTop.jsp. Notice this time however, that it points right to the script, not to the component.

Digging around in the forms components in crx/de, I found the json request that populates the aforementioned dropdown, can be seen at /libs/fd/af/components/guidefield/dialog/items/styling/items/fieldLayout

Running that script in the browser on OSGi revealed, as you would expect, a json object with value of fd/af/layouts/field/afCaptionErrorOnTop, the relative path that it wrote in crx/de, whereas running that same script in JEE returned a json object with the absolute path to the script. So it seems like AEM knows in which cases a relative vs an absolute script is required, but seeing as it's seems to be environment specific, it makes migration very difficult.

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (3)

Answers (3)

liviu_chis19 02-02-2016

Thanks, that did seem to fix it for me! How any forms were migrated between JEE and OSGi before this FP is beyond me though... Can't image why paths would be set differently between the two versions.

MSwezey23 27-01-2016

I'm seeing the same in our customer's TST (Author) and PRD (Publish) Instances.

 

Now that I've updated the relative paths to absolute paths I get this: 

 

No renderer for extension html, cannot render resource JcrNodeResource, type=fd/afaddon/components/summary, superType=null, path=/content/forms/af/..............jcr:content/guideContainer/rootPanel/....items/summary

 

Update #2 

fd/afaddons under libs is missing along with a lot of another packages that my author instance already has.