Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Jetty failure accessing JSP
Jetty failure accessing JSP [message #135101] Thu, 09 July 2009 10:34 Go to next message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Dear Sir,
I've succesfully run a bundle implementing a servlet that response to an
HttpServletRequest, using Equinox with Jetty in an Eclipse project.

My problem is that simply changing the response from my servelet, from:
"
resp.getWriter().println("<html><body>Hello from old-Servlet1 </body></html>");
"
to
"
resp.sendRedirect("index.jsp");
"

I get an error in the browser, like:
"
HTTP ERROR 404
Problem accessing /index.jsp. Reason:
ProxyServlet: /index.jsp
"

Where "index.jsp" is a very simple JSP that works OK on a different
configuration (i.e. Eclipse on Tomcat).
The problem seems related to the fact that the "index.jsp" is not
available in "some classpath" for the Jetty engine, but I have no idea
where this "classpath" information should be placed.
I've not found any structure like the "webapp" that I use for Tomcat, so I
have really no clue.

Can you give me some hint?

Thanks in advance.
Kind regards.
Maurizio
Re: Jetty failure accessing JSP [message #135128 is a reply to message #135101] Thu, 09 July 2009 14:51 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
This should definitely work. Can you post a sample project to show what
you're doing
Can you access the index.jsp directly e.g. without the redirect?

-Simon


"Maurizio " <maurizio.lilli@abodata.com> wrote in message
news:6490b092c5f4bc360e467d39a2525ad2$1@www.eclipse.org...
> Dear Sir,
> I've succesfully run a bundle implementing a servlet that response to an
> HttpServletRequest, using Equinox with Jetty in an Eclipse project.
>
> My problem is that simply changing the response from my servelet, from:
> "
> resp.getWriter().println("<html><body>Hello from old-Servlet1
> </body></html>");
> "
> to
> "
> resp.sendRedirect("index.jsp");
> "
>
> I get an error in the browser, like:
> "
> HTTP ERROR 404
> Problem accessing /index.jsp. Reason: ProxyServlet: /index.jsp
> "
>
> Where "index.jsp" is a very simple JSP that works OK on a different
> configuration (i.e. Eclipse on Tomcat).
> The problem seems related to the fact that the "index.jsp" is not
> available in "some classpath" for the Jetty engine, but I have no idea
> where this "classpath" information should be placed.
> I've not found any structure like the "webapp" that I use for Tomcat, so I
> have really no clue.
>
> Can you give me some hint?
>
> Thanks in advance.
> Kind regards.
> Maurizio
>
Re: Jetty failure accessing JSP [message #135154 is a reply to message #135128] Thu, 09 July 2009 16:34 Go to previous messageGo to next message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Dear Simon,
The answer to your question is: no, I cannot even acces the index.jsp from
the browser.

The only thing that I can do from the browser is:
"http://localhost:8080/myservlet"
This works OK and I can make some HTML through the
resp.getWriter().println(..).

But, if I do:
"http://localhost:8080/index.jsp"
I get the same error that I mentioned in my initial email, and to be
honest with you I think that they should be the same thing then the
resp.sendRedirect("index.jsp").

This is why I thought it could be a problem of "some classpath missing"
for Jetty server.
Where do I specify to the Jetty server the root of my web-app?
Using Tomcat I have the "webapp" folder and everything is in it.
Using the Jetty bundle where I can find it, if this still makes sense?

I could also post my small project, but I don't see from this web-form any
possibility to adding some attachement. Is there any way?

Thanks in advance for any hint in resolving this issue.
Kind regards.
Maurizio
Re: Jetty failure accessing JSP [message #135197 is a reply to message #135154] Thu, 09 July 2009 20:26 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
How are you registering your JSPs? (Are you using
org.eclipse.equinox.jsp.jasper.JspServlet)
Are you using the extension registry or registering your Servlet's directly
using the OSGi HttpService.

-Simon

"Maurizio " <maurizio.lilli@abodata.com> wrote in message
news:8d40b45371480533525fbd4d2050f715$1@www.eclipse.org...
> Dear Simon,
> The answer to your question is: no, I cannot even acces the index.jsp from
> the browser.
>
> The only thing that I can do from the browser is:
> "http://localhost:8080/myservlet"
> This works OK and I can make some HTML through the
> resp.getWriter().println(..).
>
> But, if I do:
> "http://localhost:8080/index.jsp"
> I get the same error that I mentioned in my initial email, and to be
> honest with you I think that they should be the same thing then the
> resp.sendRedirect("index.jsp").
>
> This is why I thought it could be a problem of "some classpath missing"
> for Jetty server.
> Where do I specify to the Jetty server the root of my web-app?
> Using Tomcat I have the "webapp" folder and everything is in it.
> Using the Jetty bundle where I can find it, if this still makes sense?
>
> I could also post my small project, but I don't see from this web-form any
> possibility to adding some attachement. Is there any way?
>
> Thanks in advance for any hint in resolving this issue.
> Kind regards.
> Maurizio
>
Re: Jetty failure accessing JSP [message #135237 is a reply to message #135197] Fri, 10 July 2009 07:55 Go to previous messageGo to next message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Hi Simon,
Thanks for your reply.

I'm registering the JSPs in my plugin.xml using:
"
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/index.jsp"
class="org.eclipse.equinox.jsp.jasper.registry.JSPFactory" />
</extension>
"
For this I've also installed two bundles:
org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830, and
org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830

I think that the above means that "I'm using the extension registry and
NOT the OSGi HttpService". I presume that this is OK, is it?

I'm NOT using org.eclipse.equinox.jsp.jasper.JspServlet.
My servlet is defined like:
"
...
public class Servlet1 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
....
resp.sendRedirect("/index.jsp");
}
"

That's all I need to do.
What should I do for getting my "index.jsp" visible from that context?

Note also that I've checked via
"getServletContext().getResource("/index.jsp")" and
"getServletContext().getResourcePaths("/")", and both of them return valid
info. The seconds indicate:
"
[/bin/, /index.jsp, /.classpath, /WEB-INF/, /build.properties,
/.settings/, /plugin.xml, /.project, /src/, /hello.jsp, /META-INF/]
"

This looks like that my "index.jsp" is a valid resource for the context.
Is it?

Thanks in advance for your help.
Kind regards.
Maurizio
Re: Jetty failure accessing JSP [message #135249 is a reply to message #135237] Fri, 10 July 2009 08:15 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Maurizio schrieb:
> For this I've also installed two bundles:
> org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830, and
> org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830

You need a bit more bundles. They have dependencies which will need to
be satisfied.

Can you launch with "-console" and type "ss" in the console to see if
all bundles resolve correctly?

-Gunnar

--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
Re: Jetty failure accessing JSP [message #135285 is a reply to message #135249] Fri, 10 July 2009 09:16 Go to previous messageGo to next message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Dear Gunnar,
Invoking ss at the Equinox console indicates:

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20090520
2 ACTIVE javax.servlet.jsp_2.0.0.v200806031607
3 ACTIVE org.eclipse.equinox.http.jetty_2.0.0.v20090520-1800
4 ACTIVE org.eclipse.osgi.services_3.2.0.v20090520-1800
5 ACTIVE org.apache.jasper_5.5.17.v200903231320
6 ACTIVE org.mortbay.jetty.util_6.1.15.v200905182336
7 ACTIVE org.eclipse.core.jobs_3.4.100.v20090429-1800
8 ACTIVE org.mortbay.jetty.server_6.1.15.v200905151201
9 ACTIVE org.eclipse.equinox.http.registry_1.0.200.v20090520-1800
10 ACTIVE org.eclipse.equinox.common_3.5.0.v20090520-1800
11 ACTIVE org.eclipse.equinox.http.servlet_1.0.200.v20090520-1800
12 RESOLVED
org.eclipse.core.runtime.compatibility.registry_3.2.200.v200 90429-1800
Master=15
13 ACTIVE org.apache.ant_1.7.1.v20090120-1145
14 ACTIVE org.apache.commons.logging_1.0.4.v200904062259
15 ACTIVE org.eclipse.equinox.registry_3.4.100.v20090520-1800
Fragments=12
16 ACTIVE javax.servlet_2.5.0.v200806031605
17 ACTIVE org.apache.commons.el_1.0.0.v200806031608
38 ACTIVE examples.servlet_1.0.0.qualifier
39 <<LAZY>> org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830
40 <<LAZY>> org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830

How can I understand from this if I'm missing something?

Thanks for your help.
Kind regards.
Maurizio
Re: Jetty failure accessing JSP [message #135414 is a reply to message #135249] Fri, 10 July 2009 14:22 Go to previous messageGo to next message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Dear Gunnar,
According to what I read in the "OSGi based JSP Support" from the Eclipse
site, the required bundle should be:

javax.servlet.jsp [branch v2_0])
org.apache.common.logging [v1_0_4])
org.apache.commons.el [branch v1_0])
org.apache.jasper [branch v5_5_17])

Finally I do have all of them in the ACTIVE state:

0 ACTIVE org.eclipse.osgi_3.5.0.v20090520
2 ACTIVE javax.servlet.jsp_2.0.0.v200806031607
3 ACTIVE org.eclipse.equinox.http.jetty_2.0.0.v20090520-1800
4 ACTIVE org.eclipse.osgi.services_3.2.0.v20090520-1800
5 ACTIVE org.apache.jasper_5.5.17.v200903231320
6 ACTIVE org.mortbay.jetty.util_6.1.15.v200905182336
7 ACTIVE org.eclipse.core.jobs_3.4.100.v20090429-1800
8 ACTIVE org.mortbay.jetty.server_6.1.15.v200905151201
9 ACTIVE org.eclipse.equinox.http.registry_1.0.200.v20090520-1800
10 ACTIVE org.eclipse.equinox.common_3.5.0.v20090520-1800
11 ACTIVE org.eclipse.equinox.http.servlet_1.0.200.v20090520-1800
12 RESOLVED
org.eclipse.core.runtime.compatibility.registry_3.2.200.v200 90429-1800
Master=15
13 ACTIVE org.apache.ant_1.7.1.v20090120-1145
14 ACTIVE org.apache.commons.logging_1.0.4.v200904062259
15 ACTIVE org.eclipse.equinox.registry_3.4.100.v20090520-1800
Fragments=12
16 ACTIVE javax.servlet_2.5.0.v200806031605
17 ACTIVE org.apache.commons.el_1.0.0.v200806031608
39 ACTIVE org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830
40 ACTIVE org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830
47 ACTIVE examples.servlet_1.0.0.qualifier

Despite that, I still get the error message:

HTTP ERROR 404
Problem accessing /index.jsp. Reason:
/index.jsp

Where should I focus?

Thanks.
Kind regards.
Maurizio
Re: Jetty failure accessing JSP [message #135439 is a reply to message #135414] Fri, 10 July 2009 15:39 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
That looks good so suggests something fairly basic is going wrong. Probably
the fastest way to get help is to export your "examples" project and attach
it so someone can take a look.
-Simon


"Maurizio " <maurizio.lilli@abodata.com> wrote in message
news:7aab1b509387d3603c47dd38826c6c35$1@www.eclipse.org...
> Dear Gunnar,
> According to what I read in the "OSGi based JSP Support" from the Eclipse
> site, the required bundle should be:
>
> javax.servlet.jsp [branch v2_0]) org.apache.common.logging [v1_0_4])
> org.apache.commons.el [branch v1_0]) org.apache.jasper [branch v5_5_17])
>
> Finally I do have all of them in the ACTIVE state:
>
> 0 ACTIVE org.eclipse.osgi_3.5.0.v20090520
> 2 ACTIVE javax.servlet.jsp_2.0.0.v200806031607
> 3 ACTIVE org.eclipse.equinox.http.jetty_2.0.0.v20090520-1800
> 4 ACTIVE org.eclipse.osgi.services_3.2.0.v20090520-1800
> 5 ACTIVE org.apache.jasper_5.5.17.v200903231320
> 6 ACTIVE org.mortbay.jetty.util_6.1.15.v200905182336
> 7 ACTIVE org.eclipse.core.jobs_3.4.100.v20090429-1800
> 8 ACTIVE org.mortbay.jetty.server_6.1.15.v200905151201
> 9 ACTIVE org.eclipse.equinox.http.registry_1.0.200.v20090520-1800
> 10 ACTIVE org.eclipse.equinox.common_3.5.0.v20090520-1800
> 11 ACTIVE org.eclipse.equinox.http.servlet_1.0.200.v20090520-1800
> 12 RESOLVED
> org.eclipse.core.runtime.compatibility.registry_3.2.200.v200 90429-1800
> Master=15
> 13 ACTIVE org.apache.ant_1.7.1.v20090120-1145
> 14 ACTIVE org.apache.commons.logging_1.0.4.v200904062259
> 15 ACTIVE org.eclipse.equinox.registry_3.4.100.v20090520-1800
> Fragments=12
> 16 ACTIVE javax.servlet_2.5.0.v200806031605
> 17 ACTIVE org.apache.commons.el_1.0.0.v200806031608
> 39 ACTIVE org.eclipse.equinox.jsp.jasper_1.0.100.v20080427-0830
> 40 ACTIVE
> org.eclipse.equinox.jsp.jasper.registry_1.0.0.v20080427-0830
> 47 ACTIVE examples.servlet_1.0.0.qualifier
>
> Despite that, I still get the error message:
>
> HTTP ERROR 404
> Problem accessing /index.jsp. Reason: /index.jsp
>
> Where should I focus?
>
> Thanks.
> Kind regards.
> Maurizio
>
Re: Jetty failure accessing JSP [message #135463 is a reply to message #135439] Fri, 10 July 2009 15:46 Go to previous messageGo to next message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Dear Simon,
How can I export my project?
Is there any simpl,e way for sending a ZIP or something?

Thanks.
Kind regards.
Maurizio
Re: Jetty failure accessing JSP [message #135502 is a reply to message #135463] Fri, 10 July 2009 18:04 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Here's the trimmed down zip Maurizio sent me.

I've just take a quick look however I notice that you are using "/index.jsp"
as your alias. In terms of the lookup done this will map a request for
index.jsp to the "/" resource in your Httpcontext. Alias is used as a prefix
to match against so for alias="/index.jsp", if you want to be really sick
try http://localhost/index.jsp/index.jsp. I'd suggest instead to use the
alias "/*.jsp".

HTH
-Simon



"Maurizio " <maurizio.lilli@abodata.com> wrote in message
news:026914cb9b52a63592f9b5fedfb6b847$1@www.eclipse.org...
> Dear Simon,
> How can I export my project?
> Is there any simpl,e way for sending a ZIP or something?
>
> Thanks.
> Kind regards.
> Maurizio
>
Re: Jetty failure accessing JSP [message #135516 is a reply to message #135463] Fri, 10 July 2009 18:08 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Here's the trimmed down zip Maurizio sent me.


"Maurizio " <maurizio.lilli@abodata.com> wrote in message
news:026914cb9b52a63592f9b5fedfb6b847$1@www.eclipse.org...
> Dear Simon,
> How can I export my project?
> Is there any simpl,e way for sending a ZIP or something?
>
> Thanks.
> Kind regards.
> Maurizio
>



Re: Jetty failure accessing JSP [message #135544 is a reply to message #135502] Fri, 10 July 2009 20:31 Go to previous message
Maurizio  is currently offline Maurizio Friend
Messages: 34
Registered: July 2009
Member
Dear Simon,
I cannot believe .... it seems like a VERY stupid thing, does it?

Everything is up-and-running, now!

Thanks a million.
Kind regards.
Maurizio
Previous Topic:org.eclipse.equinox.http.servlet.jar
Next Topic:Jetty - HTTP ERROR 500
Goto Forum:
  


Current Time: Sat Apr 20 02:04:33 GMT 2024

Powered by FUDForum. Page generated in 0.05153 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top