I’ve seen this behavior when building the model fails (because of a failed
injection or an exception in @PostConstruct ) and then sightly falls back to
the regular java pojo Use provider, which does not support injection (so all
fields are null). Check your logs or debug to see if this is the case.
If that is the problem I recommend you to install
org.apache.sling.scripting.sightly.models.provider, which uses the ModelFactory
service instead of adaptTo to build Sling models. This will make errors more
apparent and you won’t get a fallback to the pojo provider.
Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
santiago.pimen...@netcentric.biz | www.netcentric.biz
> On Sep 20, 2016, at 6:53 AM, Henry Saginor <hsaginor.apa...@gmail.com> wrote:
> Hi All,
> Today we had a production issue with multiple null pointer exceptions in our
> sling models.
> Multiple fields with @Inject annotations were just not getting injected even
> though they were not declared optional. Some of these field were content
> properties and some common sling objects like resource resolver.
> The issue fixed itself after deleting all application bundles, redeploying
> them, and then restarting and refreshing sling models bundles.
> I am curious if anyone else has seeing this. Is this a known issue?
> Sling Models version is 1.1.0.