Discussions

General J2EE: Jetty - mapping external disk to a URL

  1. Jetty - mapping external disk to a URL (1 messages)

    How to map URL to external folder on disk using Jetty configuration XMLs (jetty.xml or jetty-web.xml)? I want to access files in folder "C:/bar" at the url "http://localhost:8080/foo" so that the image "C:/bar/foobar.png" is accessible from "http://localhost:8080/foo/foobar.png" and so on. In Tomcat, I edited server.xml to add How can I accomplish this with Jetty? I am using jetty-6.1.15.rc3. I have put the following entry in my jetty-web.xml: <!--?xml version="1.0" encoding="ISO-8859-1"?--> site.com www.site.com jsp scratchdir C:/Raj keepgenerated true After putting this xml under WEB-INF directory I am getting the following exception: java.lang.ClassNotFoundException: org.mortbay.jetty.servlet.WebApplicationContext at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363) at org.mortbay.util.Loader.loadClass(Loader.java:91) at org.mortbay.xml.XmlConfiguration.nodeClass(XmlConfiguration.java:224) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:187) at org.mortbay.jetty.webapp.JettyWebXmlConfiguration.configureWebApp(JettyWebXmlConfiguration.java:103) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1236) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466) at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132) at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441) at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383) at org.mortbay.jetty.plugin.Jetty6RunWar.execute(Jetty6RunWar.java:67) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371 ) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137) at org.apache.maven.cli.MavenCli.main(MavenCli.java:356) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) 2009-08-24 13:45:27.531::INFO: Started SelectChannelConnector@0.0.0.0:8080 [INFO] Started Jetty Server Can anybody please let me know the example/exact entry that need to be put into either jetty.xml or jetty-web.xml? I am working on this for last two days but having no success. Any kind of help is appreciated. Thanks, Rajkumar

    Threaded Messages (1)

  2. You can't do that in jetty[ Go to top ]

    I don't think jetty has that feature. On windows 7, use mklink and on *nix, use ln command.