softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

I followed instruction correctly. But I can't connect IB with error messages. #85

Closed kevinhedgefund closed 4 years ago

kevinhedgefund commented 4 years ago

AccountSummaryExample Warning: The following error was caught while executing 'TWS.Session' class destructor: Dot indexing is not supported for variables of this type.

Error in TWS.Session/delete (line 83) this.eClientSocket.eDisconnect();

Error in TWS.Session (line 15) function this = Session()

Error in TWS.Session.getInstance (line 94) localInstance = TWS.Session();

Error in AccountSummaryExample (line 9) session = TWS.Session.getInstance();

In TWS.Session (line 15) In TWS.Session.getInstance (line 94) In AccountSummaryExample (line 9) Error using ProxyBuilder/resolveClassForMethod (line 170) Java exception occurred: java.lang.SecurityException: sealing violation: package com.ib.client is sealed at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:399) at java.net.URLClassLoader.definePackageInternal(URLClassLoader.java:419) at java.net.URLClassLoader.defineClass(URLClassLoader.java:451) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.getDeclaredMethods(Class.java:1975)

Error in ProxyBuilder/initForMethod (line 114) targetClass = this.resolveClassForMethod(varargin{1});

Error in TWS.Session (line 24) [this.proxy,~] = proxyBuilder.initForMethod('TWSNotification','TWS.processNotification');

Error in TWS.Session.getInstance (line 94) localInstance = TWS.Session();

Error in AccountSummaryExample (line 9) session = TWS.Session.getInstance();

ibapi version is 9.73.02. java version is 1.8.0-241. OS is macOS Catalina v10.15.3. Matlab version is R2019a.

softwarespartan commented 4 years ago

Thanks for opening an issue. This usually happens if the Mathworks Trader Toolbox is installed also. The trader toolbox installs version of the API on the Java class path that i've not been able to get in front of, so requires choosing which one to have installed. I realize that's not optimal.

kevinhedgefund commented 4 years ago

Thanks for your reply!! I uninstalled Matlab and reinstalled without a trading toolbox. But, I have the same error. So, It seems like the errors aren't from the trading toolbox.

softwarespartan commented 4 years ago

OK, a few things come to mind here

  1. can you just copy paste the output of the ver command (remove you're license number though). For example, I just did reinstall a few days ago and mine is

    >> ver
    -----------------------------------------------------------------------------------------------------
    MATLAB Version: 9.7.0.1247435 (R2019b) Update 2
    MATLAB License Number: XXXXXXXX
    Operating System: Mac OS X  Version: 10.15.3 Build: 19D76 
    Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
    -----------------------------------------------------------------------------------------------------
    MATLAB                                                Version 9.7         (R2019b)
    Automated Driving Toolbox                             Version 3.0         (R2019b)
    Communications Toolbox                                Version 7.2         (R2019b)
    Computer Vision Toolbox                               Version 9.1         (R2019b)
    DSP System Toolbox                                    Version 9.9         (R2019b)
    Deep Learning Toolbox                                 Version 13.0        (R2019b)
    Image Processing Toolbox                              Version 11.0        (R2019b)
    MATLAB Coder                                          Version 4.3         (R2019b)
    Parallel Computing Toolbox                            Version 7.1         (R2019b)
    Phased Array System Toolbox                           Version 4.2         (R2019b)
    Signal Processing Toolbox                             Version 8.3         (R2019b)
    Statistics and Machine Learning Toolbox               Version 11.6        (R2019b)
  2. Can you also share the command you use to add the IB4m/Jar/TWS973.jar to your java path?

  3. Finally, can you confirm you're getting exactly same error message after you've removed trading toolbox?

The error

java.lang.SecurityException: sealing violation: package com.ib.client is sealed

likely indicates the wrong IB API is in the MATLAB java path since com.ib.client is not sealed in TWS973.jar provided with IB4m.

kevinhedgefund commented 4 years ago

1.

ver

MATLAB Version: 9.6.0.1214997 (R2019a) Update 6 MATLAB License Number: 40685530 Operating System: Mac OS X Version: 10.15.3 Build: 19D76 Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

MATLAB Version 9.6 (R2019a) Database Toolbox Version 9.1 (R2019a) Datafeed Toolbox Version 5.8.1 (R2019a) Econometrics Toolbox Version 5.2 (R2019a) Financial Instruments Toolbox Version 2.9 (R2019a) Financial Toolbox Version 5.13 (R2019a) GUI Layout Toolbox Version 2.2.1 (R2015b) Optimization Toolbox Version 8.3 (R2019a) Parallel Computing Toolbox Version 7.0 (R2019a) Risk Management Toolbox Version 1.5 (R2019a) Statistics and Machine Learning Toolbox Version 11.5 (R2019a) Text Analytics Toolbox Version 1.3 (R2019a)

  1. javaaddpath(fullfile(pwd,'Jar','TWS973.jar'))
  2. AccountSummaryExample Undefined variable "com" or class "com.tws.Handler".

Error in TWS.Session (line 18) this.handler = com.tws.Handler();

Error in TWS.Session.getInstance (line 94) localInstance = TWS.Session();

Error in AccountSummaryExample (line 9) session = TWS.Session.getInstance();

I had javaclasspath.txt. After erasing the file, errors are changed. but, I can't still connect to IB.

Thanks!!

kevinhedgefund commented 4 years ago

javarmpath and then javaaddpath(fullfile(pwd,'Jar','TWS973.jar')) did again. Now I can connect to IB. Thanks for your help!!