활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Dear All,
We have implemented Multifield component along with Model using Resource.
But we are getting null pointer exception when we are trying to get use Resource object.
Core Class:
import org.apache.sling.models.annotations.Model;
import org.apache.sling.api.resource.Resource;
@Model(
adaptables = {Resource.class},
adapters = {MultifieldModel.class},
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL
)
public class MultifieldModelImpl implements MultifieldModel {
@inject
Resource componentResource;
public List<Map<String, String>> getDetailsWithMap() {
List<Map<String, String>> detailsMap=new ArrayList<>();
try {
Resource detailfield=componentResource.getChild("nodename/path");
}
}
}
Multifield Interface :
public interface MultifieldModel {
String getFieldTitle();
List<Map<String,String>> getDetailsWithMap();
}
in component we using this by data sly:
data-sly-use.field="pathtoclass.MultifieldModel"
when we render pages using this Model componentResource(
reosurce object) is giving as null.
This same code is workign fine in Dev env in both author- publisher and in production authors but only giving error in Production publishers.
Request you please suggest things we can modify or check in pub to make it work.
Thanks in advance
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
Suggesting the below given the same code is working fine in DEV and PROD author.
Suggesting the below given the same code is working fine in DEV and PROD author.
Hello Vijayalakshmi_S,
Thank you for your reply.
We have checked that resource is present in crx but when we try to hit that page even with pub ip port it still gives us same error.
I have tried creating new page with multifield components and published the same all changes are reflecting fine but still only that component is not rendering and keep on giving null pointer exception.
조회 수
답글
좋아요 수
Can you confirm if you are accessing the Publish application server with admin login ?
If yes and there is no access related issue, compare the problematic resource with working resource to narrow down the cause.
조회 수
답글
좋아요 수