ClassCastException occured on web chat popup window

I have checked out latest code from svn of openfire and fastpath webchat projet in eclipse 3.7. Build it and put the webchat.war (From:** /target/plugin**) file in opefirefires** target/openfire/plugin folder.**

Then opened Fastpath > Tools page from openfire application (Running from localhost:9090). I found that chat icon is missing, But managed to click on the link of that image. Webchat popup window opened, but displaying the following exception.

Online Chat Service

Our chat service is unavailable at this time. Please check back soon.
java.lang.ClassCastException: com.jivesoftware.smack.workgroup.settings.OfflineSettings cannot be cast to org.jivesoftware.smackx.workgroup.settings.OfflineSettings at org.jivesoftware.smackx.workgroup.user.Workgroup.getOfflineSettings(Workgroup.j ava:726) at org.jivesoftware.webclient.jsp.email.leave_002da_002dmessage_jsp._jspService(le ave_002da_002dmessage_jsp.java:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1359) at org.jivesoftware.webchat.SetCharacterEncodingFilter.doFilter(SetCharacterEncodi ngFilter.java:45) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330) at org.jivesoftware.webchat.SetupFilter.doFilter(SetupFilter.java:92) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:22 7) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:94 1) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186 ) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875 ) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandler Collection.java:250) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.jav a:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:349) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConne ction.java:919) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51 ) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.jav a:586) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java :44) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598 ) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) at java.lang.Thread.run(Thread.java:662)

I have found another forum entry

Could this be related?

I browsed svn repository of this fastpath-webchat project, and found a change in the file

http://fisheye.igniterealtime.org/browse/fastpath/webchat/trunk/src/webapp/email /leave-a-message.jsp?r2=12985&r1=10482

Could this changes be related with the exception, which I am getting?

Any guidance in this regard shall be highly appriciated.

Managed to workaround this error temporarily to move ahead by replacing all occurrances of .smack. with .smackx. in smack.providers of the workgroup.jar .

We must confess that this was a desperate step as we yet don’t know the utility of smack and smackx and were prompted to give this a shot after reading a few related ClassCastException posts.

Will post updates as we make some progress.

Not that I know anything about Fastpath, but any Smack references for workgroup will fall under org.jivesoftware.smackx.workgroup.*. This is the top level package for all workgroup related stuff. Also note that it is org not com.

Thanks for your quick response.

I have studied smack-3.2.1.jar, smackx-3.2.1.jar and workgroup.jar. All the libraries are present under src/webapp/WEB-INF/lib. Package structure of smack and smackx jar is organized in org.jivesoftware.smack(x).* manner but for workgroup.jar it is maintained com.jivesoftware.smack.* this way.

During run, webchat application uses the workgroup.jar, thats why in exception message com.jivesoftware.smack.workgroup.settings.OfflineSettings is appeared.

I have done the following steps and everything seems working fine.

Procedure 1:

  1. I modified /target/openfire/plugins/webchat/WEB-INF/lib/workgroup.jar’s META-INF/smack.provider file by replacing “**com.jivesoftware.smack.**workgroup__." with "**org.jivesoftware.smackx.**workgroup.”.__

  2. re-ran openfire and tested the entire webchat cycle.

Everything worked fine. Successful to do a test chat using webchat.

Procedure 2:

  1. Just removed the workgroup.jar from the lib of webchat plugin of openfire

  2. Restarted openfire instance and tested it.

Everything worked fine.

I took the 2nd procedure because I have checked workgroup.jar and smackx.3.2.1.jar thoroughly and found that similar package like com.jivesoftware.smack.workgroup.* of workgroup.jar is also present in smackx.3.2.1.jar (org.jivesoftware.**smackx.**workgroup.*). Package structure is also same. One significant difference is com.jivesoftware.smack.workgroup.site package is missing from smackx.3.2.1.jar. I have checked the cross references of this package and found that this package is never used in openfire project.

Now my question is what is the purpose of this workgroup.jar? Is it serving anything in this project? or we may remove it from webchat library?

Wow i am so glad someone solved it. However after so mayn patches i have already done and now also ur patch it would b great if ur provide the compiled war file, just there are no errors done by me when manual patching.

I think the problem of openfire development athe moremnt is the “commit closed” source of svn repository. It would be best if they/someone setio a github mirror of the svn main repo, so that everybody can fork and commit his changed, Doing pull requests and the authoring and reviewing changed by community user (not part of the core devlopers) would speed up whole project and would provide more porfessional exchange of “usnatble” patches till next release.