Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Help setting up jetty with spring mvc

Now I have:

final Server server = new Server(8080);

        ProtectionDomain domain = HttpServer.class.getProtectionDomain();
        URL location = domain.getCodeSource().getLocation();

        WebAppContext webAppContext = new WebAppContext();
        webAppContext.setContextPath("/");
        webAppContext.setDescriptor(location.toExternalForm() + "/WEB-INF/web.xml");
        webAppContext.setServer(server);
        webAppContext.setWar(location.toExternalForm());

        server.setHandler(webAppContext);

        server.start();
        server.join();

Now in IntelliJ, when I right-click and select "Run HttpServer.main()" I get the following output:

012-08-29 20:18:50,506 [main] INFO  org.eclipse.jetty.server.Server - jetty-7.6.2.v20120308
2012-08-29 20:18:50,796 [main] INFO  org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
2012-08-29 20:18:50,872 [main] INFO  org.eclipse.jetty.server.handler.ContextHandler - started o.e.j.w.WebAppContext{/,file:/.../mywebapp-web/target/classes/},file:/../mywebapp/target/classes/
2012-08-29 20:18:50,937 [main] INFO  org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@0.0.0.0:8080

When I visit http://localhost:8080/ it seems to be just doing a file directory list of my project.  (when I run using tomcat via IntelliJ, it works fine)

Considering how little output there is (4-5 lines I pasted above), it def. isn't working.  I normally see ALLOT of output from spring, hibernate, etc.


On Wed, Aug 15, 2012 at 6:57 PM, Jesse McConnell <jesse.mcconnell@xxxxxxxxx> wrote:
setHandler

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx


On Wed, Aug 15, 2012 at 5:46 PM, S Ahmed <sahmed1020@xxxxxxxxx> wrote:
> I found this tutorial and when following it I got stuck when the
> ContentHandler adds the handler, my API doesn't have the 'addHandler'
> method.
>
> My version of jetty is 7.6.2.v20120308
>
> My code:
>
>         final Server server = new Server(8080);
>
>         final ContextHandler contextHandler = new ContextHandler();
>         contextHandler.setContextPath("/");
>         server.setHandler(contextHandler);
>
>         final DispatcherServlet dispatcherServlet = new DispatcherServlet();
>
> dispatcherServlet.setContextConfigLocation("classpath:web-context.xml");
>
>         final ServletHandler servletHandler = new ServletHandler();
>         servletHandler.addServletWithMapping(new
> ServletHolder(dispatcherServlet), "/*");
>
>         contextHandler.addHandler(servletHandler);   // ????????? no
> addHandler method
>
>         server.start();
>         server.join();
>
>
> Can someone help me with this?
>
> _______________________________________________
> 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