Problem with advanced mode using scilab within Eclipse

classic Classic list List threaded Threaded
6 messages Options
jm.gauthier jm.gauthier
Reply | Threaded
Open this post in threaded view
|

Problem with advanced mode using scilab within Eclipse

This post was updated on .
Hello,

I'am trying to package an Eclipse plugin that calls the Scilab engine through the org.scilab.modules.javasci API.

The following is what I want to do:

Scilab sci = new Scilab(true);
sci.open();

String command = "loadXcosLibs(); importXcosDiagram("PathToMyXCosFile.zcos");xcos_simulate(scs_m, 4);";
sci.exec(command);


This piece of code works very well inside a JUnit test. However when embedded in an eclipse plugin, it thrown the following error message inside the console (all the paths are defined, and I have a lib folder which contains all the required jar file, including the required modules):

java.lang.ClassCastException: org.scilab.modules.history_manager.HistoryPrefs cannot be cast to org.scilab.modules.commons.xml.XConfigurationListener
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363) at pc=0x000007fefbd1a06d, pid=11568, tid=12744
#
# JRE version: Java(TM) SE Runtime Environment (8.0_91-b14) (build 1.8.0_91-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.91-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [KERNELBASE.dll+0x1a06d]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Softwares\eclipse_mdt_neon_M3\hs_err_pid11568.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

In addition, I have included all the jar files inside the Classpath of the MANIFEST.MF (Runtime tab). Note that, when the advanced mode is disabled (new Scilab() ), it works well with simple commands (advanced mode is required to load XCos diagram and launch simulation).

Please, find the hs_err_pid11568.log file. I'am using Eclipse Neon 64b with Java 1.8 64b and Scilab 5.5.2 64b.

Thank you in advance for your helps.  

Clément David-2 Clément David-2
Reply | Threaded
Open this post in threaded view
|

Re: Problem with advanced mode using scilab within Eclipse

Hello Jean-Marie,

> java.lang.ClassCastException:
> org.scilab.modules.history_manager.HistoryPrefs cannot be cast to
> org.scilab.modules.commons.xml.XConfigurationListener

Could you try to debug the caller of this code ? This seems related to some configuration file but
as we use introspection for that part, it is hard to get more info without a stacktrace.

Thanks,

--
Clément

Le dimanche 22 mai 2016 à 15:06 -0700, jm.gauthier a écrit :

> Hello, 
>
> I'am trying to package an Eclipse plugin that calls the Scilab engine throw
> the org.scilab.modules.javasci API. 
>
> The following is what I want to do: 
>
> /Scilab sci = new Scilab(true);
> sci.open();
>
> String command = "loadXcosLibs();
> importXcosDiagram("PathToMyXCosFile.zcos");xcos_simulate(scs_m, 4);"; 
> sci.exec(command);/
>
> This piece of code works very well inside a JUnit test. However when
> embedded in an eclipse plugin, it thrown the following error message inside
> the console (all the paths are defined, and I have a lib folder which
> contains all the required jar file (including the required modules): 
>
> java.lang.ClassCastException:
> org.scilab.modules.history_manager.HistoryPrefs cannot be cast to
> org.scilab.modules.commons.xml.XConfigurationListener
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363) at pc=0x000007fefbd1a06d,
> pid=11568, tid=12744
> #
> # JRE version: Java(TM) SE Runtime Environment (8.0_91-b14) (build
> 1.8.0_91-b14)
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.91-b14 mixed mode
> windows-amd64 compressed oops)
> # Problematic frame:
> # C  [KERNELBASE.dll+0x1a06d]
> #
> # Failed to write core dump. Minidumps are not enabled by default on client
> versions of Windows
> #
> # An error report file with more information is saved as:
> # C:\Softwares\eclipse_mdt_neon_M3\hs_err_pid11568.log
> #
> # If you would like to submit a bug report, please visit:
> #   http://bugreport.java.com/bugreport/crash.jsp
> # The crash happened outside the Java Virtual Machine in native code.
> # See problematic frame for where to report the bug.
> #
>
> In addition, I have included all the jar files inside the Classpath of the
> MANIFEST.MF (Runtime tab). 
> Please, find the  hs_err_pid11568.log
> <http://mailinglists.scilab.org/file/n4034100/hs_err_pid11568.log>   file.
> I'am using Eclipse Neon 64b with Java 1.8 64b and Scilab 5.5.2 64b.
>
> Thank you in advance for your helps.  
>
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Problem-with-advanced-mode-using-scil
> ab-within-Eclipse-tp4034100.html
> Sent from the Scilab developers - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
jm.gauthier jm.gauthier
Reply | Threaded
Open this post in threaded view
|

Re: Problem with advanced mode using scilab within Eclipse

Hello Clément,

Thank you for your answer.

Actually the error occurs when sci.open() is invoked. I get the source code of the org.scilab.module.xxxx.jars (from here: git clone git://git.scilab.org/scilab) and attached them to each jars in order to go deeper inside the debugging process.

The error appear at the follwing call:



I am sorry, line number are not available...I don't know really why the Eclipse debugger didn't succeed to indicate the line number of the scilab sources. Maybe the sources version is not the same as the jar of Scilab 5.5.2 ? Anyway, it is the only stack trace I can provide for the moment. The console shows the same error message as in the last post (with hs_err_pid11568.log file).

Hope it helps.

Thank you.
Clément David-2 Clément David-2
Reply | Threaded
Open this post in threaded view
|

Re: Problem with advanced mode using scilab within Eclipse

Hello Jean-Marie,

Le mercredi 25 mai 2016 à 06:55 -0700, jm.gauthier a écrit :

> I am sorry, line number are not available...I don't know really why the
> Eclipse debugger didn't succeed to indicate the line number of the scilab
> sources. Maybe the sources version is not the same as the jar of Scilab
> 5.5.2 ? Anyway, it is the only stack trace I can provide for the moment. The
> console shows the same error message as in the last post (with
> hs_err_pid11568.log file). 

To have the debug stacktrace you have to compile Scilab with java debug enabled using :
./configure --enable-debug-java

After a quick look at XConfiguration.java on the Scilab source, it seems that you need :

 1. Scilab commons and Scilab localizarion modules loaded
   (the JARs are on classpath and dll/so files are on the librarypath)
 2. SCI defined as an environnement variable
 3. Scilab history_manager module loaded

HistoryPrefs could be casted to XConfigurationListener as it implements directly this interface :
`public class HistoryPrefs implements XConfigurationListener`. there is probably a memory corruption
somewhere.

To debug that you can load the HistoryPrefs on your code explicitly. This might probably produce a
more precise error.

Do not hesitate to tell us your advancement as we can pre-load things explicitly on JavaSci
directly,

Thanks,

--
Clément
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
danielN danielN
Reply | Threaded
Open this post in threaded view
|

Re: Problem with advanced mode using scilab within Eclipse

Hi everybody, I have the same problem in Scilab 5.5.2 (Windows 10).

In normal mode I can open and comunicate with Scilab.
But I want to use graphics in the script I want to open from Java. If I use advanced Mode it crashes.
I Use Eclipes. Your Tips doesnt work. What am I doing wrong ?

Picture:


And I get a PopUp from Java: If Scilab is used froim Java, make sure that your IDE is not adding extra dependencies wich could not be found at runtime


Thanks,

Daniel
Clément David-2 Clément David-2
Reply | Threaded
Open this post in threaded view
|

Re: Problem with advanced mode using scilab within Eclipse

Hi Daniel,

Le mercredi 01 février 2017 à 00:29 -0700, danielN a écrit :
> our Tips doesnt work. What am I doing wrong ?
>
> Picture:
> <http://mailinglists.scilab.org/file/n4035434/FehlerMeldung.png

This error is due to a mis-initialization of Scilab (either a missing jar, missing dll/so, missing
"SCI" or "SCIHOME") we used to launch scilab [1]. To have a full backtrace and ease your
developments, I suggest you to use local jar built with debugging enabled ; you will be the line
thus the missing thing.

[1]: http://cgit.scilab.org/cgit.cgi/scilab/tree/scilab/modules/commons/src/java/org/scilab/modules/
commons/xml/XConfiguration.java#n74

Thanks,

--
Clément
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev