views:

75

answers:

1

I have one web app works perfectly under linux with jetty-6.1.22. However, when I tried to run it under windows, it throws an exception right at the initialization:

java.lang.IllegalArgumentException: name
        at sun.misc.URLClassPath$Loader.findResource(Unknown Source)
        at sun.misc.URLClassPath.findResource(Unknown Source)
        at java.net.URLClassLoader$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(Unknown Source)
        at org.mortbay.jetty.webapp.WebAppClassLoader.getResource(WebAppClassLoader.java:271)
        at org.mortbay.resource.Resource.newSystemResource(Resource.java:203)
        at org.mortbay.jetty.webapp.WebXmlConfiguration.configureDefaults(WebXmlConfiguration.java:159)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1230)

I checked into the source code of WebAppClassLoader.java, it looks like this:

String defaultsDescriptor=getWebAppContext().getDefaultsDescriptor();
if(defaultsDescriptor!=null&&defaultsDescriptor.length()>0)
{
    Resource dftResource=Resource.newSystemResource(defaultsDescriptor);
    if(dftResource==null)
  dftResource=Resource.newResource(defaultsDescriptor);
    configure(dftResource.getURL().toString());
    _defaultWelcomeFileList=_welcomeFiles!=null;
}

The exception happens on this line: Resource.dftResource=Resource.newSystemResource(defaultsDescriptor);.

But I do not understand. How come it works on Linux but not on windows?

A: 

It turns out. The only thing you have to do is to set the extract to "true".

<Call name="addLifeCycle">
  <Arg>
    <New class="org.mortbay.jetty.deployer.WebAppDeployer">
      ...
      <Set name="extract">true</Set> <-- here
      ...
    </New>
  </Arg>
</Call>

or

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
   ...
   <Set name="extractWAR">true</Set> <-- here
   ...
</Configure>
Winston Chen