Matlab Snippet - ERROR Matlab Snippet 0:212 Execute failed: ("NullPointerException"): null

Hi everyone,

i have some difficulities to use the matlab snippet for a process which inkl. an object oriented Matlab lib.
Matlab Version 2018b ; Knime Version 4.1.2

I get an error:
ERROR Matlab Snippet 0:212 Execute failed: (“NullPointerException”): null

I tried the code out of knime and it worked. The funny thing is that the code is also working from knime. The last step is writing a xml, but I receive an error and a red crossed matlab snippet. image

The red cross blocks the workflow. Is there anything I should change in my preferences?

Thank you in advance,
Pedram

Hi @Pedram

NullPointerExceptions are the worst :slight_smile: :dizzy_face:

concerning the préférences you need to make sure, that the Matlab type is the one you use in the script.

Also using an Open in Matlab node and executing the script there might provide some mor details to what is happening.

Felix

1 Like

Red lines in Matlab

Started from KNIME (MATLAB scripting integration)
Reconnecting to this session of MATLAB will not be possible
matlabcontrol.MatlabConnectionException: Could not register this session of MATLAB
at matlabcontrol.MatlabBroadcaster.bindSession(MatlabBroadcaster.java:111)
at matlabcontrol.MatlabBroadcaster.broadcast(MatlabBroadcaster.java:71)
at matlabcontrol.MatlabConnector$EstablishConnectionRunnable.run(MatlabConnector.java:170)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: matlabcontrol.MatlabSession (no security manager: RMI class loader disabled)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:389)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at matlabcontrol.MatlabBroadcaster.bindSession(MatlabBroadcaster.java:109)
… 7 more
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: matlabcontrol.MatlabSession (no security manager: RMI class loader disabled)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(RegistryImpl_Skel.java:78)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:468)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:300)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: matlabcontrol.MatlabSession (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:556)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:646)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:311)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:265)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1800)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1748)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2042)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(RegistryImpl_Skel.java:76)
… 14 more
KNIME: exectuted snippet and updated mOut.

Red lines in KNIME:

ERROR Matlab Snippet 0:238 Execute failed: (“NullPointerException”): null

I think the first part of the error is from the startup of matlab. When connecting to Matlab, there is always the initial error.

The last line says:

so the note should have been able to execute, since this message is pretty much the last line.

To get to the bottom of this. I suggest you use the Open in MATLAB node, execute the script yourself from MATLAB and then check, what you find in the variable mOut.
My suspicion is, that either mOut is empty, or that the MATLAB types do not match - meaning mOut has to be of the type you set in your preferences.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.