Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Serving JSPs from Jetty - What am I missing

Cefn,

if you look at the bottom of that bugzilla, you will see that it notes
that there is a (mistaken?) use of the Maven 'provided' scope which
results in the dependencies being effectively not declared -- or at
least there was when I went through this before.

--benson


On Fri, Dec 24, 2010 at 8:54 AM, Cefn Hoile
<jetty-users_eclipse.org@xxxxxxxx> wrote:
> Thanks for your pointers, Michael. Really useful and I got JSPs up and
> running on Jetty 7 in no time. Couple of quick notes.
>
> In the maven ids available to me there wasn't a 'jetty-server-all',
> but there was a 'jetty-server' under org.eclipse.jetty.aggregate which
> sounded close to what you were suggesting. I selected version 7.2.2 to
> avoid the IP issues you mention about the version 8 deps.
>
> I'm still relying on Jasper I think, but only as loaded through
> glassfish, so I stuck with my original binding to Jasper's JspServlet,
> which seemed to work once I'd explicitly specified the root path with
> ServletContextHandler#setResourceBase(".") pointing to the current
> working directory before Server#start(). The resource base otherwise
> defaults to null hence some of the problems I was experiencing before,
> I guess.
>
> I'm confused why org.eclipse.jetty:jetty-jsp-2.1 isn't configured to
> trigger a download of its dependencies. I can see the dependencies
> mentioned in its POM, but it lists them as 'provided', meaning it
> doesn't automatically cause them to be requested from the repo, and I
> have to manually add them. Funnily enough the combination of jetty and
> jetty-jsp-2.1 was one of the original combinations I tried. When I
> found jetty-jsp-2.1 loaded a single jar with a single logging class
> file and nothing else to do with JSPs I assumed I was doing the wrong
> thing and looked elsewhere.
>
> Is this issue with dependency declarations a bug which needs reporting?
>
> For others seeking a similar configuration I also needed to add the
> jetty-servlet dependency explicitly to give me DefaultServlet for
> static fileserving, although I suppose there are a few configurations
> which wouldn't require this.
>
> Cefn
> http://cefn.com
>
> On 24 December 2010 01:09, Michael Gorovoy <michael@xxxxxxxxxxx> wrote:
>> All Jetty 7 releases starting with Jetty 7.1 contain JSP support out of the
>> box using Glassfish binaries, so you should not add a Jasper dependency to
>> your project. Please refer to Bug 330418 for the explanation of the Maven
>> dependencies of Jetty JSP support module. The JSP support modules for Jetty
>> 8 are undergoing the IP process at the Eclipse Foundation. If you would like
>> to use Jetty 8 with JSP support, your best bet is to download Jetty Hightide
>> distribution from Codehaus.
>>
>> If you are starting the server programmatically, your should use one of the
>> Jetty aggregate modules (e.g. jetty-server-all) that contains everything you
>> would need to start and run Jetty server as your Maven project dependency.
>> Your JSP files should be located in the root directory or sub-directories of
>> the root directory of your web application. Please refer to
>> LikeJettyXml.java from examples-jetty-embedded module for the example of how
>> to start embedded Jetty that contains web application support.
>>
>> Thanks,
>> Michael
>>
>> On Thu, Dec 23, 2010 at 1:54 PM, Cefn Hoile
>> <jetty-users_eclipse.org@xxxxxxxx> wrote:
>>>
>>> Hello all, having christmas fun configuring Jetty. I have hello world
>>> and freemarker servlets working but I'm stuck getting it to serve
>>> JSPs.
>>>
>>> From what I can see, I should use Jasper with Jetty to get JSP
>>> support. Reckon I have the JspServlet loading and serving without
>>> Exceptions, but I think it's failing to find .jsp files, and I've
>>> tried putting them in the working directory, in WEB-INF, and various
>>> other places with no luck.
>>>
>>> I'm guessing there's some option for Jasper which is automagically
>>> configured in a Tomcat setup which I'll have to do explicitly for
>>> Jetty, but I don't know what. The init params for JspServlet offer no
>>> useful control variables about pointing to .jsp files...
>>> http://tomcat.apache.org/tomcat-4.1-doc/jasper-howto.html#Configuration
>>>
>>> Jetty is launched explicitly like...
>>> Server server = new Server(8080);
>>> ...and I have the equivalent of web.xml wiring all requests for JSPs
>>> to the jasper JspServlet class, which looks like this in Guice...
>>> serve("*.jsp").with(JspServlet.class);
>>> ...but when a jsp is actually routed to the JspServlet it responds...
>>>
>>> HTTP ERROR: 404
>>> Problem accessing /index.jsp. Reason:
>>>    /index.jsp
>>> Powered by Jetty://
>>>
>>> Am I right in thinking I can use Jasper's JspServlet to give me JSPs
>>> on Jetty? The Jetty docs are pretty sketchy on JSPs, and everything
>>> else on the subject points to Tomcat.
>>>
>>> If Jasper is the right way to go, what configuration step am I
>>> missing, e.g. to somehow tell Jasper where to look for .jsp files?
>>>
>>> Given the mysterious error message, perhaps there's a missing
>>> dependency? If so, can anyone tell me what dependencies I need to add
>>> to Jetty 8 in order to be able to serve JSPs (I've been adding many
>>> combinations of things from Maven repos and no luck so far). Currently
>>> the relevant dependencies in my POM are...
>>>
>>> org.eclipse.jetty jetty-distribution 8.0.0.M2
>>> org.eclipse.jetty jetty-jsp-2.1 7.22
>>> javax.servlet jstl 1.2
>>> org.apache.tomcat jsp-api 6.0.29
>>> org.apache.tomcat jasper 6.0.29
>>>
>>> If anyone can guide me to initialise Jasper's JspServlet correctly, or
>>> suggest a alternate JSP engine with a known working configuration on
>>> Jetty, that would be great.
>>>
>>> Cefn
>>> http://cefn.com
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>


Back to the top