powered by Jive Software

Class not found with Smack 4.2.1

I use IncomingChatMessageListener in pretty similar way to this:
https://download.igniterealtime.org/smack/docs/latest/documentation/messaging.html

While it works perfectly fine with Smack 4.2.0 when I update smack to 4.2.1 I get exception. Here is stack:

Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: org/jivesoftware/smack/chat2/IncomingChatMessageListener
	at com.mes.home.HomeScreen$2.handle(HomeScreen.java:98)
	at com.mes.home.HomeScreen$2.handle(HomeScreen.java:1)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
	at javafx.base/javafx.event.Event.fireEvent(Unknown Source)
	at javafx.graphics/javafx.scene.Scene$ClickGenerator.postProcess(Unknown Source)
	at javafx.graphics/javafx.scene.Scene$ClickGenerator.access$8300(Unknown Source)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Unknown Source)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1300(Unknown Source)
	at javafx.graphics/javafx.scene.Scene.processMouseEvent(Unknown Source)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
	at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
	at javafx.graphics/com.sun.glass.ui.View.notifyMouse(Unknown Source)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jivesoftware.smack.chat2.IncomingChatMessageListener
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	... 32 more

I use maven project for managing dependencies.

I can’t show whole code but here is part of the code where stack yell 98 line:

91 contactTree.setOnMouseClicked(new EventHandler<MouseEvent>() {
92    @Override
93    public void handle(MouseEvent mouseEvent) {
94  if (mouseEvent.getClickCount() == 2) {
95      TreeItem<RosterEntry> item = contactTree.getSelectionModel().getSelectedItem();
96      System.out.println("Selected Text : " + item.getValue().getName());
97      try {
98          ChatRoom chatRoom = new ChatRoom(homeControll.getConnection(), item.getValue().getJid());
99          tabPane.getTabs().add(chatRoom.getTab());
100     } catch (XmppStringprepException e) {
101     e.printStackTrace();
102                }
103             }
104         }
105     });

Solved, reason: corrupted jar.Solution delete jar from local repository and build again maven project. This StackOverflow thread helped me.