[solved] Problem with Apache 2 proxy

UI Components for JSF
Post Reply
FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

23 Sep 2013, 16:01

My server uses Apache 2 to proxy requests from port 80 to specific tomcat instances.

httpd.conf looks like this:

Code: Select all

<VirtualHost *:80>
    ServerName example.net
    ServerAlias www.example.net
    ProxyPass / http://example.net:8080/
    ProxyPassReverse / http://example.net:8080/
</VirtualHost>

<VirtualHost *:80>
    ServerName test.example.net
    ProxyPass / http://example.net:8081/
    ProxyPassReverse / http://example.net:8081/
</VirtualHost>

<VirtualHost *:80>
    ServerName jenkins.example.net
    ProxyPass / http://example.net:8082/
    ProxyPassReverse / http://example.net:8082/
</VirtualHost>

<VirtualHost *:80>
    ServerName archiva.example.net
    ProxyPass / http://example.net:8083/
    ProxyPassReverse / http://example.net:8083/
</VirtualHost>

<VirtualHost *:80>
    ServerName ws.example.net
    ProxyPass / http://example.net:8084/
    ProxyPassReverse / http://example.net:8084/
</VirtualHost>
Problem is that when I use example.net instead of example.net:8080 push doesn't works:

Code: Select all

java.lang.IllegalStateException: Not supported.
	at org.apache.catalina.connector.Request.startAsync(Request.java:1674)
	at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1030)
	at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
	at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:505)
	at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:128)
	at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:103)
	at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.doService(Tomcat7Servlet30SupportWithWebSocket.java:67)
	at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:95)
	at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.service(Tomcat7Servlet30SupportWithWebSocket.java:62)
	at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1675)
	at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:177)
	at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:163)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	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.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	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:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	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:724)
I'm new with this proxy stuff. Is there any workaround possible to make push work in this scenario?

Atmosphere version is 2.2.

Thanks,
Phillip
Last edited by FkJ on 17 Dec 2013, 19:46, edited 1 time in total.

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

23 Sep 2013, 17:15

i just searched atmosphere framework google groups mail list for the following

apache proxypass

and found 3 topics. I clicked on this topic, read it, and seem to be some good information there.

Please reply here with your findings/solution (changes to your configuration). thanks.

also, you said that you are using atmosphere version 2.2. I didn't know that there was '2.2' version. do you mean atmosphere '2.0.0', which was recently released...a few days ago?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

17 Dec 2013, 19:41

Thanks for the links.

Yes I was talking about atmosphere 2.0.0, my bad.

By the time I created this thread I was just testing a prototype. Recently the application that uses push entered in production, so I'd like to give some feedback in case someone faces the same problems I did.

I totally missed the primefaces.PUSH_SERVER_URL parameter when I was reading the documentation. This solves the problem I mentioned above since Apache 2.2 can't proxy WebSocket requests. Seems that this is fixed Apache 2.4.

After I set up the primefaces.PUSH_SERVER_URL push started working, but I kept getting the
java.lang.IllegalStateException: Not supported. I mentioned above, but this time it was lots of times per second, so in a few days my server logs were over 100GB. Solved it by adding <async-supported>true</async-supported> to the push servlet declaration.

I'm having a small issue with push in PrimeFaces 4.0.5, but I prefer to create a new thread to discuss it: http://forum.primefaces.org/viewtopic.php?f=10&t=35477
Last edited by FkJ on 17 Dec 2013, 21:03, edited 1 time in total.

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

17 Dec 2013, 20:27

+1 excellent response, and thanks for sharing.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

mauritzl
Posts: 14
Joined: 15 May 2013, 16:14
Location: Norway

12 Feb 2014, 21:15

I have similar problem while using GlassFish 4.0 Virtual Server (similar to Apaches Virtual Hosting).
I do not use Apache in front of GlassFish, but rely on GlassFish built in virtual hosting capabilities...

When deploying an application that uses PrimeFaces Push in the default server, push works fine, but when deploying the same application to a virtual server (answering only to specific host name in URL), push stops working, issuing following errors in log:

[2014-02-12T18:32:51.907+0100] [glassfish 4.0] [WARNING] [] [org.atmosphere.cpr.MetaBroadcaster] No Broadcaster matches /pushchannel. Message {"data":"progress"} WILL BE LOST. Make sure you cache it or make sure the Broadcaster exists before.

Any clues to how to get around this? I use latest versions of GF, PF and Atmosphere...
---------------------------
PrimeFaces 6.0.6
JBoss EAP 7 (Mojarra 2.2.12) | OmniFaces 2.4

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

12 Feb 2014, 21:40

mauritzl wrote:I have similar problem while using GlassFish 4.0 Virtual Server (similar to Apaches Virtual Hosting).
I do not use Apache in front of GlassFish, but rely on GlassFish built in virtual hosting capabilities...

When deploying an application that uses PrimeFaces Push in the default server, push works fine, but when deploying the same application to a virtual server (answering only to specific host name in URL), push stops working, issuing following errors in log:

[2014-02-12T18:32:51.907+0100] [glassfish 4.0] [WARNING] [] [org.atmosphere.cpr.MetaBroadcaster] No Broadcaster matches /pushchannel. Message {"data":"progress"} WILL BE LOST. Make sure you cache it or make sure the Broadcaster exists before.

Any clues to how to get around this? I use latest versions of GF, PF and Atmosphere...
did you read this earlier, click on all URLs, and read all topics in the list of search results?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

mauritzl
Posts: 14
Joined: 15 May 2013, 16:14
Location: Norway

12 Feb 2014, 21:47

Yes, I have been through all of them many times ;-), but they all refer to using Apache in front, which is not our use case.

BTW, added separate post for this subject, since it deserves it's own attention :D : http://forum.primefaces.org/viewtopic.php?f=10&t=36383
---------------------------
PrimeFaces 6.0.6
JBoss EAP 7 (Mojarra 2.2.12) | OmniFaces 2.4

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

12 Feb 2014, 22:59

mauritzl wrote:Yes, I have been through all of them many times ;-), but they all refer to using Apache in front, which is not our use case.
well, i just clicked on the URL below,
smithh032772 wrote:i just searched atmosphere framework google groups mail list for the following

apache proxypass
and the following is in the list of search results,

Problem running an application in Glassfish cluster
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests