Error using mhactl_java

Post Reply
jellison70
Posts: 8
Joined: Thu Feb 24, 2022 6:59 pm

Error using mhactl_java

Post by jellison70 » Thu Feb 24, 2022 11:23 pm

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

hendrikkayser
Posts: 38
Joined: Fri May 10, 2019 7:58 am

Re: Error using mhactl_java

Post by hendrikkayser » Fri Feb 25, 2022 4:40 pm

Hi,
did you check the Windows firewall settings?
See: viewtopic.php?p=358#p357

jellison70
Posts: 8
Joined: Thu Feb 24, 2022 6:59 pm

Re: Error using mhactl_java

Post by jellison70 » Fri Feb 25, 2022 4:59 pm

Yes, I did try this with the firewall disabled as well but still received the same error.

tobiasherzke
Posts: 119
Joined: Mon Jun 24, 2019 12:51 pm

Re: Error using mhactl_java

Post by tobiasherzke » Fri Mar 04, 2022 10:47 am

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

jellison70
Posts: 8
Joined: Thu Feb 24, 2022 6:59 pm

Re: Error using mhactl_java

Post by jellison70 » Fri Mar 04, 2022 9:11 pm

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] );

tobiasherzke
Posts: 119
Joined: Mon Jun 24, 2019 12:51 pm

Re: Error using mhactl_java

Post by tobiasherzke » Sat Mar 05, 2022 4:24 pm

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.

Post Reply