Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating jhotkey.privatehk.SimulationMgrProxy #150

Closed
imotsch opened this issue Nov 15, 2021 · 10 comments
Closed

Error creating jhotkey.privatehk.SimulationMgrProxy #150

imotsch opened this issue Nov 15, 2021 · 10 comments

Comments

@imotsch
Copy link

imotsch commented Nov 15, 2021

First of all million thanks for your great project. Love it.

I switched from IBController to IBC and all is working just fine.
I am using ibgateway version 1011 and IBC 3.11.0

One issue however is that when connecting the gateway it shows an error dialog asking to send a bug report to IB.
I checked the log and obviously it is due to an Exception.

2021-11-15 16:05:00.402 [SE] ERROR [AWT-EventQueue-0] - Error creating jhotkey.privatehk.SimulationMgrProxy instance.
java.lang.ClassNotFoundException: jhotkey.privatehk.SimulationMgrProxy
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jhotkey.privatehk.j.a(j.java:40)
at jhotkey.privatehk.PrivateHotkeys.(PrivateHotkeys.java:255)
at jhotkey.privatehk.PrivateHotkeysCreator.a(PrivateHotkeysCreator.java:23)
at trader.common.factory.IFactoryBeanCreator.a(IFactoryBeanCreator.java:29)
at trader.common.factory.m.a(m.java:1141)
at trader.common.factory.m.a(m.java:1116)
at jhotkey.HotkeyMgr.a(HotkeyMgr.java:319)
at ibgateway.aA.q(Unknown Source)
at ibgateway.aA.onLoginSuccess(Unknown Source)
at ibgateway.af.d(Unknown Source)
at jclient.f9.a(f9.java:3292)
at jclient.f9.d(f9.java:3077)
at jconnection.a.b(a.java:651)
at jconnection.S.run(S.java:475)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at jutils.health.a.dispatchEvent(a.java:314)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

After clicking "No" on the TWS error dialog it continues and all works fine.

I checked by starting the ibgateway directly and then this does not happen. I compared the log files with beyondcompare and it is in fact that error above that is the difference.

Then I checked the jar files inside C:\Jts-gateway\ibgateway\1011\jars.
jts4launch-1011.jar contains the package jhotkey.privatehk.* containing the classes PrivateHotKey*.

However it is missing the class jhotkey.privatehk.SimulationMgrProxy

Can you verify this with these versions or am I combining problematic versions?

Yours and Thanks
Ivan

@rlktradewright
Copy link
Member

Regarding the 'error dialog asking to send a bug report to IB', can you please confirm whether this is the same thing as described in PR #149? If it is, then that will give you a means to ignore these dialogs (though it won't prevent the exceptions being logged).

And are you using a 'white label' version of the Gateway, by which I mean a version provided by another broker with their own branding? If so, I suspect that what's going on here is that the script you run to start Gateway directly loads some additional software customised by the third-party broker, and this is invoked by code in the 'standard' jars. Given that IBC enters the Gateway code at an entrypoint that we know and love (because we don't know any other ones!) perhaps this bypasses this mechanism and results in the error you see - but this is pure speculation. It's possible that understanding that script might throw some light on it, but it's a masterpiece of obscurity and life just isn't long enough...

So at present I have no suggestions as to whether or how these exceptions can be avoided. If this is not causing you any actual problems, then it's probably best to just live with it.

@imotsch
Copy link
Author

imotsch commented Nov 17, 2021 via email

@rlktradewright
Copy link
Member

And why does it not throw the same error for me?

One possibility is that perhaps you're not using the latest version. The one that works perfectly for me is 10.11.2e. Mind you, that's on Windows, and I haven't got round to trying the Linux version yet.

[By the way, a couple of things: it's always helpful to attach the IBC logfile to issues like this: then I know immediately which platform and which versions of everything you're using without having to ask - and I mean attach rather than quote. Unfortunately however I haven't found a way to get the detailed TWS/Gateway version into the logfile.

The other thing is that if you reply via email rather than GitHub , please don't quote the post you're replying to as it makes the thread messy when viewed on GitHub.]

@imotsch
Copy link
Author

imotsch commented Nov 17, 2021

ibgateway Build 10.11.2e, Windows 10 Home.
Account is a regular personal IB account. No branding, No white label.

Two logs attached. One from start with ibgateway.exe, the other with start from IBC batch file.
Also attached the config.ini - with credentials masked.

ibgateway-start-OK.txt
IBC-startException.txt
config.ini.txt

@rlktradewright
Copy link
Member

I think I wasn't clear enough: it's the IBC logfile, not the TWS/Gateway log, that's of most use. That's the one that the banner window tells you about when you start TWS/Gateway (something like IBC-3.11.0_GATEWAY-1011_TUESDAY.txt). It includes all the config.ini settings (with credentials obscured), and lots of other useful stuff. IB's log files are rarely of much value to me.

However I will compare your gateway log extracts with my own when I can find the time (this might be one of the occasions where the IB logfiles actually are useful). There must be something different, and hopefully it will show up in the IB log.

@imotsch
Copy link
Author

imotsch commented Nov 17, 2021

ibc-log.txt

@imotsch
Copy link
Author

imotsch commented Nov 17, 2021

I tested with visualvm and compared all java and classpath settings, even compared heap dumps.
Basically all same except two areas.

  1. ibgateway adds another jar file from the install4j folder (to test it I appended inside StartIBC.bar)
    set IBC_CLASSPATH=%IBC_CLASSPATH%;C:/Jts-gateway/ibgateway/1011/.install4j/i4jruntime.jar
    [I had to write '/' instead of backslash '' in this editor since it would otherwise wrongly display the path in github]

  2. ibgateway sets many system properties, in particular two important ones (to test it I appended inside StartIBC.bar)
    set JAVA_VM_OPTIONS=%JAVA_VM_OPTIONS% -Dtwslaunch.autoupdate.serviceImpl=com.ib.tws.twslaunch.install4j.Install4jAutoUpdateService
    set JAVA_VM_OPTIONS=%JAVA_VM_OPTIONS% -Dchannel=latest

When I add these two parts to the bat file, the the IBC starts without the exception and also does not show the Error Window.
The strange part is that I don't understand why this is necessary and why others are not having that issue.
Maybe others are not already using v1011 of the ibgateway?

@imotsch
Copy link
Author

imotsch commented Nov 17, 2021

Seems to me as if an auto-update service impl is required and that the second system props specify that the auto-update should use updates from the version stream labelled "latest".

@rlktradewright
Copy link
Member

Thanks for those posts.

I realised last night that I'm a complete idiot. My system is indeed throwing exactly the same exception, including in v1010. I was distracted by the fact that when TWS/Gateway write exceptions to stderr, they also end up in the IBC logfile. So I was looking in there and not seeing it. In this case, and probably most others, TWS/Gateway actually write the log entry direct to their own logging mechanism, and it never gets to IBC's logfile.

Curiously, although the exception is there in the logfile, I'm not seeing the diagnostics request window. I'll have to look further at that.

Your discoveries about the 'missing' jar files are great: good sleuthing there! I had never heard of VisualVM before, so I'll definitely take a look at that.

In light of what you found, I'll probably revamp the classpath generation in the start scripts to include all jars in the .install4j folder, and also look into your vmoptions suggestion.

To be frank, I'm actually very unconcerned about this exception, as it seems to have no unpleasant side effects. But if it can be cured without a major effort it would be worthwhile.

@rlktradewright
Copy link
Member

Just confirmed that your suggestions do indeed get rid of the exception, at least on Windows. Will try Linux probably later this evening. And the code change is trivial, since the scripts already have a variable with the path to .install4j

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants