I’m attempting to create a connection between a linux Ignition webdev site (8.1) using system.net.httpClient that calls another site’s webdev via an API using doGet. I’ve been able to successfully create a connection with a client that’s using 8.1. I’m now attempting to create a connection to a client that’s using 7.9 which has an https with an error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I can use postman to connect to this same 7.9 gateway’s webdev site but using linux’s webdev is unsuccessful. I tried opening the 443 port on the 7.9 client’s firewall with no luck. I am guessing that this is a certification issue where I need to place a copy of the certificate for the client’s webdev on the linux’s ignition folder.
If so, where do I download this certificate. If not, what would be the next step for me to create this connection?
Is your Linux gateway even able to bind to the HTTPS port? By default services on Linux can't bind to ports < 1024. You have to set up your service files to allow it with some extra capabilities:
I decided to change how we are doing the gateways and opened the 8088 port too. I am still getting the same error however with the same setup. So I’m narrowing down on the issue, it doesn’t have to do with the https port.
With postman, I am getting a correct response but when I’m using the Linux Ignition to call the server I get a 500 error.
In the logs at the SERVER NAME site, I get the following:
java.lang.NullPointerException: null
at org.eclipse.jetty.server.ResponseWriter.write(ResponseWriter.java:248) at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doRequest(PythonResourceHandler.java:341) at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doGet(PythonResourceHandler.java:502) at com.inductiveautomation.webdev.gateway.servlets.WebDevDispatch.doGet(WebDevDispatch.java:134)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:518)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Unknown Source)
I am unsure at what this log is telling me. There are functions from the jython being pulled but that’s about all I understand. Does anyone have some thoughts on what is keeping the server from responding?
This indicates a programming bug inside Jetty, the underlying third party webserver framework we use. This is the 7.9 gateway, correct? You can try upgrading to the latest 7.9 in case we've updated to a patch release of Jetty that has a fix, but if you're already on the latest or we haven't updated 7.9 to a version of Jetty with a fix there's nothing for you to do.
OK getting closer on this. I have a gateway with 7.9.21 and it still doesn’t work. BUT! It’s a different error which I have below.
The concern is that I have postman sending the exact same data to this 7.9.21 gateway and I am getting a proper response. But not from my linux gateway (8.1.45). What is failing?
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 21, in doGet AttributeError: 'NoneType' object has no attribute 'get'
at org.python.core.Py.AttributeError(Py.java:173)
at org.python.core.PyObject.noAttributeError(PyObject.java:930)
at org.python.core.PyObject._getattr_(PyObject.java:925)
at org.python.pycode._pyx172.doGet$1(:59)
at org.python.pycode._pyx172.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
at org.python.core.PyFunction.function___call__(PyFunction.java:376)
at org.python.core.PyFunction._call_(PyFunction.java:371)
at org.python.core.PyFunction._call_(PyFunction.java:361)
at org.python.core.PyFunction._call_(PyFunction.java:356) at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:649) at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doRequest(PythonResourceHandler.java:286) at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doGet(PythonResourceHandler.java:499) at com.inductiveautomation.webdev.gateway.servlets.WebDevDispatch.doGet(WebDevDispatch.java:134)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)
at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
at java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 21, in doGet AttributeError: 'NoneType' object has no attribute 'get'
That one's more straightforward - it's a logic error in your code on line 21. You're trying to call a get function on some reference, but that reference turns out to be null/None.
Here’s the response now after I fixed the line 21 error. It’s different from the original error log but still a little close. What error is java:256 on the Jetty?
java.lang.NullPointerException: null
at org.eclipse.jetty.server.ResponseWriter.write(ResponseWriter.java:256) at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doRequest(PythonResourceHandler.java:338) at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doGet(PythonResourceHandler.java:499) at com.inductiveautomation.webdev.gateway.servlets.WebDevDispatch.doGet(WebDevDispatch.java:134)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)
at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
OK I am narrowing down on this issue. I tried having the 7.9 code just return a “Hello World” when it received a request from 8.1 and that worked! The issue is how to pull the data from the request in 7.9.
In 8.1 I am using a system.net.httpClient() sending a json body as the data. On the 7.9 Ignition, I am receiving it by using this line of code.
params = request.get('data')
The problem is this line. When this line is processed in 7.9 from the 8.1 httpClient request, the error above repeats itself. Whenever I use Postman with the same situation, 7.9 is able to get the requested data.
Could this be because 7.9 doesn’t have system.net.httpClient? Or perhaps I’m botching the request.get(‘data’) line and it should be something else entirely? Any thoughts?
Yeah, I think you want to be implementing doPost on the receiving side, and you might have better luck pulling out request["postData"] instead of request["data"]:
(This is the 8.3 manual, but this part of Webdev hasn't changed from 7.9).