Problem with invoke call from Java

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with invoke call from Java

Olaf Lüke
Hi,

Our project has the following general setup:

* Octave calls a Java method from a jar, which controls some hardware.
* Some time later the hardware gives information back to Java.
* Java then calls invoke (from OctaveReference) to give information from
the hardware back to Octave.

You can take a look at the project here:
http://www.tinkerforge.com/en/doc/Software/API_Bindings_MATLAB.html

The source itself is located here:
http://download.tinkerforge.com/bindings/matlab/tinkerforge_matlab_bindings_2_0_0.zip



I recently updated my Ubuntu box to 14.04 which updated my Octave from
version 2.6.4 to 2.8.1. With the new version the last part of our
approach doesn't work anymore. I tried lots of different configurations
and so on, every time the octave.jar internally calls doInvoke (which is
a native function of liboctinterp) we get the following exception:

java.lang.UnsatisfiedLinkError:
org.octave.Octave.doInvoke(I[Ljava/lang/Object;)V
        at org.octave.Octave.doInvoke(Native Method)
        at org.octave.OctaveReference.invoke(OctaveReference.java:54)

In theory this should mean that either the liboctinterp.so is not loaded
or the function doInvoke is not present in the lib. But as far as i can
tell it is loaded and the method is implemented properly.

I already tried to add a

static {
  System.loadLibrary("octinterp");
}

in the Octave.java and recompiled the octave.jar. The liboctinterp does
load, but i still get the exception.

The problem is also present if i compile the latest version of Octave
from source myself (instead of using the Ubuntu package).

What could be the problem and what can i do to debug this?

Thanks!

Olaf Lüke


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problem with invoke call from Java

Philip Nienhuis
Olaf Lüke wrote
Hi,

Our project has the following general setup:

* Octave calls a Java method from a jar, which controls some hardware.
* Some time later the hardware gives information back to Java.
* Java then calls invoke (from OctaveReference) to give information from
the hardware back to Octave.

You can take a look at the project here:
http://www.tinkerforge.com/en/doc/Software/API_Bindings_MATLAB.html

The source itself is located here:
http://download.tinkerforge.com/bindings/matlab/tinkerforge_matlab_bindings_2_0_0.zip



I recently updated my Ubuntu box to 14.04 which updated my Octave from
version 2.6.4 to 2.8.1. With the new version the last part of our
approach doesn't work anymore. I tried lots of different configurations
and so on, every time the octave.jar internally calls doInvoke (which is
a native function of liboctinterp) we get the following exception:

java.lang.UnsatisfiedLinkError:
org.octave.Octave.doInvoke(I[Ljava/lang/Object;)V
        at org.octave.Octave.doInvoke(Native Method)
        at org.octave.OctaveReference.invoke(OctaveReference.java:54)

In theory this should mean that either the liboctinterp.so is not loaded
or the function doInvoke is not present in the lib. But as far as i can
tell it is loaded and the method is implemented properly.

I already tried to add a

static {
  System.loadLibrary("octinterp");
}

in the Octave.java and recompiled the octave.jar. The liboctinterp does
load, but i still get the exception.

The problem is also present if i compile the latest version of Octave
from source myself (instead of using the Ubuntu package).

What could be the problem and what can i do to debug this?
No hints, merely counter questions:

I suppose you upgraded Octave from 3.6.4 to 3.8.1, not from 2.6.4 to 2.8.1?

What Java version do you have installed? 32 or 64 bit?

32 or 64 bit OS?

Another thing (that you do not mention): did you try to install the OF Java package in 3.8.1? (3.8.1 should have Java support built in). What does:
octave_config_info ("features").JAVA
give?

The exception mentions:
org.octave.Octave.doInvoke(I[Ljava/lang/Object;)V
which contains intruiging syntax ("I[L" and a trailing "V")
Could there be a code page or locale issue?

I tried a few commands from the examples in http://www.tinkerforge.com/en/doc/Software/Bricklets/AnalogIn_Bricklet_MATLAB.html#analog-in-bricklet-matlab-examples; it just works fine til the ipcon.connect statement, as obviously I have no suitable hardware installed here. (And I suppose it is part of the first two parts that work for you as well).
Note: I use javaObject rather than java_new (should be in OF java-1.2.8 as well; OF-java is (was) at 1.2.9)

So would you have a few lines of code that do not need the HW and that do show the problem?

Finally, I'd say if it worked in 3.6.4 & OF-Java, it should work in 3.8.1 w built-in Java support.

Philip
Reply | Threaded
Open this post in threaded view
|

Re: Problem with invoke call from Java

Olaf Lüke
In reply to this post by Olaf Lüke
Sorry for the late answer, at first i didn't see your post. Please add
my Email address as CC, since i am not actually subscribed to the
mailing list.

> I suppose you upgraded Octave from 3.6.4 to 3.8.1, not from 2.6.4 to
> 2.8.1?
Yes, i meant 3.*.*

> What Java version do you have installed? 32 or 64 bit?
I tested on both 32 and 64 bit.

> 32 or 64 bit OS?
I tested on 32 bit hardware with 32 bit OS and on 64 bit hardware with
64 bit OS.

> Another thing (that you do not mention): did you try to install the OF
> Java package in 3.8.1? (3.8.1 should have Java support built in). What
> does:
> octave_config_info ("features").JAVA
> give?
octave:1> octave_config_info ("features").JAVA
ans =  1

> The exception mentions:
> org.octave.Octave.doInvoke(I[Ljava/lang/Object;)V
> which contains intruiging syntax ("I[L" and a trailing "V")
> Could there be a code page or locale issue?
I am no Java expert so i am not sure what these characters mean. But i
think i have seen them before in other Exceptions. So i don't think it
has anything to do with the problem. If i start octave with "LANG=EN" i
get the same exception.

> I tried a few commands from the examples in
>
http://www.tinkerforge.com/en/doc/Software/Bricklets/AnalogIn_Bricklet_MATLAB.html#analog-in-bricklet-matlab-examples; > it just works fine til the ipcon.connect statement, as obviously I
> have no suitable hardware installed here. (And I suppose it is part of
> the first two parts that work for you as well).
> Note: I use javaObject rather than java_new (should be in OF
> java-1.2.8 as well; OF-java is (was) at 1.2.9)
We should replace java_new with javaObject in the examples, yes. But
that is not the problem, java_new is deprecated but still implemented in
the newest octave version.

> So would you have a few lines of code that do not need the HW and that
> do show the problem?
I reproduced the problem with a minimal example:
http://download.tinkerforge.com/_stuff/octave/

How i compiled it is described in the comments of the files. I also
attached the .class that i used for testing. Perhaps you can try to
compile it yourself and also try to use my .class. This way we can find
out if my Java environment has a problem.

> Finally, I'd say if it worked in 3.6.4 & OF-Java, it should work in
> 3.8.1 w built-in Java support.
I agree, but it doesn't :-). Iit is probably just some small thing that
i am overlooking.

Thank you for the help!

Olaf Lüke


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problem with invoke call from Java

Philip Nienhuis
Olaf Lüke wrote
Philip Nienhuis wrote:
> What Java version do you have installed? 32 or 64 bit?
I tested on both 32 and 64 bit.

> 32 or 64 bit OS?
I tested on 32 bit hardware with 32 bit OS and on 64 bit hardware with
64 bit OS.
One thing to watch out for is to mix 32-bit compiled Octave with 64-bit Java (and v.v.). At least on my (64-bit Windows) boxes that doesn't work.

<snip>
> So would you have a few lines of code that do not need the HW and that
> do show the problem?
I reproduced the problem with a minimal example:
http://download.tinkerforge.com/_stuff/octave/

How i compiled it is described in the comments of the files. I also
attached the .class that i used for testing. Perhaps you can try to
compile it yourself and also try to use my .class. This way we can find
out if my Java environment has a problem.
Too bad that I lack time in the coming weeks (conference + preparation - the latter as usual in my own time). I am sorry.
(In addition I gave up on trying to compile Java stuff - I find 1+ GB of mostly junk (NetBeans) just to compile a few lines of code a ridiculous waste of HD space and I've never gotten ant to work properly :-(  There must be an easier way using the JDK-supplied tools but I could never assign priority to sorting it out.  So AFAIU it's good that you supply a class lib :-) )

Maybe someone else can help out soon, or perhaps I do find some quiet spell.

Philip