You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (Jira)" <ji...@apache.org> on 2020/10/05 11:31:00 UTC

[jira] [Updated] (SLING-9478) Expose the full stack trace for PostConstruct exceptions

     [ https://issues.apache.org/jira/browse/SLING-9478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Edelson updated SLING-9478:
----------------------------------
    Fix Version/s:     (was: Sling Models Impl 1.4.14)
                   Sling Models Impl 1.4.16
                   Sling Models Impl 1.4.16

> Expose the full stack trace for PostConstruct exceptions
> --------------------------------------------------------
>
>                 Key: SLING-9478
>                 URL: https://issues.apache.org/jira/browse/SLING-9478
>             Project: Sling
>          Issue Type: Improvement
>          Components: Sling Models
>    Affects Versions: Sling Models Impl 1.4.12
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>            Priority: Major
>             Fix For: Sling Models Impl 1.4.16
>
>
> Currently any InvocationTargetException is stripped in https://github.com/apache/sling-org-apache-sling-models-impl/blob/80b1dea63615ea5be8252241d6147bce9552fa8e/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java#L756 as it is replaced by the more generic PostConstruct exception stripping the the reflection part of the call stack.
> That may lead to exceptions like
> {code}
> Caused by: org.apache.sling.scripting.sightly.SightlyException: org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Identifier <MyModel> cannot be correctly instantiated by the Use API
> 	at com.adobe.cq.sightly.WCMScriptHelper.includeScript(WCMScriptHelper.java:227) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
> 	at com.adobe.cq.sightly.internal.extensions.IncludeExtension.call(IncludeExtension.java:72) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
> 	at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:77) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
> 	at org.apache.sling.scripting.sightly.apps.bruker.components.structure.header.header_html.render(header_html.java:41)
> 	at org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:50) [org.apache.sling.scripting.sightly.runtime:1.1.0.1_4_0]
> 	at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:60) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386) [org.apache.sling.scripting.core:2.0.56]
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.0.56]
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.0.56]
> 	... 198 common frames omitted
> Caused by: org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Identifier <MyModel> cannot be correctly instantiated by the Use API
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:510) [org.apache.sling.scripting.core:2.0.56]
> 	at com.adobe.cq.sightly.WCMScriptHelper.includeScript(WCMScriptHelper.java:222) [com.adobe.cq.sightly.cq-wcm-sightly-extension:1.6.0]
> 	... 206 common frames omitted
> Caused by: org.apache.sling.scripting.sightly.SightlyException: Identifier <MyModel> cannot be correctly instantiated by the Use API
> 	at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:77) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
> 	at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:77) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
> 	at org.apache.sling.scripting.sightly.apps.bruker.components.structure.header.content_html.render(content_html.java:43)
> 	at org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:50) [org.apache.sling.scripting.sightly.runtime:1.1.0.1_4_0]
> 	at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:60) [org.apache.sling.scripting.sightly:1.1.2.1_4_0]
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386) [org.apache.sling.scripting.core:2.0.56]
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.0.56]
> 	at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.0.56]
> 	... 207 common frames omitted
> Caused by: org.apache.sling.models.factory.PostConstructException: Post-construct method has thrown an exception for model class <MyModel>
> 	at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:774) [org.apache.sling.models.impl:1.4.10]
> 	at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:448) [org.apache.sling.models.impl:1.4.10]
> 	at org.apache.sling.models.impl.ModelAdapterFactory.createModel(ModelAdapterFactory.java:314) [org.apache.sling.models.impl:1.4.10]
> 	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]
> 	... 214 common frames omitted
> Caused by: java.lang.NullPointerException: null
> {code}
> In that case it would be helpful to see the stack traces in between to have a better idea, where the NPE is triggered.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)