Hi Igor,

thanks for your reply, I've added this code:

Snippet

void Ignition::DestroyJVM()
    {
       factoryLock.Enter();

       JniErrorInfo jniErr;

       SharedPointer<JniContext> ctx(JniContext::Create(0, 0,
JniHandlers(), &jniErr));

       IgniteError err;
       IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);

       if(err.GetCode() == IgniteError::IGNITE_SUCCESS)
          ctx.Get()->DestroyJvm();

       factoryLock.Leave();
    }

And call it before the FreeLibrary(), now when I call the start I got a
unknow error. Any ideas?

Thanks,
   F.D.


On Mon, Jan 28, 2019 at 5:08 PM Igor Sapego <[email protected]> wrote:

> Hi,
>
> Currently, Ignite on start creates JVM instance internally, but
> it never stops it. Also, it currently can not work with already started
> JVM.
>
> So when you start Ignite the first time, it loads JVM, when you stop
> and unload it, the JVM remains loaded in process memory. When
> you start Ignite again, it discovers that JVM was already loaded, and
> as it can not work with pre-loaded JVM, it just returns you the error.
>
> To solve the issue, the following ticket should be implemented [1], but
> currently, it is not. As a workaround you may try to call
> JNI_DestroyJavaVM() after you have unloaded Ignite, I'm not sure
> of the result though. This is simply is not a use case we have tested.
>
> [1] - https://issues.apache.org/jira/browse/IGNITE-4618
>
> Best Regards,
> Igor
>
>
> On Mon, Jan 28, 2019 at 3:49 PM F.D. <[email protected]> wrote:
>
>> Hi Igniters,
>> I'm trying to use Ignite in a dll (using c++) that is dinamically loaded.
>> I wrapped the method start/end/... bihind a "c" pure interface that I
>> export.
>>
>> It works quite well. I can call the LoadLibrary and start a Ignite node.
>> I can stop it and restart it again smoothly.
>>
>> I've the problem when I LoadLibrary and then I call FreeLibrary (and
>> until here it works), but when I try to LoadLibrary again and to start the
>> node, I get the error: Failed to initialize JVM* [errCls=, errMsg=JVM
>> already created.]*
>>
>> Do you any ideas why I got this error?
>>
>> Thanks,
>>    F.D.
>>
>

Reply via email to