cjugeorge / xmppwebchat

Automatically exported from code.google.com/p/xmppwebchat
0 stars 0 forks source link

Problem using XMPPWebChat with own XMPP server (or any other server than gmail.com) #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Don't know if this is the right place for asking about a problem..

What steps will reproduce the problem?
1. Install Tigase server and start it
2. Install Tomcat 7.0 and start it
3. Create accounts on server in other xmpp client
4. Login into xmppwebchat
(1. Or just login with account on e.g tigase.im, jabb3r.org)

What is the expected output? What do you see instead?
The roster should be displayed and it should be possible to add contacts etc. 
No roster is displayed and yes I can add contacts, but I don't get any 
"add-contact-request/confirmation" and it's not possible to start chat. The 
added contacts remains "offline".

What version of the product are you using? On what operating system?
XMPPWebChat 1.2, Windows 7.

Please provide any additional information below.
I can login into my Tigase server (or any other server I have tried out) 
through Psi and Pidgin, and I can login into GTalk using my gmail account in 
XMPPWebChat. 

What am I missing? Do I need to configure XMPPWebChat in order to connect to my 
Tigase server or any other server except gmail.com? When you say "Currently it 
can be used to connect Gtalk and Facebook chat which are widely used chat 
servers." do you mean that these are the only servers which xmppwebchat can 
connect to? Then this parts confuses me "...and is capable to connect with any 
standard XMPP chat servers...".

And please point out some tips for enabling logging in xmppwebchat. E.g packets 
send/recieved, error strace..

Regards,
Sarah

Original issue reported on code.google.com by tibell.s...@gmail.com on 26 Mar 2014 at 1:16

GoogleCodeExporter commented 9 years ago
This can be used to connect to any xmpp based servers and there is no 
configuration other than the login and sever info you provide at login page. 
Can you share the tomcat log to understand the issue here. 

Original comment by ghattama...@gmail.com on 26 Mar 2014 at 1:43

GoogleCodeExporter commented 9 years ago
stderr.log:
stream:error (conflict)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:260)
    at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
java.lang.NullPointerException
    at edu.maristit.xmppwebchat.ChatListener.sendNotification(ChatListener.java:424)
    at edu.maristit.xmppwebchat.ChatListener.sendPresenceToPage(ChatListener.java:571)
    at edu.maristit.xmppwebchat.ChatListener.access$200(ChatListener.java:70)
    at edu.maristit.xmppwebchat.ChatListener$3.presenceChanged(ChatListener.java:621)
    at org.jivesoftware.smack.Roster.fireRosterPresenceEvent(Roster.java:666)
    at org.jivesoftware.smack.Roster.access$700(Roster.java:50)
    at org.jivesoftware.smack.Roster$PresencePacketListener.processPacket(Roster.java:756)
    at org.jivesoftware.smack.Roster.setOfflinePresences(Roster.java:629)
    at org.jivesoftware.smack.Roster.access$200(Roster.java:50)
    at org.jivesoftware.smack.Roster$1.connectionClosedOnError(Roster.java:125)
    at org.jivesoftware.smack.PacketReader.notifyConnectionError(PacketReader.java:172)
    at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:332)
    at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
    at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)

localhost_access_log.2014-03-26.txt:
127.0.0.1 - - [26/Mar/2014:15:08:44 +0100] "POST /XMPPWebChat-1.2test/chat.jsp 
HTTP/1.1" 200 7320
127.0.0.1 - - [26/Mar/2014:15:08:44 +0100] "POST 
/XMPPWebChat-1.2test/cometd/handshake HTTP/1.1" 200 201
127.0.0.1 - - [26/Mar/2014:15:08:44 +0100] "POST /XMPPWebChat-1.2test/cometd/ 
HTTP/1.1" 200 64
127.0.0.1 - - [26/Mar/2014:15:08:44 +0100] "POST 
/XMPPWebChat-1.2test/cometd/connect HTTP/1.1" 200 144
127.0.0.1 - - [26/Mar/2014:15:08:44 +0100] "POST /XMPPWebChat-1.2test/cometd/ 
HTTP/1.1" 200 97
127.0.0.1 - - [26/Mar/2014:15:08:46 +0100] "POST 
/XMPPWebChat-1.2test/cometd/connect HTTP/1.1" 200 144

Thanks!

Original comment by tibell.s...@gmail.com on 26 Mar 2014 at 2:13

GoogleCodeExporter commented 9 years ago
From your logs it looks like this is a stream conflict error which happens when 
you already have session open with xmpp server and when you try to open another 
session to server using same user ID. I suggest to try once by destroying all 
sessions in your xmpp server and test this, if that works I suggest to check 
the settings in your xmppserver if there is any option to allow multiple 
connections. We tested this a lot with open fire 
(http://www.igniterealtime.org/projects/openfire/) server as local xmpp 
installation and it supports multiple connections without any problem. If not 
let me know and also provide me the exact xmpp server version you are using so 
that I can install similar and test it to understand more on this issue.

Original comment by ghattama...@gmail.com on 26 Mar 2014 at 4:10

GoogleCodeExporter commented 9 years ago
When I kill all sessions and make sure to login into xmppwebchat with an 
account which not currently logged in in Tigase I don't get the stream conflict 
error, but the chat looks the same: no roster, not able to chat or add 
buddies.. 

As I said, it's not only my Tigase server which cause this problem. I can't use 
accounts in tigase.im, jabb3r.org or blah.im either. If you want to try you can 
use this XMPP account: sarahtest@tigase.im (pw=sarahtest) and login into 
xmppwebchat. If you get it right you should see four contacts: 
tibell.sarah@gmail.com, sartib875@gmail.com, sarah_@blah.im and 
saroh90@jabb3r.org. 

If you want to test with Tigase server I'm using the latest version: 
Tigase-5.2.0-b3447

When looking in XmppManager.java, init(username, password), I see that you only 
make configurations (depending on port number) if the server domain is 
"chat.facebook.com" or "gmail.com". Do you think this can be a cause of the 
problem?

Original comment by tibell.s...@gmail.com on 27 Mar 2014 at 7:09

GoogleCodeExporter commented 9 years ago
I noticed that chatUpdated(data) in chatMain.js is not called. inte 
_metaHandshake in chatMain.js the line cometd.subscribe("/"+chatRoomName, 
chatUpdated) is executed but the function chatUpdated is never called. For sure 
this is the cause why the roster is not displayed, but I could really use some 
help about what to do to debug this or how to proceed from here..  

Original comment by tibell.s...@gmail.com on 27 Mar 2014 at 7:36

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ok now I think I have located the real issue. I get these errors in Tomcat 
Localhost log:
mar 31, 2014 4:49:26 EM org.apache.catalina.core.StandardWrapperValve invoke
Allvarlig: Servlet.service() for servlet [cometd] in context with path [] threw 
exception
java.lang.IllegalStateException: Not supported.
    at org.apache.catalina.connector.Request.startAsync(Request.java:1678)
    at org.apache.catalina.connector.Request.startAsync(Request.java:1671)
    at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
    at org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:171)
    at org.cometd.server.transport.LongPollingTransport.handle(LongPollingTransport.java:281)
    at org.cometd.server.CometdServlet.service(CometdServlet.java:173)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.eclipse.jetty.continuation.ContinuationFilter.doFilter(ContinuationFilter.java:118)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

My web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                             http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"
         metadata-complete="true">

    <display-name>CometDApplication</display-name>

    <!--  Request that Jetty create an MBean to manage the Bayeux instance -->
   <context-param>
        <param-name>org.eclipse.jetty.server.context.ManagedAttributes</param-name>
        <param-value>org.cometd.bayeux</param-value>
    </context-param>
    <session-config>
        <session-timeout>2440</session-timeout>
    </session-config>

    <!-- Portability Filter, needed only to run on non Jetty or non Servlet-3.0 containers -->

    <filter>
        <filter-name>continuation</filter-name>
        <filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>continuation</filter-name>
        <url-pattern>/cometd/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>cometd</servlet-name>
        <servlet-class>org.cometd.java.annotation.AnnotationCometdServlet</servlet-class>
        <init-param>
            <param-name>timeout</param-name>
            <param-value>30000</param-value>
        </init-param>
        <init-param>
            <param-name>interval</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>maxInterval</param-name>
            <param-value>10000</param-value>
        </init-param>
        <init-param>
            <param-name>maxLazyTimeout</param-name>
            <param-value>5000</param-value>
        </init-param>
        <init-param>
            <param-name>long-polling.multiSessionInterval</param-name>
            <param-value>2000</param-value>
        </init-param>
        <init-param>
            <param-name>logLevel</param-name>
            <param-value>2</param-value>
        </init-param>
    <init-param>
            <param-name>multiFrameInterval</param-name>
            <param-value>-1</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>cometd</servlet-name>
        <url-pattern>/cometd/*</url-pattern>
    </servlet-mapping>
</web-app>

Is my web.xml configured correct for Tomcat 7?

Original comment by tibell.s...@gmail.com on 31 Mar 2014 at 2:55

GoogleCodeExporter commented 9 years ago
Hi , 
I have identified the issue, in current code it is assuming that the login ID 
(username) can contain @domain name which is provided as a login ID so if 
provided it ignores it else it  appending it, It worked for the XMPP based 
servers I tested but it looks like Tigase only accepts username without @domain 
eg: when you provide sarahtest as username internally application appends 
@tigase.im and that is been used to login and also in lot of places including 
backend and front end communication so to fix this issue I changed the xmpp 
login part without @tigase.im which solved the issue and I am able to see your 
contacts you mentioned and their status. I will test it for other servers and 
see if can be removed for other xmpp servers then I will incorporate that into 
code repo and new build, meanwhile I am attaching the XMPPManager class file 
for you which you can drop in at 
%TOMCAT_HOME%\webapps\XMPPWebChat-1.2\WEB-INF\classes\edu\maristit\xmppwebchat\ 
folder and let me know if that works for you.

Original comment by ghattama...@gmail.com on 3 Apr 2014 at 1:16

Attachments:

GoogleCodeExporter commented 9 years ago
I'll handle this one.

Original comment by ghattama...@gmail.com on 3 Apr 2014 at 1:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
That's great, thanks a lot for your work! 
I did some changes to the code and got it to work on my own, but I thought it 
had something to do with subscribing/publishing (/addservice) to different 
channels...I'm new to cometd and using these kinds of techniques so I have not 
crasp it all yet. However, this explains why I could login to gtalk and no 
other server. 

Again, thanks a lot!  

Original comment by tibell.s...@gmail.com on 3 Apr 2014 at 1:35

GoogleCodeExporter commented 9 years ago

Original comment by ghattama...@gmail.com on 3 Apr 2014 at 3:32