Can't use Debugger with Spark 3.0.0-beta

When trying to login with the “Start debugger on startup” option enabled in Spark 3.0.0-beta, logging in results in an error.

java.lang.IllegalArgumentException: Can't initialize the configured debugger!
	at org.jivesoftware.smack.debugger.ReflectionDebuggerFactory.create(ReflectionDebuggerFactory.java:89)
	at org.jivesoftware.smack.AbstractXMPPConnection.<init>(AbstractXMPPConnection.java:357)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection.<init>(XMPPTCPConnection.java:324)
	at org.jivesoftware.gui.LoginUIPanel.login(LoginUIPanel.java:1185)
	at org.jivesoftware.gui.LoginUIPanel.access$1000(LoginUIPanel.java:134)
	at org.jivesoftware.gui.LoginUIPanel$6.construct(LoginUIPanel.java:1023)
	at org.jivesoftware.spark.util.SwingWorker.lambda$new$0(SwingWorker.java:139)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.jivesoftware.smack.debugger.ReflectionDebuggerFactory.create(ReflectionDebuggerFactory.java:87)
	... 7 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1
	at java.util.ArrayList.rangeCheckForAdd(ArrayList.java:667)
	at java.util.ArrayList.add(ArrayList.java:479)
	at javax.swing.JTabbedPane.insertTab(JTabbedPane.java:718)
	at javax.swing.JTabbedPane.add(JTabbedPane.java:858)
	at org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow.showNewDebugger(EnhancedDebuggerWindow.java:144)
	at org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow.addDebugger(EnhancedDebuggerWindow.java:131)
	at org.jivesoftware.smackx.debugger.EnhancedDebugger.<init>(EnhancedDebugger.java:248)
	... 12 more

The problem arose after January 21th because I have a Spark 2.9.5 snapshoot from 21/01/2021 and there the debugging runs fine.

Build of Spark 2.9.5 26/01/2021 does not start the debug.

@wroot Do you still have builds of Spark from January 22-25, 2021?

I was sure i don’t have anymore as i did a purge recently. But i checked another drive and here’s the result.
image

If you need them, i can upload them somewhere. Also, you can check Github commit history and see which commit was on which date and maybe figure out the cause.

Nice!
Please send me all of them!)
My cursory picked up on github didn’t see the reason.

Sent you the link in PM

Thank you! Downloading in 15 min.

I was successfully able to debug in Spark 2.9.5 from 21/01/2021, but unfortunately in Spark 2.9.5 from 23/01/2021 the debug does not start.
I only see one commit that could break it.

2 Likes

I’ve logged this as https://igniterealtime.atlassian.net/browse/SPARK-2232

1 Like

This problem is caused by a combination of a bug in Smack (https://igniterealtime.atlassian.net/browse/SMACK-908, fix suggested in SMACK-908: Don't use components to count tabs in Debugger by guusdk · Pull Request #483 · igniterealtime/Smack · GitHub) and the change to the “scroll” policy for TabbedPane.tabLayoutPolicy.

I’m not sure what this “scroll” policy is needed for, but I do not think we can use it before the bug in Smack is fixed (and we’ve updated Spark to use a version of Smack that includes that fix).

If we update Smack in Spark to the latest version 4.4.X then we will face the problem that Spark will not be able to connect to the Openfire server below 4.6.0
Check out my comments here.

it changes the view of the chat window

old window
image

scroll
image

I’d prefer to have a working debugger over scrolling tabs. :slight_smile:

I’ve made some head-way in that PR, but there’s at least one other issue with the upgrade to Smack 4.4.0. It is in places more strict than the older version, which causes a stanza sent by older versions of Openfire to be ignored, which prevents the logging in from completing. I’m not sure if I’m fully correct, and in case I am, if that can be worked around - but I’ve already spend more time on this that what I have available.

@Flow What do you think about the release of Smack 4.3.6(
Something like a hot fix for Spark 3.0.0) with this PR SMACK-908: Don't use components to count tabs in Debugger by guusdk · Pull Request #483 · igniterealtime/Smack · GitHub

Otherwise, I think that the release of Spark 3.0.0 may take a very long time = (

Unfortunately I am only able to support one stable branch of Smack as part of my (unpaid) spare time maintenance of Smack. That said, I think, due to Smack’s modular architecutre, you may be able to replace the faulty Smack component in Spark without upgrading Smack

I think this is the solution. Then we are waiting for the release of Smack 4.4.4 and take the debug module from it.

I built Spark with smack-debug 4.4.4-snapshot, but unfortunately the debugger doesn’t work.

https://oss.sonatype.org/content/repositories/snapshots/org/igniterealtime/smack/smack-debug/

image

java.lang.IllegalArgumentException: Can't initialize the configured debugger!
	at org.jivesoftware.smack.debugger.ReflectionDebuggerFactory.create(ReflectionDebuggerFactory.java:89)
	at org.jivesoftware.smack.AbstractXMPPConnection.<init>(AbstractXMPPConnection.java:357)
	at org.jivesoftware.smack.tcp.XMPPTCPConnection.<init>(XMPPTCPConnection.java:324)
	at org.jivesoftware.gui.LoginUIPanel.login(LoginUIPanel.java:1185)
	at org.jivesoftware.gui.LoginUIPanel.access$1000(LoginUIPanel.java:134)
	at org.jivesoftware.gui.LoginUIPanel$6.construct(LoginUIPanel.java:1023)
	at org.jivesoftware.spark.util.SwingWorker.lambda$new$0(SwingWorker.java:139)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.jivesoftware.smack.debugger.ReflectionDebuggerFactory.create(ReflectionDebuggerFactory.java:87)
	... 7 more
Caused by: java.lang.NoClassDefFoundError: org/jivesoftware/smack/Smack
	at org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow.createDebug(EnhancedDebuggerWindow.java:235)
	at org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow.showNewDebugger(EnhancedDebuggerWindow.java:141)
	at org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow.addDebugger(EnhancedDebuggerWindow.java:131)
	at org.jivesoftware.smackx.debugger.EnhancedDebugger.<init>(EnhancedDebugger.java:248)
	... 12 more
Caused by: java.lang.ClassNotFoundException: org.jivesoftware.smack.Smack
	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)
	... 16 more

Do you mix different versions of Smack?

Yes, Smack has a modular architecture.
Maybe I’m doing something wrong?

I am building Spark via maven and specifying debug 4.4.4 version in pom.xml
I need Smack debug 4.4.4 just because of this fix.