[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Embedding with Tomcat 9
From:       Thad Humphries <thad.humphries () gmail ! com>
Date:       2020-02-19 1:59:41
Message-ID: CA+bF-zy-Ye=e6YwgSt8gVtbycdVX=ZU_qAemAJAK=Ex7aFTrwg () mail ! gmail ! com
[Download RAW message or body]


On Tue, Feb 18, 2020 at 6:29 PM Mark Thomas <markt@apache.org> wrote:

> On 18/02/2020 23:13, Thad Humphries wrote:
> > On Tue, Feb 18, 2020 at 5:41 PM Mark Thomas <markt@apache.org> wrote:
> >> On 18/02/2020 22:32, calder wrote:
> >>> On Tue, Feb 18, 2020, 14:12 Thad Humphries <thad.humphries@gmail.com>
>
> <snip/>
>
> >>>> However although this runs it returns a 404 on /employee. Why?
> >>
> >> There aren't (doesn't appear to be)  any Servlets mapped.
> >>
> >> Are there any web applications in the appBase?
> >>
> >
> > There is a servlet
> > in src/main/java/com/example/employees, EmployeeServlet.java, with the
> > annotation
> >
> >   @WebServlet(
> >     name = "EmployeeServlet",
> >     urlPatterns = {"/employee"}
> >   )
>
> OK. That will be relying on the StandardJarScanner finding that class -
> which it should.
>
> > In src/main/webapp is the file index.jsp which redirects to /employee:
>
> OK. Maven is copying that to META-INF/resources and hoping that Tomcat
> will treat the entire JAR as a resource JAR. That should work.
>
> > <%@ page info="sample index page" %>
> > <html>
> > <body>
> > <h2>Hello World!</h2>
> > <jsp:forward page="/employee" />
> > </body>
> > </html>
> >
> > With Tomcat 7.0.57, I can run `java -jar
> > employees-app-1.0-SNAPSHOT-jar-with-dependencies.jar` in target, and load
> > the page at http://localhost:8888/.  With Tomcat 9.0.31, I get a 404
>
> Not sure which part is failing at this point. Using a purely static JSP
> without the forward and accessing /employee directly should tell you which.


If I comment out the jsp:forward, http://localhost:8888/ loads. However
http://localhost:8888/employee
still returns a 404.

I'd then recommend debugging your way though the Tomcat start process to
>
see where whichever element is failing is going wrong.
>

I'll see if I can figure out how to do that. Eclipse and I are not on the
best of terms. Frankly, loading JSPs is not something I need to do for how
I envision using embedded Tomcat. But I figure I need to know what's
happening because if I don't, I'm sure to run into problems down the road
when I'm dealing with something more complex.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic