From: fawzi b. <zi...@ya...> - 2005-07-01 02:36:20
|
Hi, Thanks for you reply Wolfgang . It was the good direction. The getRealPath() returned null. The javadoc for ServletContext's getRealPath() method explicitly says : "... This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive)." So, we must extract the war file before calling getRealPath().This is simply done by calling the method setExtractWAR(true). Now the new working code is : Server jserver = new Server(); // Jetty Server jserver.addListener(":80"); WebApplicationContext webAppCtx = jserver.addWebApplication("/exist", "/somepath/exist.war"); webAppCtx.setExtractWAR(true); // if set to false, getRealPath will return null ! jserver.start(); Again, danke :-) Fawzi Benzemam ------------------------------------- Hi, the EXistServlet fails to determine the correct location for exist.home. Normally, this setting is read from the servlet parameter "basedir" as a relative path, which is then passed to config.getServletContext().getRealPath(); This seems to return null in your case, but I don"t know why. You probably have to test a bit and tweak line 98 of src/org/exist/http/servlets/EXistServlet.java to get it right. Please report if you manage to find a workaround. Wolfgang > I want to embed Jetty (5.1.4) in my app and deploy eXist (1.0b2-build-1107) > progammatically. > The code below doesn"t work. Sure I"m missing something :"-( > Can someone Help me ? > Thanks > > The code is : > //... > Server jserver = new Server(); // Jetty Server > jserver.addListener(":80"); > jserver.addWebApplication("/", > "c:\\projets\\fcol\\src\\exist.war"); > jserver.start(); > //... > > > The ouput is : > > Parse catalog: catalog > Loading catalog: catalog > Default BASE: file:C:/projets/fcol/catalog > Catalog does not exist: file:C:/projets/fcol/catalog > Exception in thread "main" > org.mortbay.util.MultiException[java.lang.NullPointerException] > at > org.mortbay.http.HttpServer.doStart(HttpServer.java:731) > at org.mortbay.util.Container.start(Container.java:72) > at Main.main(Main.java:29) > java.lang.NullPointerException > at java.util.Hashtable.put(Hashtable.java:396) > at > java.util.Properties.setProperty(Properties.java:128) > at java.lang.System.setProperty(System.java:700) > at > org.exist.http.servlets.EXistServlet.init(EXistServlet.java:87) > at > org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:383) > at > org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:243) > at > org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:445) > at > org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:323) > at > org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:511) > at org.mortbay.util.Container.start(Container.java:72) > at > org.mortbay.http.HttpServer.doStart(HttpServer.java:753) > at org.mortbay.util.Container.start(Container.java:72) > at Main.main(Main.java:29) ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com |