Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 26th, 2012  |  syntax: None  |  size: 1.30 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Following Jersey Tutorial
  2. public class Main {
  3.  
  4.     public static void main(String [] args) throws IOException {
  5.         final String baseUri = "http://localhost:9998";
  6.         final Map<String, String > initParams = new HashMap<String, String>();
  7.  
  8.  
  9.         initParams.put("com.sun.jersey.config.property.packages", "com.sun.ws.rest.samples.helloworld.resources");
  10.  
  11.         System.out.println("Starting grizzly");
  12.         SelectorThread threadSelector = GrizzlyWebContainerFactory.create(baseUri,initParams);
  13.  
  14.         System.out.println(String.format("Jersey app started with WADL available at %sapplication.wadl Try out %shelloworld. Hit enter to stop it...", baseUri, baseUri));
  15.  
  16.         System.in.read();
  17.         threadSelector.stopEndpoint();
  18.         System.exit(0);
  19.     }
  20. }
  21.        
  22. Exception in thread "main" java.lang.IllegalArgumentException: The URI path, of the URI http://localhost:9998, must be present
  23. at com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory.create(GrizzlyWebContainerFactory.java:236)
  24. at com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory.create(GrizzlyWebContainerFactory.java:138)
  25. at com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory.create(GrizzlyWebContainerFactory.java:105)
  26. at Main.main(Main.java:29)
  27.        
  28. final String baseUri = "http://localhost:9998/";