-
1. Re: JSF redirects to ajp://
bcn Jul 15, 2011 4:51 AM (in response to fissy101)Hi,
I hit the exactly the same problem. Any solution so far? A real show stopper.
Thanks,
Ulrich
-
2. Re: JSF redirects to ajp://
jaikiran Jul 15, 2011 7:30 AM (in response to bcn)What exactly does the code look like? Please post the complete code in that method which does the redirect.
-
-
4. Re: JSF redirects to ajp://
jaikiran Jul 15, 2011 9:30 AM (in response to bcn)Would it be possible for one of you to create a simple application to reproduce this and attach that app here? That would help me or others to take a quick look and see what's wrong.
-
5. Re: JSF redirects to ajp://
fissy101 Jul 18, 2011 6:48 AM (in response to jaikiran)Hi Jaikiran,
There is a war file attached. I found a similar problem is happening in resteasy and that might be easier to debug as its giving a stacktrace. The resteasy resource class is:
{code}
package pkg;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/resource")
public class Resource {
@GET
@Produces("text/plain")
public String generateResponse() {
return "Hello world";
}
}
{code}
And requesting that resource gives the following error:
{code}
11:46:12,380 WARNING [org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher] (ajp--127.0.0.1-8009-1) Failed to parse request.: java.lang.RuntimeException: java.net.MalformedURLException: unknown protocol: ajp
at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractUriInfo(ServletUtil.java:58) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:187) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.1.GA.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:504) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:442) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
Caused by: java.net.MalformedURLException: unknown protocol: ajp
at java.net.URL.<init>(URL.java:574) [:1.6.0_24]
at java.net.URL.<init>(URL.java:464) [:1.6.0_24]
at java.net.URL.<init>(URL.java:413) [:1.6.0_24]
at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractUriInfo(ServletUtil.java:46) [resteasy-jaxrs-2.2.1.GA.jar:]
... 17 more
{code}
-
AjpConnectorTest.war 2.5 KB
-
-
6. Re: JSF redirects to ajp://
bcn Jul 19, 2011 4:21 AM (in response to fissy101)Hi,
it happens also on "normal" redirects like this:
ExternalContext ext = FacesContext.getCurrentInstance().getExternalContext();
ext.redirect(ext.getRequestContextPath() + "/faces/index.xhtml");
Response header is then:
Location: ajp://127.0.0.1/myapp/faces/index.xhtml
Any fix or workaround would be highly appreciated.
Thanks
-
7. Re: JSF redirects to ajp://
bcn Jul 25, 2011 2:45 AM (in response to bcn)Hello Jaikiran,
any news about this problem? Can you reproduce it?
This is the only issue that prevents us to switch to AS 7, so any workaround or fix would be great.
I can't find a JIRA entry about this. Should we create one?
Thanks,
Ulrich
-
8. Re: JSF redirects to ajp://
jaikiran Jul 25, 2011 2:56 AM (in response to bcn)Unfortunately, I haven't been able to reproduce this even with that attached app. Can one of you list down the exact steps/configurations that I have to follow to reproduce this?
-
9. Re: JSF redirects to ajp://
bcn Jul 25, 2011 3:30 AM (in response to jaikiran)I tried the provided AjpConnectorTest.war. You have to remove WEB-INF/jboss-web.xml, otherwise you get an error on deployment.
When it deployed, go to the URL http://localhost:8080/AjpConnectorTest/rest/resource and you get Hello World.
Then try http://localhost:81/AjpConnectorTest/rest/resource (via Apache) and you get the error mentioned above.
My Apache httpd.conf has:
Listen 81
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
In AS 7, standalone.xml has:
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host"> <connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/> <connector name="ajp" protocol="AJP/1.3" socket-binding="ajp" scheme="ajp"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> </virtual-server> </subsystem> <subsystem xmlns="urn:jboss:domain:weld:1.0"/> <socket-binding-group name="standard-sockets" default-interface="public"> <socket-binding name="http" port="8080"/> <socket-binding name="https" port="8443"/> <socket-binding name="ajp" port="8009"/> <socket-binding name="jmx-connector-registry" port="1090"/> <socket-binding name="jmx-connector-server" port="1091"/> <socket-binding name="jndi" port="1099"/> <socket-binding name="osgi-http" port="8090"/> <socket-binding name="remoting" port="4447"/> <socket-binding name="txn-recovery-environment" port="4712"/> <socket-binding name="txn-status-manager" port="4713"/> </socket-binding-group> If you need any further information, please ask.
Thanks
-
10. Re: JSF redirects to ajp://
jaikiran Jul 25, 2011 3:46 AM (in response to bcn)Like I suspected, you have got the "scheme" wrong:
<connector name="ajp" protocol="AJP/1.3" socket-binding="ajp" scheme="ajp"/>
As per this http://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html the "scheme" is for:
Set this attribute to the name of the protocol you wish to have returned by calls to request.getScheme(). For example, you would set this attribute to "https" for an SSL Connector. The default value is "http".
So change the connector configuration to:
<connector name="ajp" protocol="AJP/1.3" socket-binding="ajp" scheme="http"/>
-
11. Re: JSF redirects to ajp://
bcn Jul 25, 2011 4:02 AM (in response to jaikiran)Oh dear! That is it!
I simply copied the line from https://docs.jboss.org/author/display/AS7/Apache+httpd. One should stress this point in that page!
I leave it to David to mark the thread as answered as I don't know if his problem is solved, too.
Thanks
-
12. Re: JSF redirects to ajp://
jaikiran Jul 25, 2011 4:10 AM (in response to bcn)u j wrote:
I simply copied the line from https://docs.jboss.org/author/display/AS7/Apache+httpd. One should stress this point in that page!
Fixed it in that doc. Thanks for pointing that out.
-
13. Re: JSF redirects to ajp://
fissy101 Jul 25, 2011 6:04 AM (in response to jaikiran)Thanks Jaikiran, that fixed it for me too.
-
14. Re: JSF redirects to ajp://
bcn Jul 26, 2011 12:19 PM (in response to fissy101)Hi,
now I'm stumbling over the next problem: I cannot reach the administration console, because in AS 7 it is on a different port (9990 by default) than 8080. In AS 6 it was on 8080, so no problem with a VirtualHost *.81 in Apache and ajp ProxyPass. But now the link on the welcome page is redirected to http://server_ip:9990/console, but remotely I cannot access it because jboss is bound to the localhost. I also cannot listen in Apache to 9990 because the port is used by jboss. Neither can I change the 9990 port to 8080 because jboss says address in use.
Any idea of how to solve this?
Thanks