Here is the warning...
08.11.2017 08:46:03.433 *WARN*
org.apache.sling.models.impl.injectors.ResourcePathInjector Could not retrieve resource at path NOT_SELECTED for field bottomMargin. Since it is required it won't be injected.
here is the groovy code:
@Component(value="Thumbnail",tabs = [@Tab(title = "General"), @Tab(title = "Advanced"), @Tab(title = "Override")],group="Basic")
@Model(adaptables=Resource,defaultInjectionStrategy=DefaultInjectionStrategy.OPTIONAL)
@Slf4j
class Thumbnail implements BottomMargin {
....
@Inject
Margin bottomMargin
...
}
Margin is an enum and NOT_SELECTED is the correct value.
Solved! Go to Solution.
Views
Replies
Total Likes
This simply means that there is no property/resource called "NOT_SELECTED".
Views
Replies
Total Likes
For starters - here you are using @Component and @Model annotations.
Check this doc - @Component is not a sling model annotation- never seen them used together - not sure if that is valid.,
2nd - looks like you are trying to use Sling Model to inject node/props - this message indicates that the resource cannot be found at the JCR location.
"Could not retrieve resource at path"
If you want to use JCR node/props and inject them into data members with the @inject annotation - make sure that the nodes are part of the JCR location. See this example --
Scott's Digital Community: Creating Adobe Experience Manager 6.3 Sling Model Components
We successfully inject JCR node properties using @inject. You can get a resource on which to base the sling model like this:
Resource resource = resolver.getResource("/content/testsling/slingmodel");
Hope this helps....
Views
Replies
Total Likes
Sorry, I should have included the imports:
import com.citytechinc.cq.component.annotations.Component
import org.apache.sling.models.annotations.Model
So the wierd part is that NOT_SELECTED is the value for the property bottomMargin.
The property bottomMargin in an enum defined below.
public enum Margin {
@Option(text = "Not Selected")
NOT_SELECTED("")
private String cssClass;
private Margin(String cssClass) {
this.cssClass = cssClass;
}
}
Views
Replies
Total Likes
Are you trying to bind part of your model to JCR nodes located in the repository?
Views
Replies
Total Likes
This simply means that there is no property/resource called "NOT_SELECTED".
Views
Replies
Total Likes
Views
Likes
Replies