# Post error

**URL:** <https://forum.inductiveautomation.com/t/post-error/5180>\
**Category:** Ignition\
**Created:** [September 25, 2012, 9:55am UTC](https://forum.inductiveautomation.com/t/post-error/5180 "2012-09-25T09:55:07Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [September 25, 2012, 9:55am UTC](https://forum.inductiveautomation.com/t/post-error/5180/1 "2012-09-25T09:55:07Z")

</div>

one of my users asked me to access ignition by port 80, but i have it on the default port.  
so i made a port forwarding on the server external firewall, and now i have this situation:  
ext 8088 goes to 8088 (for all users)  
ext 80 goes to 8088 too (for him)  
it’s not a best practice, i know, anyway:  
designer and clients go right when opened on the 8088.  
when opened on the 80 i get an exception on the client when it launches the first sql query (the query is correct and tested):

Error executing system.db.runScalarQuery(…)  
caused by Exception: Error executing system.db.runScalarQuery(…)  
caused by GatewayException: Connection reset  
caused by SocketException: Connection reset

the entire exception:

[code]Traceback (most recent call last):  
File “event:actionPerformed”, line 17, in   
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:322)  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runScalarQuery(AbstractDBUtilities.java:316)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
at java.lang.reflect.Method.invoke(Unknown Source)

java.lang.Exception: java.lang.Exception: Error executing system.db.runScalarQuery(SELECT ETC (removed) ETC, , )  
at org.python.core.PyException.fillInStackTrace(PyException.java:70)  
at java.lang.Throwable.(Throwable.java:181)  
at java.lang.Exception.(Unknown Source)  
at java.lang.RuntimeException.(Unknown Source)  
at org.python.core.PyException.(PyException.java:46)  
at org.python.core.PyException.(PyException.java:43)  
at org.python.core.Py.JavaError(Py.java:481)  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:322)  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runScalarQuery(AbstractDBUtilities.java:316)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
at java.lang.reflect.Method.invoke(Unknown Source)  
at org.python.core.PyReflectedFunction. **call** (PyReflectedFunction.java:186)  
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. **call** (ScriptManager.java:455)  
at org.python.core.PyObject. **call** (PyObject.java:387)  
at org.python.core.PyObject. **call** (PyObject.java:391)  
at org.python.pycode.\_pyx4.f$0(event:actionPerformed:26)  
at org.python.pycode.\_pyx4.call\_function(event:actionPerformed)  
at org.python.core.PyTableCode.call(PyTableCode.java:165)  
at org.python.core.PyCode.call(PyCode.java:18)  
at org.python.core.Py.runCode(Py.java:1261)  
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:539)  
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:155)  
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:266)  
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)  
at $Proxy13.actionPerformed(Unknown Source)  
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)  
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)  
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)  
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)  
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)  
at java.awt.Component.processMouseEvent(Unknown Source)  
at javax.swing.JComponent.processMouseEvent(Unknown Source)  
at java.awt.Component.processEvent(Unknown Source)  
at java.awt.Container.processEvent(Unknown Source)  
at java.awt.Component.dispatchEventImpl(Unknown Source)  
at java.awt.Container.dispatchEventImpl(Unknown Source)  
at java.awt.Component.dispatchEvent(Unknown Source)  
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)  
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)  
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)  
at java.awt.Container.dispatchEventImpl(Unknown Source)  
at java.awt.Window.dispatchEventImpl(Unknown Source)  
at java.awt.Component.dispatchEvent(Unknown Source)  
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)  
at java.awt.EventQueue.access$000(Unknown Source)  
at java.awt.EventQueue$1.run(Unknown Source)  
at java.awt.EventQueue$1.run(Unknown Source)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)  
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)  
at java.awt.EventQueue$2.run(Unknown Source)  
at java.awt.EventQueue$2.run(Unknown Source)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)  
at java.awt.EventQueue.dispatchEvent(Unknown Source)  
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)  
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)  
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)  
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
at java.awt.EventDispatchThread.run(Unknown Source)  
Caused by: java.lang.Exception: Error executing system.db.runScalarQuery(SELECT ETC (removed) ETC, , )  
… 56 more  
Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Connection reset  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.newGatewayException(GatewayInterface.java:312)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.getResponse(GatewayInterface.java:450)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:248)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:243)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.runLimitQuery(GatewayInterface.java:698)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.runQuery(GatewayInterface.java:657)  
at com.inductiveautomation.ignition.client.script.ClientDBUtilities.\_runQuery(ClientDBUtilities.java:148)  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runScalarQuery(AbstractDBUtilities.java:309)  
… 54 more  
Caused by: java.net.SocketException: Connection reset  
at java.net.SocketInputStream.read(Unknown Source)  
at java.io.BufferedInputStream.fill(Unknown Source)  
at java.io.BufferedInputStream.read1(Unknown Source)  
at java.io.BufferedInputStream.read(Unknown Source)  
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)  
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)  
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)  
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)  
at java.net.HttpURLConnection.getResponseCode(Unknown Source)  
at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.getResponse(GatewayInterface.java:374)  
… 60 more

Ignition v7.5.3 (b1163)  
Java: Sun Microsystems Inc. 1.6.0\_33  
[/code]

can i solve with a better forwarding policy or by a better configuration?  
thank you

---

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [September 25, 2012, 2:35pm UTC](https://forum.inductiveautomation.com/t/post-error/5180/2 "2012-09-25T14:35:38Z")

</div>

My suggestion would be an HTTP redirect, assuming that your user is still allowed access to port 8088, but just doesn’t want to have to type it in.

Setup a separate webserver on port 80 that issues a 302 to redirect to the ignition address.

I’ve messed with port forwarding and whilst I did manage to get it to work, it can be somewhat fragile. I think the gateway constructs a URL for the clients to use, and sometimes the forwarding confuses it so it ends up issuing a URL which only works internally.

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [September 26, 2012, 7:37am UTC](https://forum.inductiveautomation.com/t/post-error/5180/3 "2012-09-26T07:37:12Z")

</div>

i got working on that. it’s a clean and easy way to get things working, thanks for the advice.  
why a 302 and not a Permanent 301 redirect?

---

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [September 26, 2012, 8:10am UTC](https://forum.inductiveautomation.com/t/post-error/5180/4 "2012-09-26T08:10:05Z")

</div>

It depends how you want the URL to be interpreted.

301 means ‘this resource used to live here, but now it lives over there’.  
302 means ‘this resource is accessible here, but you need to get it from over there.’

In this case, you are declaring a shortcut. That shortcut is a valid way to access the resource so a 302 would be preferable. If you use a permanent redirect most (some? all?) browsers will update their bookmarks automatically, as the old URL is deemed to be invalid.

Say you have [ignition.example.com](http://ignition.example.com), which won’t change even if the server or port changes.

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [September 27, 2012, 9:13am UTC](https://forum.inductiveautomation.com/t/post-error/5180/5 "2012-09-27T09:13:48Z")

</div>

i tried both 301 and 302, but i have a very very strange error:  
the connection to the gateway is now direct:  
ext 80 -\> 80 (Ignition port)  
ext 443 -\> 443 (Ignition ssl port)

if i execute a query in the designer (and also in the client) like this:  
SELECT Homepage, IF(COUNT(Homepage)=0,‘Pannello’,Homepage) FROM users WHERE Username = ‘x’  
i get no errors, but on  
SELECT IF(COUNT(Homepage)=0,‘Pannello’,Homepage) FROM users WHERE Username = ‘x’  
i get the post error:  
GatewayException: Post Error, error code = 403  
why?!?!  
thank you

---

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [September 27, 2012, 11:08am UTC](https://forum.inductiveautomation.com/t/post-error/5180/6 "2012-09-27T11:08:28Z")

</div>

That sounds very strange. Does it work right if you set everything back to normal?

If you write two similar queries from scratch do they also work/break respectively? My only thought at the moment is that there might be some strange query-specific connection address caching, but even that sounds really silly.

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [September 27, 2012, 11:35am UTC](https://forum.inductiveautomation.com/t/post-error/5180/7 "2012-09-27T11:35:34Z")

</div>

any query with the IF(COUNT(…)=0,) structure break on designer and on client.  
i’m solving with a side action: i’m changing queries, using the fallback value instead of the COUNT()=0 system…  
ugly solution, but works. “silly” is not enough for this situation! 😮  
thank you systemparadox

---

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [October 1, 2012, 8:26am UTC](https://forum.inductiveautomation.com/t/post-error/5180/8 "2012-10-01T08:26:16Z")

</div>

It would be nice to try and track down this error a bit more.

If you set all of the ports back to normal, does it work as expected?

I’ve never seen IF and COUNT used like that before, but I made up a test and it seems to work on my setup.

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [October 1, 2012, 6:47pm UTC](https://forum.inductiveautomation.com/t/post-error/5180/9 "2012-10-01T18:47:20Z")

</div>

Can you get us a full stack trace of that “403” error? Also, to confirm, your DB is on a different machine than the Ignition gateway is on, but is on the same local network as the Ignition machine, is that correct?

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [October 12, 2012, 2:11pm UTC](https://forum.inductiveautomation.com/t/post-error/5180/10 "2012-10-12T14:11:15Z")

</div>

no, my DB is on the same machine.  
as said, i solved changing query structure…

anyway the port changing produced a new error, as explained here [viewtopic.php?f=72&t=6581&p=30198#p30198](http://www.inductiveautomation.com/forum/viewtopic.php?f=72&t=6581&p=30198#p30198)
