Hi Santiago,

Thank for a reply.

To clarify this is not a build issue. Fields were just not injected at runtime. 
In most cases this resulted in null pointer exception in post constructor 
method or code calling adaptTo to get the required model. It gets the models 
class and gets NPE on the field it expects to be there. Note that the model 
gets instantiated. The injection just does not occur even though the fields to 
be injected are available. If it did not get instantiated because of a missing 
field (missing content property) that would be expected behavior. It’s like the 
framework just fails to detect that there is a field that needs to be injected. 

Also, this is not a sightly integration issue. We have some sightly components. 
But in this case in all instances I found it was in a JSP or a servlet calling 

> On Sep 20, 2016, at 2:27 AM, Santiago Garcia Pimentel 
> <santiago.pimen...@netcentric.biz> wrote:
> Hi Henry,
> 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
> M: +34687915463
> 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.
>> Henry

Reply via email to