Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] registering a servlet programmatically in jetty 7

Phil,

your code has registered the servlet at /context/hessian-service
but your client is looking for it at /hessian-service

try / for the context path.

cheers



phil swenson wrote:
> Hi, I'm trying to register a Hessian Servlet in Jetty 7.0
> programmatically.  All the examples I find are for Jetty 6, and Jetty 7
> is quite different.  Here is my server side:
> 
>     import org.eclipse.jetty.server.Server;
>     import org.eclipse.jetty.servlet.ServletContextHandler;
>         
>     public class Bootstrapper {
>          public static void main(String[] args) throws Exception{
>              Server server = new Server(8080);
>              ServletContextHandler servletContextHandler = new
> ServletContextHandler(server, "/context", true, false);
>              servletContextHandler.addServlet(HessianService.class,
> "/hessian-service");
>              server.start();
>              System.out.println("started");
>          }
>             
>     }
> 
> here is my client side:
> 
>     import com.caucho.hessian.client.HessianProxyFactory;
>     
>     public class HessianClient {
>         public static void main(String[] args) throws Exception {
>             String url = "http://localhost:8080/hessian-service";;
>             HessianProxyFactory factory = new HessianProxyFactory();
>             IHessianService basic = (IHessianService)
> factory.create(IHessianService.class, url);
>             basic.getAllContacts();
>             for (String arg : args) {
>                 System.out.println("arg = " + arg);
>             }
>     
>     
>         }
>     
>     
>     }
> 
> 
> Note that I don't really know Hessian, this is an experiment.  I'm
> following this tutorial, which was written against Jetty 6:
>  http://java.dzone.com/articles/hessian-web-service-protocol.
> 
> The result of this test is the sever starts, but the client fails on
> connect:  Caused by: java.io.FileNotFoundException:
> http://localhost:8080/hessian-service
> 
> I don't think that the servlet is being registered properly on the
> server side.  I see nothing in my browser at
> http://localhost:8080/hessian-service (although since it's a hessian
> service, I don't actually know what to expect).  Thanks
> 
> 
> thanks
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev



Back to the top