it dont work, apache cant conect to tomcat with this changes. The
login msn is loading indefinitely... And error logs dont show nothing,
except tomcat that says:

org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read


Here the changes...
Added this lines in event method:

if (event.getEventType() == CometEvent.EventType.BEGIN) {
                    event.setTimeout(30*1000);
                }

if (event.getEventSubType() == CometEvent.EventSubType.TIMEOUT) {
                        writeResponse(event.getHttpServletResponse(), 
"timeout");
                        event.close();
                }

server.xml (tomcat):

<Connector
connectionTimeout="20000"
port="8081"
protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="5"
acceptorThreadCount="2"
redirectPort="8443"
socket.directBuffer="false" />

httpd.conf (apache):

        keepalive Off
        ProxyRequests Off
        SetEnv force-proxy-request-1.0 1
        SetEnv proxy-nokeepalive 1

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass /msn/com.msn/messenger 
http://localhost:8081/msn/com.msn/messenger
        ProxyPassReverse /msn/com.msn/messenger 
http://localhost:8081/msn/com.msn/messenger



On 21 feb, 16:29, Chris Lercher <[email protected]> wrote:
> I expect that your application works, if you use tomcat only, because
> many browsers will wait for the response for a very long time. In that
> case, you don't need a timeout on your server.
>
> But when there's any proxy between your client and the server (and
> that's also the case when the client connects to the Internet via a
> proxy), then it often fails. Also expected behaviour.
>
> I'd take a look at this:http://tomcat.apache.org/tomcat-6.0-doc/aio.html
>
> It says you can set a timeout like this:
> event.setTimeout(30*1000)
>
> I'd do this for EventType.BEGIN.
>
> Then you can test for EventType.TIMEOUT (the documentation says, that
> you may need the
> org.apache.catalina.valves.CometConnectionManagerValve for this).
>
> On timeout, send some dummy response. The client should recognize the
> response as a timeout message, and retry.
>
> So, in effect I imagine it could look something like this (I can't try
> it here, so there may be some mistakes):
>
> public void event(CometEvent event) throws IOException,
> ServletException {
>  if (event.getEventType() == CometEvent.EventType.BEGIN) {
>     event.setTimeout(30*1000);
>  }
>  if (event.getEventType() == CometEvent.EventType.READ) { ...}
>  if (event.getEventType() == CometEvent.EventType.TIMEOUT) {
>     writeResponse(response, "timeout");
>     event.close();
>  }
>
> }
>
> On Feb 21, 3:54 pm, Fran <[email protected]> wrote:
>
> > Chris, the big problem is that the aplication works fully in tomcat
> > but I use apache to run it with the servlet in tomcat, it cant work.
> > I only need to emulate that the execution in apache is the same that
> > in tomcat
>
> > On 21 feb, 15:50, Fran <[email protected]> wrote:
>
> > > I based the code in a GWT book.
> > > Please take a look 
> > > athttp://217.13.89.62/messenger%20nonblocking%20calls.pdf
> > > next the phrase at the first page: "Using Server-Side Advanced IO"
>
> > > Thanks for your time
>
> > > On 21 feb, 15:38, Chris Lercher <[email protected]> wrote:
>
> > > > Using writer.flush() is absolutely ok, it's just not enough. Taking a
> > > > quick look at the code you posted, it looks ok, because after calling
> > > > writer.flush(), it always calls event.close(). So, no problem here.
> > > > But: I don't see any timeout in the code. The server must also call
> > > > event.close() after some timeout - which must be shorter than your
> > > > proxy's and your browser's timeout. (Some people say, it should in any
> > > > case be less than a minute.)
>
> > > > So either you can configure the timeout somewhere in tomcat (please
> > > > refer to the tomcat documentation), or you'll have to send something
> > > > back manually after some time.
> > > > When the client receives such a dummy response, it must open a new
> > > > request (that's the long polling principle).
>
> > > > On Feb 21, 3:28 pm, Fran <[email protected]> wrote:
>
> > > > > Yes Chris, I use writer.flush()
> > > > > I cant use it at mod_proxy? What can I do?
>
> > > > > Thanks
>
> > > > > On 21 feb, 14:39, Chris Lercher <[email protected]> wrote:
>
> > > > > > Here are some things you can check - maybe one of these helps (?)
>
> > > > > > - In your servlet: Do you expect that anything gets flushed
> > > > > > (reliably), before you call the close() method on CometEvent? If 
> > > > > > yes,
> > > > > > then what you're actually trying to do is _streaming_ (which doesn't
> > > > > > work). Calling writer.flush() is certainly not enough, since 
> > > > > > mod_proxy
> > > > > > has no way to know that writer.flush() has been called.
>
> > > > > > - Did you try to set "no-cache" headers etc.?
>
> > > > > > On Feb 21, 1:11 pm, Fran <[email protected]> wrote:
>
> > > > > > > I tested the mod_proxy_http, in the last post you can see the 
> > > > > > > config
> > > > > > > that I used.
> > > > > > > But in Comet HTTP streaming, I found mod_proxy blocked the 
> > > > > > > response
> > > > > > > until server close the
> > > > > > > stream (after timeout), then send the whole response to client at
> > > > > > > once.
>
> > > > > > > In the first time I was wrong because I thought that if I put
> > > > > > > timeout=1 I found the solution but Its not real because the server
> > > > > > > close the conection after timeout
>
> > > > > > > In the five post of mine is an example of the problem.
>
> > > > > > > This dude has a similar 
> > > > > > > problem:http://forums.java.net/jive/thread.jspa?threadID=41377
>
> > > > > > > I am hopeless :(
>
> > > > > > > On 21 feb, 03:21, dablack <[email protected]> wrote:
>
> > > > > > > > Sorry to lead you on a wild goose chase. I guess you will have 
> > > > > > > > to use
> > > > > > > > the Apache mod_proxy_http module with the Tomcat NIO connector 
> > > > > > > > using
> > > > > > > > the http protocol after all. I don't have any experience with 
> > > > > > > > the
> > > > > > > > mod_proxy_http module at all so not really anything I can help 
> > > > > > > > you
> > > > > > > > with.
>
> > > > > > > > Good luck.
>
> > > > > > > > On Feb 20, 7:21 pm, Fran <[email protected]> wrote:
>
> > > > > > > > > The problem persist with the news changes.
> > > > > > > > > Seems that apache cant connect to tomcat :(
> > > > > > > > > The error log of apache and mod_jk dont show nothing. Not 
> > > > > > > > > ever nio conection
> > > > > > > > > stablished
>
> > > > > > > > > 2010/2/21 dablack <[email protected]>
>
> > > > > > > > > > I borrowed that connector configuration from a website I 
> > > > > > > > > > came across.
> > > > > > > > > > I'm not sure why port=0 either. If I put more research into 
> > > > > > > > > > the NIO
> > > > > > > > > > connector I could probably find out. Why don't you try 
> > > > > > > > > > adding the
> > > > > > > > > > lines,
>
> > > > > > > > > > enableLookups="false"
> > > > > > > > > > scheme="http"
>
> > > > > > > > > > to the NIO connector configuration in the server.xml file 
> > > > > > > > > > that I gave
> > > > > > > > > > you earlier.
>
> > > > > > > > > > As far as accessing the ajp service 
> > > > > > > > > > usinghttp://localhost:8009/servlet,
> > > > > > > > > > that will not work. Your browser uses the http protocol and 
> > > > > > > > > > the 8009
> > > > > > > > > > port is being serviced by the ajp protocol. You should 
> > > > > > > > > > still have your
> > > > > > > > > > connector using the http protocol configured to listen on 
> > > > > > > > > > port 8081.
>
> > > > > > > > > > Hopefully the scheme line above will help the NIO connector
> > > > > > > > > > communicate back to Apache.
>
> > > > > > > > > > On Feb 20, 4:45 pm, Fran <[email protected]> wrote:
> > > > > > > > > > > I test your config, dablack, but I cant connect to the 
> > > > > > > > > > > servlet.
> > > > > > > > > > > With this config I cant access not even 
> > > > > > > > > > > to:http://localhost:8009/servlet
> > > > > > > > > > > that is tomcat directly without apache
>
> > > > > > > > > > > On 20 feb, 23:36, Fran <[email protected]> wrote:
>
> > > > > > > > > > > > I cant undestand why this config:
>
> > > > > > > > > > > > <Connector protocol="AJP/1.3" port="0" 
> > > > > > > > > > > > channelNioSocket.port="8009"
> > > > > > > > > > > > channelNioSocket.maxThreads="
> > > > > > > > > > > > 150"
> > > > > > > > > > > >   channelNioSocket.maxSpareThreads="50"
> > > > > > > > > > > > channelNioSocket.minSpareThreads="25"
> > > > > > > > > > > >   channelNioSocket.bufferSize="16384" />
>
> > > > > > > > > > > > Why port 0 ?
>
> > > > > > > > > > > > 2010/2/20 dablack <[email protected]>
>
> > > > > > > > > > > > > Fran,
>
> > > > > > > > > > > > > I'm really not an expert on setting up the connection 
> > > > > > > > > > > > > between Apache
> > > > > > > > > > > > > and Tomcat but I believe that the connections only 
> > > > > > > > > > > > > operate in two
> > > > > > > > > > > > > protocols: http or ajp. NIO is a Tomcat connector 
> > > > > > > > > > > > > that can
> > > > > > > > > > communicate
> > > > > > > > > > > > > in either http or ajp. Because of that, I don't see 
> > > > > > > > > > > > > any reason that
> > > > > > > > > > > > > the Apache mod_jk connector module couldn't 
> > > > > > > > > > > > > communicate with the NIO
> > > > > > > > > > > > > connector. Since I don't use an NIO connector I could 
> > > > > > > > > > > > > be wrong, but
> > > > > > > > > > > > > that is the way I see it. As a starting point, try 
> > > > > > > > > > > > > these
> > > > > > > > > > > > > configurations:
>
> > > > > > > > > > > > > server.xml
>
> > > > > > > > > > > > > <Connector protocol="AJP/1.3" port="0" 
> > > > > > > > > > > > > channelNioSocket.port="8009"
> > > > > > > > > > > > > channelNioSocket.maxThreads="150"
> > > > > > > > > > > > >   channelNioSocket.maxSpareThreads="50"
> > > > > > > > > > > > > channelNioSocket.minSpareThreads="25"
> > > > > > > > > > > > >   channelNioSocket.bufferSize="16384" />
>
> > > > > > > > > > > > > (You seem to want to use port 8081 which should be 
> > > > > > > > > > > > > fine, but the
> > > > > > > > > > > > > standard ajp port is 8009. However, I wouldn't put it 
> > > > > > > > > > > > > on port 8081 if
> > > > > > > > > > > > > you are already using that port for another protocol 
> > > > > > > > > > > > > such as http.)
>
> > > > > > > > > > > > > httpd.conf
>
> > > > > > > > > > > > > LoadModule jk_module modules/mod_jk.so
> > > > > > > > > > > > > JkWorkersFile conf/workers.properties
> > > > > > > > > > > > > JkLogFile /var/log/httpd/mod_jk.log
> > > > > > > > > > > > > JkLogLevel info
> > > > > > > > > > > > > JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
> > > > > > > > > > > > > JkOptions +ForwardKeySize +ForwardURICompat 
> > > > > > > > > > > > > -ForwardDirectories
> > > > > > > > > > > > > JkRequestLogFormat "%w %V %T"
> > > > > > > > > > > > > JkMount /*.svc ajp13
>
> > > > > > > > > > > > > (For the JkMount I use *.svc because I use the svc 
> > > > > > > > > > > > > extension for my
> > > > > > > > > > > > > GWT service target to differentiate service points 
> > > > > > > > > > > > > from other files.)
>
> > > > > > > > > > > > > (For example, in my web.xml file I will map my 
> > > > > > > > > > > > > service something like
> > > > > > > > > > > > > this to use the svc extension:
> > > > > > > > > > > > > <servlet>
> > > > > > > > > > > > >   <servlet-name>MyService</servlet-name>
> > > > > > > > > > > > >   
> > > > > > > > > > > > > <servlet-class>com.mysite.server.MyServiceImpl</servlet-class>
> > > > > > > > > > > > > </servlet>
> > > > > > > > > > > > > <servlet-mapping>
> > > > > > > > > > > > >   <servlet-name>MyService</servlet-name>
> > > > > > > > > > > > >   <url-pattern>/MyService.svc</usr-pattern>
> > > > > > > > > > > > > </servlet-mapping>
>
> > > > > > > > > > > > > And in my GWT code I create my service target like 
> > > > > > > > > > > > > this:
>
> > > > > > > > > > > > > target.setServiceEntryPoint( GWT.getModuleBaseURL() +
> > > > > > > > > > > > > "MyService.svc" );
>
> > > > > > > > > > > > > I did this because I had troubles with the 'JkMount 
> > > > > > > > > > > > > /* ajp13' entry,
> > > > > > > > > > > > > but when I used /*.svc the problems
>
> ...
>
> leer más »

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to