0

For some reason Apache Tomcat 7.0 doesn't run my main servlet(PlaceListServlet) that should list a bunch of database items on place-list.jsp page.

I keep getting 404 everywhere, and Eclipse doesn't report any errors in the source.

What seems to be the problem?

PlaceListServlet.java (main servlet that should load place-list.jsp):

package com.myproject.crud;

import java.io.IOException;

import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("serial")
@WebServlet({"/place/", "index.jsp"})
public class PlaceListServlet extends HttpServlet {

    @Inject
    private PlaceRepositoryImpl placeRepo = new PlaceRepositoryImpl();

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setAttribute("places", placeRepo.listPlaces());
        getServletContext().getRequestDispatcher("/WEB-INF/pages/place-list.jsp").forward(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    }

}

EDIT:

I just looked at the console and saw this error:

SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Oct 19, 2012 11:34:45 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: Skipped installing application listeners due to previous error(s) Oct 19, 2012 11:34:45 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Oct 19, 2012 11:34:45 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/GBCPlacesCRUD] startup failed due to previous errors Oct 19, 2012 11:34:45 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Oct 19, 2012 11:34:45 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Oct 19, 2012 11:34:45 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 1096 ms

4

1 回答 1

0

将 javax.faces-2.1.13.jar 添加到项目中解决了这个问题。

http://javaserverfaces.java.net/

于 2012-10-19T16:15:51.857 回答