IgnitionModuleDevelopmentCommunity / Kafka

Kafka extension for Ignition
Apache License 2.0
2 stars 4 forks source link

404 Error When Trying to Call .getConsumer #6

Open fuzzygreenblurs opened 3 years ago

fuzzygreenblurs commented 3 years ago

Hello,

I am working on a simple project to transmit simulated device data generated by Ignition (on Docker) to a Kafka broker that I have running locally. I am trying to leverage this module to do this.

Could you share some thoughts on next steps to troubleshoot the 404 error below?

So far, these are the steps I have taken:

serverPath = 'server:9093'
# consumer = system.kafka.getSSLConsumer(serverPath,'topicname','groupname') # if SSL is desired
consumer = system.kafka.getConsumer(serverPath,'topicname','groupname') # If ssl is not required
for record in consumer:
    print record["value"], record["timestamp"],record["offset"],record["key"],record["partition"]

The resulting stack trace raises a 404 error as follows:

Java Traceback:
Traceback (most recent call last):
  File "<input>", line 2, in <module>
    at com.sun.proxy.$Proxy61.RPCGetConsumer(Unknown Source)
    at org.ignitionmdc.apache.kafka.Kafka_Com.getConsumer(Kafka_Com.java:13)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.reflect.UndeclaredThrowableException: java.lang.reflect.UndeclaredThrowableException

    at org.python.core.Py.JavaError(Py.java:552)
    at org.python.core.Py.JavaError(Py.java:543)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
    at org.python.core.PyObject.__call__(PyObject.java:515)
    at org.python.core.PyObject.__call__(PyObject.java:519)
    at org.python.pycode._pyx122.f$0(<input>:3)
    at org.python.pycode._pyx122.call_function(<input>)
    at org.python.core.PyTableCode.call(PyTableCode.java:171)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.Py.runCode(Py.java:1614)
    at org.python.core.Py.exec(Py.java:1658)
    at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)
    at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:131)
    at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:605)
    at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:593)
    at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy61.RPCGetConsumer(Unknown Source)
    at org.ignitionmdc.apache.kafka.Kafka_Com.getConsumer(Kafka_Com.java:13)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
    ... 19 more
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Post Error, error code = 404
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:347)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:468)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:283)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
    at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.moduleInvokeSafe(GatewayInterface.java:908)
    at com.inductiveautomation.ignition.client.gateway_interface.ModuleRPCFactory$DynamicRPCHandler.invoke(ModuleRPCFactory.java:53)
    ... 26 more

Thank you for your time!

Kevin-McClusky commented 3 years ago

Couple quick questions:

1) Have you tried setting the serverPath to match your server address from your command line Kafka invocations? localhost:9092, it looks like from your comments. 2) What version of Ignition are you using? And can you confirm the module's status isn't showing anything abnormal? (i.e. it's not showing as quarantined on the module status or config pages, there aren't any error messages in Status -> Log, etc)