Hi
It is difficult to find out where is you problem without having the whole
source code. You write you can access the jsp
and servlet. It means, your web application has been successfully installed and
started in ServiceMix.
I can only prove the jsp forward works in ServiceMix. I have installed the
sample from Pax Web in ServiceMix using:
karaf@root>install -s
war:mvn:org.ops4j.pax.web.samples/war-dispatch-jsp/3.1.2/war?Web-ContextPath=/&Bundle-SymbolicName=war-dispatch-jsp
Bundle ID: 230
I had to define the Web-ContextPath, because the sample is no wab but only a
war.
After that I can see the bundle metadata
karaf@root>headers 230
war-dispatch-jsp (230)
----------------------
Manifest-Version = 1.0
Bnd-LastModified = 1427842511101
Archiver-Version = Plexus Archiver
Tool = Bnd-2.2.0.20130927-173417
Originally-Created-By = Apache Maven
WAR-URL = mvn:org.ops4j.pax.web.samples/war-dispatch-jsp/3.1.2/war
Built-By = jbonofre
Web-ContextPath = /
Generated-By-Ops4j-Pax-From =
mvn:org.ops4j.pax.web.samples/war-dispatch-jsp/3.1.2/war
Build-Jdk = 1.7.0_67
Created-By = 1.7.0_76 (Oracle Corporation)
Bundle-Name = war-dispatch-jsp
Bundle-SymbolicName = war-dispatch-jsp
Bundle-Version = 0
Bundle-ManifestVersion = 2
Bundle-ClassPath = WEB-INF/classes
Import-Package =
javax.servlet,
javax.servlet.http,
org.slf4j;resolution:=optional;provider=paxlogging,
org.slf4j.spi;resolution:=optional;provider=paxlogging,
org.apache.log4j.spi;resolution:=optional;provider=paxlogging,
org.slf4j.helpers;resolution:=optional;provider=paxlogging,
javax.servlet.jsp.el;resolution:=optional,
javax.servlet.jsp;resolution:=optional,
org.apache.commons.logging;resolution:=optional;provider=paxlogging,
org.apache.log4j;resolution:=optional;provider=paxlogging,
org.ops4j.pax.web.extender.samples.war.dispatch.jsp;resolution:=optional,
org.apache.commons.logging.impl;resolution:=optional;provider=paxlogging,
org.apache.log4j.xml;resolution:=optional;provider=paxlogging
I don't know how your bundle look like. Have you defined the Web-ContextPath
metadata? Please check the bundles headers
(with headers command) whether your bundle defines all necessary metadata.
After the installation I can inspect my web applications:
karaf@root>web:list
ID | State | Web-State | Level | Web-ContextPath | Name
--------------------------------------------------------------------------------
230 | Active | Deployed | 80 | / | war-dispatch-jsp (0)
Next I can access my servlet under following url
http://localhost:8181/wc/dispatch/jsp and the servlet redirects the
call in the jsp page.
Could you check your bundle again and try to find of you have done something
different than the Pax Web sample?
Regards
Krzysztof
On 31.03.2015 16:11, ridhi wrote:
> I have a war deployed in ServiceMix 6 Milestone version. I am able to access
> the servlet and jsps from the browser. In my Servlet I have a JSP forward,
> that i am doing by using RequestDispatcher. I have followed the sample
> which is in
> https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples/war-dispatch-jsp
> . I don't see any error in the log or exception in console, but it is not
> letting me forward to the jsp from my Servlet. Below are the war related
> features I have installed:
> * <feature>war</feature>
> <feature>camel-core</feature>
> <feature>camel-http</feature>
> <feature>camel-servlet</feature>*
>
> I could be missing some feature or something could be wrong the way I am
> doing. Please help me in resolving this.
> My Servlet Code:
>
> * rd = super.getServletContext().getNamedDispatcher(
> "jsp");
> rd.forward(new HttpServletRequestFilter(request,
> "/success.jsp"),
> response);
>
> This is the code, copied from the pax sample :
>
> private static class HttpServletRequestFilter extends
> HttpServletRequestWrapper {
>
> private String pathInfo;
>
> public HttpServletRequestFilter(HttpServletRequest request,
> String pathInfo) {
> super(request);
> this.pathInfo = pathInfo;
> }
>
> public String getServletPath() {
> return "/";
> }
>
> public String getPathInfo() {
> return pathInfo;
> }
> }*
>
> My web.xml
>
> *<servlet>
> <servlet-name>HomeController</servlet-name>
> <servlet-class>com.vnet7.servicehub.servlets.HomeController
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>HomeController</servlet-name>
> <url-pattern>/HomeController</url-pattern>
> </servlet-mapping>
> <servlet>
> <servlet-name>JspController</servlet-name>
> <servlet-class>com.vnet7.servicehub.servlets.JspController
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>JspController</servlet-name>
> <url-pattern>/jsp</url-pattern>
> </servlet-mapping>*
>
>
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/Jsp-Forward-not-working-in-the-Servlet-Deployed-in-Servicemix-tp5722427.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Krzysztof Sobkowiak
JEE & OSS Architect
Apache Software Foundation Member
Apache ServiceMix <http://servicemix.apache.org/> Committer & PMC
Senior Solution Architect @ Capgemini SSC <http://www.pl.capgemini-sdm.com/en/>