Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Sharma_Naman3
Community profile Sharma_Naman3 Level 1
Job title here
Location here
3 BADGES
Level 1

Level 1

Learn more
Joined the community 29-08-2017 12:11:01 AM
Offline
Top badges earned by Sharma_Naman3
Customize the badges you want to showcase on your profile
Re: AEM mocks returns Null for @Reference objects (Reques...
Avatar
Give Back 3
Level 1
Sharma_Naman3
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Give Back 3
Give Back
Ignite 1
View profile
Sharma_Naman3
- Adobe Experience Manager
Yes,I am getting null pointer exception at beolow line only in main servlet. HttpServletRequest request = requestResponseFactory.createRequest(HttpConstants.METHOD_GET, path);Logsjava.lang.NullPointerExceptionat de.test.coe.aem.core.servlets.testServlet.getHtmlContent(testServlet.java:93)at de.test.coe.aem.core.servlets.testServlet.doGet(testServlet.java:79)at de.test.coe.aem.core.servlets.testServletTest.doGet(testServletTest.java:90)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method...

Views

793

Likes

0

Replies

0
Re: AEM mocks returns Null for @Reference objects (Reques...
Avatar
Give Back 3
Level 1
Sharma_Naman3
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Give Back 3
Give Back
Ignite 1
View profile
Sharma_Naman3
- Adobe Experience Manager
Hi Manjunath ..Im getting null pointer in the main servlet "getContent" method.//java.lang.NullPointerExceptionHttpServletRequest request = requestResponseFactory.createRequest(HttpConstants.METHOD_GET, path);Test File@testvoid doGet(AemContext context) throws ServletException, IOException, Exception {MockSlingHttpServletRequest request = context.request();MockSlingHttpServletResponse response = context.response();String html = getContent(damPath, (ResourceResolver) request.getResourceResolver()...

Views

815

Likes

0

Replies

0
Re: AEM mocks returns Null for @Reference objects (Reques...
Avatar
Give Back 3
Level 1
Sharma_Naman3
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Give Back 3
Give Back
Ignite 1
View profile
Sharma_Naman3
- Adobe Experience Manager
I am doing it with AemContext only to mock the @Referenceobjec still getting the same issue

Views

806

Likes

0

Replies

0
AEM mocks returns Null for @Reference objects (RequestResponseFactory requestResponseFactory )
Avatar
Give Back 3
Level 1
Sharma_Naman3
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Give Back 3
Give Back
Ignite 1
View profile
Sharma_Naman3
- Adobe Experience Manager
I am trying to mock RequestResponseFactory in my test class but I am getting null pointer exception.Code:String html = "";HttpServletRequest request = requestResponseFactory.createRequest(HttpConstants.METHOD_GET, path);WCMMode.DISABLED.toRequest(request);ByteArrayOutputStream out = new ByteArrayOutputStream();HttpServletResponse response = requestResponseFactory.createResponse(out);try {requestProcessor.processRequest(request, response, (org.apache.sling.api.resource.ResourceResolver) resolver)...

Views

939

Likes

0

Replies

7