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

JAVA API : Mega Exception : Native Object is not connected

jmartin
Senior Member

Hi,

I have an issue using Java API and trying to instanciate a MegaApplication.
I'm using MEGA 2009 SP4 CP15 JAVA API (coz this the client version of MEGA)

My code :

MegaApplication mgApplication = new MegaApplication(mg_application_path);

logger.add("MegaApplication created");

logger.add("Test mgApplication : " + mgApplication.name()); //ERROR at this line

where "mg_application_path"  is the absolute path of MEGA "System" repository on the machine i try to run the java code.

The stackTrace :
"29 nov. 2013 11:28:56 utils.LogSystem add

INFO: MegaApplication created 

com.mega.modeling.api.MegaException: Native object is not connected
        at com.mega.modeling.api.jni.MegaSiteJNI.Name(Native Method)
        at com.mega.modeling.api.jni.MegaSiteProxy.name(Unknown Source)
        at megaConnection.MegaConnect.<init>(MegaConnect.java:33)
        at application.TraitementControle.main(TraitementControle.java:36)"

My question is what does this exception ("Native object is not connected') means exactly ? and How to pass it ?

Moreover when I try to use this code :

MegaApplication mgApplication = new MegaApplication();  //ERROR at this line

logger.add("MegaApplication created");

logger.add("Test mgApplication : " + mgApplication.name());


and the stackTrace :

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: C
:\Program Files\MEGA\mega711\System\mg_jnib.dll
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at com.mega.modeling.api.jni.MappModuleJNI.Ensure(Unknown Source)
        at com.mega.modeling.api.jni.MappModuleJNI.SetMegaSitePath(Unknown Source)
        at com.mega.modeling.api.jni.MappModuleJNI.CreatePathInstance(Unknown Source)
        at com.mega.modeling.api.MegaApplication.<init>(Unknown Source)
        at megaConnection.MegaConnect.<init>(MegaConnect.java:31)
        at application.TraitementControle.main(TraitementControle.java:36)

I don't understand why he is looking for mg_jnib.dll in this repository, where does the mega711 come from ?
Also I did a /regserver to be sure that windows registry were up to date with MEGA environment variables.

Thanks in advance for any information you can give me.

Martin Julien.


 

1 Reply

davidpena
MEGA Partner
MEGA Partner

Check JRE.

 

Your JRE must be the native from MEGA java --> Jre.