Page 1 of 1
Error using mhactl_java
Posted: Thu Feb 24, 2022 11:23 pm
by jellison70
Upon following the getting started guide (section 5 pg. 11) I receive the error below after entering mha_query(openmha,'','read:fshift_hilbert_live.cfg') into the matlab command window:
Error using mhactl_java (line 79)
Could not resolve host localhost or could not connect to localhost:59312
Any ideas? I posted a separate issue earlier but this particular error is using Matlab 2021a on a Windows 10 machine.
Thanks in advance.
JE
Re: Error using mhactl_java
Posted: Fri Feb 25, 2022 4:40 pm
by hendrikkayser
Hi,
did you check the Windows firewall settings?
See:
viewtopic.php?p=358#p357
Re: Error using mhactl_java
Posted: Fri Feb 25, 2022 4:59 pm
by jellison70
Yes, I did try this with the firewall disabled as well but still received the same error.
Re: Error using mhactl_java
Posted: Fri Mar 04, 2022 10:47 am
by tobiasherzke
This can also happen when the openMHA has exited because of an error. In this case, the previous error message should be inspected. This seems to have been the case here.
viewtopic.php?t=156
Re: Error using mhactl_java
Posted: Fri Mar 04, 2022 9:11 pm
by jellison70
This particular computer it controlled by my organization's IT dept. I am wondering if there might be some firewall functionality that I am not able to disable. If I run the mha_query command twice it will indicate that it could not connect to localhost: XXXXX. Below is the what occurs in the Matlab command window.
>> openmha = mha_start;
>> mha_query(openmha,'','read:fshift_hilbert_live.cfg');
Error using mhactl_wrapper>mhactl_wrapper_2 (line 64)
An error occured while sending to MHA server:
[1: '?read:fshift_hilbert_live.cfg'] java.net.SocketException: Connection reset
Error in mhactl_wrapper (line 42)
r = interface( handle, query );
Error in mha_query (line 17)
s = mhactl_wrapper( handle, [base '?' query] );
>> mha_query(openmha,'','read:fshift_hilbert_live.cfg');
Error using mhactl_java (line 79)
Could not resolve host localhost or could not connect to localhost:59822
Error in mhactl_wrapper>mhactl_wrapper_2 (line 57)
[r, state] = mhactl_java( h, 'eval', query );
Error in mhactl_wrapper (line 42)
r = interface( handle, query );
Error in mha_query (line 17)
s = mhactl_wrapper( handle, [base '?' query] );
Re: Error using mhactl_java
Posted: Sat Mar 05, 2022 4:24 pm
by tobiasherzke
This may be the case, but a more likely explanation is that openMHA terminates while reading the config file because of some error. Two suggestions:
1) Verify that you can talk twice from Matlab to the openMHA instance before reading the configuration file, e.g.
Code: Select all
mha = mha_start
mha_get(mha,'state') % Without semicolon, should print return value 'unprepared'.
pause(2) % Network connection from Matlab to openMHA auto-closes when idle for 2 seconds IIRC.
mha_get(mha,'state') % Repeat with new connection.
2) Print the stdout and stderr of the openMHA instance (that most likely dies) for further analysis:
Code: Select all
[mha,process] = mha_start
stdout = javaObject('de.hoertech.mha.control.StreamGobbler', ...
process.getInputStream, ... % InputStream is mha's stdout.
true); % Store received text.
stderr = javaObject('de.hoertech.mha.control.StreamGobbler', ...
process.getErrorStream(), true); % Store mha's stderr.
mha_query(mha,'','read:fshift_hilbert_live.cfg'); % Your error happens here.
stdout.get() % Display what openMHA printed to stdout.
stderr.get() % Display what openMHA printed to stderr.