You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Deepal jayasinghe <de...@gmail.com> on 2009/10/05 05:14:44 UTC
[Axis2] Axis2 war deployment does not work in the current trunk
Hi Devs;
I build the war from the trunk and try to deploy that, everything works
fine. However when I try to list the services it gave me the following
error. I think this has something to do with the changes that Andreas
did.
javax.servlet.ServletException: http is forbidden
at
org.apache.axis2.transport.http.AxisServlet.preprocessRequest(AxisServlet.java:628)
at
org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:246)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
As I can see this is a big issues (unless I have something done wrong).
I just went though the source code and found few issues with that, so we
need to fix those; Following code in AxisServlet is not correct.
httpListener = getAxisServletListener(Constants.TRANSPORT_HTTP);
httpsListener =
getAxisServletListener(Constants.TRANSPORT_HTTPS);
if (httpListener == null && httpsListener == null) {
log.warn("No transportReceiver for " +
AxisServletListener.class.getName() +
" found. An instance for HTTP will be configured
automatically. " +
"Please update your axis2.xml file!");
httpListener = new AxisServletListener();
TransportInDescription transportInDescription = new
TransportInDescription(
Constants.TRANSPORT_HTTP);
transportInDescription.setReceiver(httpListener);
axisConfiguration.addTransportIn(transportInDescription);
} else if (httpListener != null && httpsListener != null
&& httpListener.getPort() == -1 &&
httpsListener.getPort() == -1) {
log.warn("If more than one transportReceiver for " +
AxisServletListener.class.getName() + " exists,
then all instances " +
"must be configured with a port number. WSDL
generation will be " +
"unreliable.");
}
Why do we need to call the following method for each request ?
private void preprocessRequest(HttpServletRequest req) throws
ServletException {
initContextRoot(req);
TransportInDescription transportInDescription =
req.isSecure()?
this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTP) :
this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTPS);
if (transportInDescription == null){
throw new ServletException(req.getScheme() + " is forbidden");
} else {
if (transportInDescription.getReceiver() instanceof
AxisServletListener){
AxisServletListener listner = (AxisServletListener)
transportInDescription.getReceiver();
// Autodetect the port number if necessary
if (listner.getPort() == -1){
listner.setPort(req.getServerPort());
}
}
}
}
As I can see something is really broken, please fix it (or else I might
have to revert to the original AxisServlet code).
Thanks,
Deepal
Re: [Axis2] Axis2 war deployment does not work in the current trunk
Posted by Deepal jayasinghe <de...@gmail.com>.
Thanks Amila, now it works.
>
>
> On Mon, Oct 5, 2009 at 8:44 AM, Deepal jayasinghe <deepalk@gmail.com
> <ma...@gmail.com>> wrote:
>
> Hi Devs;
>
> I build the war from the trunk and try to deploy that, everything
> works
> fine. However when I try to list the services it gave me the following
> error. I think this has something to do with the changes that Andreas
> did.
>
>
> No this from the later change I did. Now it is fixed in the trunk.
>
> For this fix we need to shift a separate axis2.xml
> for web app with the new transports. Will do that as well.
>
> thanks,
> Amila.
>
>
>
> javax.servlet.ServletException: http is forbidden
> at
> org.apache.axis2.transport.http.AxisServlet.preprocessRequest(AxisServlet.java:628)
> at
> org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:246)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>
>
> As I can see this is a big issues (unless I have something done
> wrong).
>
> I just went though the source code and found few issues with that,
> so we
> need to fix those; Following code in AxisServlet is not correct.
>
>
> httpListener =
> getAxisServletListener(Constants.TRANSPORT_HTTP);
> httpsListener =
> getAxisServletListener(Constants.TRANSPORT_HTTPS);
>
> if (httpListener == null && httpsListener == null) {
> log.warn("No transportReceiver for " +
> AxisServletListener.class.getName() +
> " found. An instance for HTTP will be
> configured
> automatically. " +
> "Please update your axis2.xml file!");
> httpListener = new AxisServletListener();
> TransportInDescription transportInDescription = new
> TransportInDescription(
> Constants.TRANSPORT_HTTP);
> transportInDescription.setReceiver(httpListener);
>
> axisConfiguration.addTransportIn(transportInDescription);
> } else if (httpListener != null && httpsListener != null
> && httpListener.getPort() == -1 &&
> httpsListener.getPort() == -1) {
> log.warn("If more than one transportReceiver for " +
> AxisServletListener.class.getName() + " exists,
> then all instances " +
> "must be configured with a port number. WSDL
> generation will be " +
> "unreliable.");
> }
>
>
> Why do we need to call the following method for each request ?
>
> private void preprocessRequest(HttpServletRequest req) throws
> ServletException {
> initContextRoot(req);
>
> TransportInDescription transportInDescription =
> req.isSecure()?
> this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTP) :
>
> this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTPS);
>
> if (transportInDescription == null){
> throw new ServletException(req.getScheme() + " is
> forbidden");
> } else {
> if (transportInDescription.getReceiver() instanceof
> AxisServletListener){
> AxisServletListener listner = (AxisServletListener)
> transportInDescription.getReceiver();
> // Autodetect the port number if necessary
> if (listner.getPort() == -1){
> listner.setPort(req.getServerPort());
> }
> }
> }
>
> }
>
>
> As I can see something is really broken, please fix it (or else I
> might
> have to revert to the original AxisServlet code).
>
> Thanks,
> Deepal
>
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
--
Thank you!
http://blogs.deepal.org
http://deepal.org
Re: [Axis2] Axis2 war deployment does not work in the current trunk
Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Oct 5, 2009 at 8:44 AM, Deepal jayasinghe <de...@gmail.com> wrote:
> Hi Devs;
>
> I build the war from the trunk and try to deploy that, everything works
> fine. However when I try to list the services it gave me the following
> error. I think this has something to do with the changes that Andreas
> did.
>
No this from the later change I did. Now it is fixed in the trunk.
For this fix we need to shift a separate axis2.xml
for web app with the new transports. Will do that as well.
thanks,
Amila.
>
> javax.servlet.ServletException: http is forbidden
> at
>
> org.apache.axis2.transport.http.AxisServlet.preprocessRequest(AxisServlet.java:628)
> at
> org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:246)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>
>
> As I can see this is a big issues (unless I have something done wrong).
>
> I just went though the source code and found few issues with that, so we
> need to fix those; Following code in AxisServlet is not correct.
>
>
> httpListener = getAxisServletListener(Constants.TRANSPORT_HTTP);
> httpsListener =
> getAxisServletListener(Constants.TRANSPORT_HTTPS);
>
> if (httpListener == null && httpsListener == null) {
> log.warn("No transportReceiver for " +
> AxisServletListener.class.getName() +
> " found. An instance for HTTP will be configured
> automatically. " +
> "Please update your axis2.xml file!");
> httpListener = new AxisServletListener();
> TransportInDescription transportInDescription = new
> TransportInDescription(
> Constants.TRANSPORT_HTTP);
> transportInDescription.setReceiver(httpListener);
> axisConfiguration.addTransportIn(transportInDescription);
> } else if (httpListener != null && httpsListener != null
> && httpListener.getPort() == -1 &&
> httpsListener.getPort() == -1) {
> log.warn("If more than one transportReceiver for " +
> AxisServletListener.class.getName() + " exists,
> then all instances " +
> "must be configured with a port number. WSDL
> generation will be " +
> "unreliable.");
> }
>
>
> Why do we need to call the following method for each request ?
>
> private void preprocessRequest(HttpServletRequest req) throws
> ServletException {
> initContextRoot(req);
>
> TransportInDescription transportInDescription =
> req.isSecure()?
> this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTP) :
>
> this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTPS);
>
> if (transportInDescription == null){
> throw new ServletException(req.getScheme() + " is forbidden");
> } else {
> if (transportInDescription.getReceiver() instanceof
> AxisServletListener){
> AxisServletListener listner = (AxisServletListener)
> transportInDescription.getReceiver();
> // Autodetect the port number if necessary
> if (listner.getPort() == -1){
> listner.setPort(req.getServerPort());
> }
> }
> }
>
> }
>
>
> As I can see something is really broken, please fix it (or else I might
> have to revert to the original AxisServlet code).
>
> Thanks,
> Deepal
>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/