Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

closing external JAR/DLL resources properly
 Post subject: closing external JAR/DLL resources properly Post rating: 0   New post Posted: Mon 19 Dec, 2011, 22:29 
User avatar

User rating: 0
Joined: Mon 19 Dec, 2011, 21:54
Posts: 8
Location: Czech Republic, Prague
Dear Support,

I am accessing external JAR file from my strategy via @Library(..) annotation. The JAR itself however reference some other DLL files.

When I run my strategy for the first time, everything works fine. After I stop it, and when I try to run it 2nd time I got error
library XXX already loaded by another classloader

Although I am trying to run finalyse(); and System.gc(); during the onStop it seems there are still some opened references pending.

For obvoius reasons, I don't want to restart JForex client each time I stop my strategy. Could you please advise how to resolve this problem?

Thank you very much in advance.


 
 Post subject: Re: closing external JAR/DLL resources properly Post rating: 0   New post Posted: Tue 20 Dec, 2011, 10:32 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
What libraries are you using?


 
 Post subject: Re: closing external JAR/DLL resources properly Post rating: 0   New post Posted: Tue 20 Dec, 2011, 13:29 
User avatar

User rating: 0
Joined: Mon 19 Dec, 2011, 21:54
Posts: 8
Location: Czech Republic, Prague
I am using MATLAB analytical libraries.

This issue appear only in the context of JForex platform.
When I call same functions repeatedly from Eclipse environment, it works without any problems.
Hereby is the full error message:

SEVERE connect.JForexTaskManager ] Native Library XXX.dll already loaded in another classloader
java.lang.UnsatisfiedLinkError: Native Library XXX.dll already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.fincad.ShowAll.<clinit>(ShowAll.java:1981)
at jforex.Pokus.onStart(Pokus.java:40)
at com.dukascopy.api.impl.execution.s.call(Unknown Source)
at com.dukascopy.api.impl.connect.an.a(Unknown Source)
at com.dukascopy.api.impl.connect.v.call(Unknown Source)
at com.dukascopy.api.impl.connect.v.call(Unknown Source)
at com.dukascopy.api.impl.execution.i.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.e$a.f(Unknown Source)
at com.dukascopy.api.impl.execution.e$a.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


 
 Post subject: Re: closing external JAR/DLL resources properly Post rating: 0   New post Posted: Tue 27 Dec, 2011, 09:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
@Library annotation only supports java libraries (i.e. jar files).


 
 Post subject: Re: closing external JAR/DLL resources properly Post rating: 0   New post Posted: Wed 22 Feb, 2012, 21:44 

User rating: 0
Joined: Fri 17 Feb, 2012, 22:14
Posts: 7
Did you manage to connect matlab and jforex?
i used to try 3 ways and every failed with errors
first is like yours with matlab jar.
second with jni wrapped dll
and third with matlabcontrol library connecting matlab threw java rmi

Every works on standalone java appl, but fails in jforex.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com