Created attachment 110534 [details] Call NPL Solver using macros An operating system and software: Ubuntu 14.04LTS LibreOffice 4.2.7.2, LibreOffice 4.3.2.2, LibreOffice 4.4.0.0.beta1. The error is probably on all versions of LibreOffice Series 4, is not affected by LibreOffice 3 Series and all versions of Apache Open Office. Reproduction of errors (attachment file .ods): Sub RunSolveDEPS Dim Solver as Object Set Solver = CreateUnoService("com.sun.star.comp.Calc.NLPSolver.DEPSSolverImpl") Solver.Document = ThisComponent Dim VariableCells(2) as new com.sun.star.table.CellAddress VariableCells(0).Sheet = 0 VariableCells(0).Row = 1 VariableCells(0).Column = 1 VariableCells(1).Sheet = 0 VariableCells(1).Row = 2 VariableCells(1).Column = 1 VariableCells(2).Sheet = 0 VariableCells(2).Row = 3 VariableCells(2).Column = 1 Solver.Variables = VariableCells Dim ObjectiveCell as new com.sun.star.table.CellAddress ObjectiveCell.Sheet = 0 ObjectiveCell.Row = 3 ObjectiveCell.Column = 3 Solver.Objective = ObjectiveCell ' <== Error !!! ' Type: com.sun.star.uno.RuntimeException ' Message: [jni_uno bridge error] UNO calling Java method Objective: [map_to_uno():com.sun.star.table.CellAddress] null-ref given! ' java stack trace: ' . Solver.Solve End Sub Error message: "Type: com.sun.star.uno.RuntimeException Message: [jni_uno bridge error] UNO calling Java method Objective: [map_to_uno (): com.sun.star.table.CellAddress] null-ref given! java stack trace: . "
Created attachment 110535 [details] Spreadsheet file .ods containing macro Spreadsheet file ods containing macro
Comment on attachment 110534 [details] Call NPL Solver using macros Sub RunSolveDEPS Dim Solver as Object Set Solver = CreateUnoService("com.sun.star.comp.Calc.NLPSolver.DEPSSolverImpl") Solver.Document = ThisComponent Dim VariableCells(2) as new com.sun.star.table.CellAddress VariableCells(0).Sheet = 0 VariableCells(0).Row = 1 VariableCells(0).Column = 1 VariableCells(1).Sheet = 0 VariableCells(1).Row = 2 VariableCells(1).Column = 1 VariableCells(2).Sheet = 0 VariableCells(2).Row = 3 VariableCells(2).Column = 1 Solver.Variables = VariableCells Dim ObjectiveCell as new com.sun.star.table.CellAddress ObjectiveCell.Sheet = 0 ObjectiveCell.Row = 3 ObjectiveCell.Column = 3 Solver.Objective = ObjectiveCell ' <== Error !!! ' Type: com.sun.star.uno.RuntimeException ' Message: [jni_uno bridge error] UNO calling Java method Objective: [map_to_uno():com.sun.star.table.CellAddress] null-ref given! ' java stack trace: ' . Solver.Solve End Sub Sub RunSolveSCO Dim Solver as Object Set Solver = CreateUnoService("com.sun.star.comp.Calc.NLPSolver.SCOSolverImpl") Solver.Document = ThisComponent Dim VariableCells(2) as new com.sun.star.table.CellAddress VariableCells(0).Sheet = 0 VariableCells(0).Row = 1 VariableCells(0).Column = 1 VariableCells(1).Sheet = 0 VariableCells(1).Row = 2 VariableCells(1).Column = 1 VariableCells(2).Sheet = 0 VariableCells(2).Row = 3 VariableCells(2).Column = 1 Solver.Variables = VariableCells Dim ObjectiveCell as new com.sun.star.table.CellAddress ObjectiveCell.Sheet = 0 ObjectiveCell.Row = 3 ObjectiveCell.Column = 3 Solver.Objective = ObjectiveCell ' <== Error !!! ' Type: com.sun.star.uno.RuntimeException ' Message: [jni_uno bridge error] UNO calling Java method Objective: [map_to_uno():com.sun.star.table.CellAddress] null-ref given! ' java stack trace: ' . Solver.Solve End Sub
On pc Debian x86-64 with master sources updated yesterday, I could reproduce this. Stephan: one for you?
Set version 4.1.1.2 to match OO forum report Sept. 2013 (See Also -- https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=64323 ) Set hardware to all because "null-ref" error message is coming from java-uno bridge map_to_uno when it is given a Null l-value for the CellAddress struct that describes the cell that contains the Objective value (value to be minimized). Patch forthcoming.
Patch submitted -- https://gerrit.libreoffice.org/14499 Probem also appears in the User List: http://nabble.documentfoundation.org/Solver-bug-td4134802.html Not sure if there is an immediate patch process possible. It might be possible because the repair is in the AddIn java. However... The corrected AddIn would not install (interface is already there) and the built-in NLPsolver cannot be removed (doesn't appear in Ext Mgr).
http://cgit.freedesktop.org/libreoffice/core/commit/?id=c290998df667bd2a8a12379642f79d09eca471c3 tdf#87074 null-ref error from NLPSolver in Basic
How can I have this macro to work on linux? (Ubuntu 14.04) What do I have to do? I tried to install a more recent package https://packages.debian.org/sid/all/libreoffice-nlpsolver/download but it still did not work
(In reply to koukasio from comment #7) > How can I have this macro to work on linux? (Ubuntu 14.04) > What do I have to do? I tried to install a more recent package > https://packages.debian.org/sid/all/libreoffice-nlpsolver/download > but it still did not work Use LO ppa (see https://launchpad.net/~libreoffice/+archive/ubuntu/ppa) and use last stable LO version (5.0.3). Also, please rename your LO directory profile (see https://wiki.documentfoundation.org/UserProfile#GNU.2FLinux)
Thanks . I had already installed 5.0.3. I deleted my .config/libreoffice folder and a new one was automatically created . Still, the macro returns the same error. I am using the attachment for testing. The nlpsolver is not included in the ppa, I used the old package. I can do things in Linux, I will be able to follow any directions you give me.
(In reply to koukasio from comment #9) > Thanks . I had already installed 5.0.3. I deleted my .config/libreoffice > folder and a new one was automatically created . Still, the macro returns > the same error. I am using the attachment for testing. The nlpsolver is not > included in the ppa, I used the old package. I can do things in Linux, I > will be able to follow any directions you give me. It's perhaps a different error then. Could you provide the precise error and attach a file with a minimal step by step process to reproduce this so we can give it a try? Derka: is it ok for you with LeMoyne Castle's patch?
(In reply to Julien Nabet from comment #10) > It's perhaps a different error then. > Could you provide the precise error and attach a file with a minimal step by > step process to reproduce this so we can give it a try? BASIC runtime error. An exception occurred Type: com.sun.star.uno.RuntimeException Message: [jni_uno bridge error] UNO calling Java method Objective: [map_to_uno():com.sun.star.table.CellAddress] null-ref given! java stack trace: . and the "Solver.Objective = ObjectiveCell ' <== Error !!! " line gets highlighted in the macro editor I just push the "Run DEPS Solver" button on the attachment above. > > Derka: is it ok for you with LeMoyne Castle's patch? No, I would need a bit more guidance.
In LibreOffice 5.0.3.2 nlpsolver works without error. Thanks, good job (Ubuntu 14.04.3, 64 bit)
Koukasio: since Derka confirmed it's ok, please submit a new bug.
Derka: I tried everything.. updated to 14.04.3 (64bit) - uninstalled-purged-reinstalled several times... deleted my /config/libreoffice folder... before submitting a new bug: What else is there that could make the difference between you and me? What jre are you using? Are you using the attachment above for testing? Are you using the "nlpsolver 0.9~beta1-9ubuntu1" package from apt?
Currently installed on my system: java version "1.7.0_91" OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode) Package "nlpsolver ~ 0.9 beta 1-ubuntu" is not used. It introduced "libobasis5.0-extension-nlpsol 5.0.3.2-2", which is part of LibreOffice 5.0.3.2.
That last info was trivial. Thanks. I installed from .deb files from http://www.libreoffice.org/download/libreoffice-fresh/?type=deb-x86_64&version=5.0.3&lang=en-US and everything worked fine. When installed from ppa there is no nlpsolver. Thanks everyone for the great work.