Skip to content

NullPointerException on htmlunit.WebClient.getPage #310

Description

@lrpowell

Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at com.gargoylesoftware.htmlunit.html.HtmlPage.cleanUp(HtmlPage.java:360)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:456)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:368)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:541)
at com.ibm.as400.pt.viewer.script.RunPDIReport.exportDispatchServlet(RunPDIReport.java:477)
at com.ibm.as400.pt.viewer.script.RunPDIReport.doLoginAndExport(RunPDIReport.java:407)
at com.ibm.as400.pt.viewer.script.RunPDIReport.main(RunPDIReport.java:178)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.gargoylesoftware.htmlunit.javascript.host.WebSocket.close(WebSocket.java:408)
at com.gargoylesoftware.htmlunit.javascript.host.WebSocket.close(WebSocket.java:377)
at com.gargoylesoftware.htmlunit.html.HtmlPage.cleanUp(HtmlPage.java:357)
... 7 more
Caused by: java.lang.NullPointerException
at com.gargoylesoftware.htmlunit.websocket.JettyWebSocketAdapter.closeClinet(JettyWebSocketAdapter.java:135)
at com.gargoylesoftware.htmlunit.javascript.host.WebSocket.close(WebSocket.java:405)
... 9 more

**The dispatch request is : **

WebRequest[<url="http://localhost:9080/Navigator/DispatcherServlet/perf/loadPerspectives", POST, EncodingType[name=application/x-www-form-urlencoded], [], {Cookie=JSESSIONID=0000zGsxZkz6VSlx5FVsoC1SgaW:8f560a86-b308-4406-8092-29d0c4eb66be, Accept=/, Accept-Encoding=gzip, deflate, Content-Type=application/json}, null>]

The code is:

	URL loadPerspUrl = new URL("http://"+getSystemName()+":9080/Navigator/DispatcherServlet/perf/loadPerspectives");
	WebRequest requestSettings = new WebRequest(loadPerspUrl, HttpMethod.POST);
	requestSettings.setAdditionalHeader("Content-Type", "application/json");
	requestSettings.setAdditionalHeader("Cookie", m_cookie_jsessionid);

	Page redirectPage = webClient.getPage(requestSettings);  // line 477 **exception occurs here **
	webClient.waitForBackgroundJavaScriptStartingBefore(10000);
		
	WebResponse response = redirectPage.getWebResponse();

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions