cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java API: MegaRoot.getSelection() Error

alros
Super Contributor

The following API-Code produces an error in HOPEX V1R2:

 

MegaColloection coll = root.getSelection("SELECT [Anwendung] WHERE [Name] = \"PDB\"");

The stack trace is quite uninformative:

 

MegaException : MEGA Error 0x80020009(ERQL Request failure) : ERQL Request failure: SELECT [Anwendung] WHERE [Name] = "PDB"
    at com.mega.modeling.api.jni.MegaRootJNI.getGetSelection(null:-2)
    at com.mega.modeling.api.jni.MegaRootProxy.getSelection(null:53)

And the error log shows:

 

Thread(2856);Time(14:31:55);Session();error Application: 0x0100800E: ThreadStorage.cpp(516)
Thread(2856);Time(14:31:55);Session();              Unsuccessful search
Thread(2856);Time(14:31:55);Session();Error trace : ThreadStorage.cpp(526) 
Thread(2856);Time(14:31:55);Session();Error trace : apisession.cpp(4517) 
Thread(2856);Time(14:31:55);Session();Error trace : metamodelitem.cpp(366) 
Thread(2856);Time(14:31:55);Session();Error trace : mtidse.cpp(1576) 
Thread(2856);Time(14:31:55);Session();Error trace : apiuse.cpp(1540) 
Thread(2856);Time(14:31:55);Session();Error trace : ErqlClSemantic.cpp(102) 
Thread(2856);Time(14:31:55);Session();Error trace : ErqlClSemantic.cpp(918) 
Thread(2856);Time(14:31:55);Session();Error trace : ErqlClSemantic.cpp(1156) 
Thread(2856);Time(14:31:55);Session();Error trace : ErqlClSemantic.cpp(909) 
Thread(2856);Time(14:31:55);Session();Error trace : ErqlClSemantic.cpp(1156) 
Thread(2856);Time(14:31:55);Session();Error trace : ErqlClSemantic.cpp(49) 

Thread(2856);Time(14:31:55);Session();error Private: 0x0000047F: ErqlClSemantic.cpp(78)
Thread(2856);Time(14:31:55);Session();              Interner Fehler beim Kompilieren der Abfrage.
Thread(2856);Time(14:31:56);Session();Error trace : ErqlCl.cpp(207) 
Thread(2856);Time(14:31:56);Session();Error trace : ErqlEmbeded.cpp(972) 
Thread(2856);Time(14:31:56);Session();Error trace : autoobject.cpp(3867) 

Plus the message alert "Interner Fehler beim Kompilieren der Abfrage" (~ Internal error while compiling the query).

The error persists if we use megaField strings instead of "[Anwendung]" etc. ("~asbsdfsdf[Anwendung]"). The exact same query works fine in the GUI.

 

Even the most basic query "SELECT [Anwendung]" in all thinkable variants (such as "SELECT [Application]") doesn't work anymore from the API. In MEGA 2009 CP5, everything was fine.

Is there a way to fix this for HOPEX?

1 Reply

alros
Super Contributor

The error is caused by accessing a MegaRoot in a Multithreaded environment when the MetaCommand is already finished. Maybe MEGA somehow invalidates the MegaRoot after the original call is done. See my follow-up question.