Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

NullPointerException in TesterClientImpl.connect()
 Post subject: NullPointerException in TesterClientImpl.connect() Post rating: 0   New post Posted: Thu 26 Sep, 2019, 11:20 

User rating: 1
Joined: Tue 20 Mar, 2012, 09:03
Posts: 39
Caused by - java.lang.NullPointerException: null
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1690)
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.getOrCreateListenersSet(FeedDataProvider.java:3190) *
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.addCacheDataUpdatedListener(FeedDataProvider.java:2477) *
      * at com.dukascopy.charts.data.datacache.IntraperiodCandlesGenerator.<init>(IntraperiodCandlesGenerator.java:140) *
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.<init>(FeedDataProvider.java:286) *
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.<init>(FeedDataProvider.java:234) *
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.createFeedDataProvider(FeedDataProvider.java:367) *
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.createFeedDataProvider(FeedDataProvider.java:341) *
      * at com.dukascopy.charts.data.datacache.FeedDataProvider.createFeedDataProvider(FeedDataProvider.java:331) *
      * at com.dukascopy.api.impl.connect.TesterClientImpl.connect(TesterClientImpl.java:255) *
      * at com.dukascopy.api.impl.connect.TesterClientImpl.connect(TesterClientImpl.java:221) *
      * at de.invesdwin.trading.jforex.runtime.JForexRuntimeProperties.getAvailableInstrumentsFromTesterClient(JForexRuntimeProperties.java:57) *


(I guess Instrument.values() somehow contains null values due to some initialization race condition on first connect?)

The code that is doing the connect is:

    private static Set<Instrument> getAvailableInstrumentsFromTesterClient()
            throws JFAuthenticationException, JFVersionException, Exception {
        final ITesterClient client = TesterFactory.getDefaultInstance();
        try {
            if (!client.isConnected()) {
                client.connect(JFOREX_JNLP_URL.toString(), JFOREX_JNLP_USERNAME, JFOREX_JNLP_PASSWORD);
            }
            final Set<Instrument> availableInstruments = client.getAvailableInstruments();
            return availableInstruments;
    }


This happens only recently after I have upgraded to the current version of jforex:
<version.jforex-3-sdk>[3.6.5,)</version.jforex-3-sdk>
<version.jforex-api>[2.13.76,)</version.jforex-api>
<version.greed-common>[318.4.87,)</version.greed-common>
<version.dds2-charts>[6.24.89,)</version.dds2-charts>


 
 Post subject: Re: NullPointerException in TesterClientImpl.connect() Post rating: 0   New post Posted: Fri 04 Oct, 2019, 09:31 

User rating: 0
Joined: Wed 21 Mar, 2012, 22:02
Posts: 4
The nullpointer did not occur anymore for a few days now. Though I experience tick messages stopping to arrive after a few minutes of running. All threads are then idle, no deadlocks. I am connected from multiple machines to my permanent demo account. All of them stop after some individual time between a few minutes and a few hours (tested with a simple strategy that logs the tick time in the handler method). Though Client.isConnected still reports being connected.


 
 Post subject: Re: NullPointerException in TesterClientImpl.connect() Post rating: 0   New post Posted: Fri 04 Oct, 2019, 09:43 

User rating: 0
Joined: Wed 21 Mar, 2012, 22:02
Posts: 4
And I am getting lots of these errors then:
Caused by - com.dukascopy.api.JFException: Error while loading ticks
      * at com.dukascopy.api.impl.HistoryData.getTicksSecured(HistoryData.java:103) *
      * at com.dukascopy.api.impl.History.lambda$getTicks$4(History.java:370) *
      * at com.dukascopy.api.impl.History.lambda$doPrivileged$116(History.java:3498) *
        at java.base/java.security.AccessController.doPrivileged(Native Method)
      * at com.dukascopy.api.impl.History.doPrivileged(History.java:3498) *
      * at com.dukascopy.api.impl.History.getTicks(History.java:368) *
      * at de.invesdwin.trading.jforex.broker.instrument.internal.data.tick.JForexTickCache.getTicks(JForexTickCache.java:406) *


 
 Post subject: Re: NullPointerException in TesterClientImpl.connect() Post rating: 0   New post Posted: Fri 04 Oct, 2019, 12:07 

User rating: 0
Joined: Wed 21 Mar, 2012, 22:02
Posts: 4
Nope, the initially reported error is still happening as of today. I guess I was just lucky the last few days.
Maybe there is a race condition with multiple java processes using the same demo account login?


 
 Post subject: Re: NullPointerException in TesterClientImpl.connect() Post rating: 0   New post Posted: Thu 10 Oct, 2019, 08:19 

User rating: 0
Joined: Wed 21 Mar, 2012, 22:02
Posts: 4
I verified that the connection drops occur even when only one client is connected to the account.

Now it got worse that even the exception is not thrown, instead the client just does not receive any tick events


 

Jump to:  

cron
  © 1998-2011 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