开发者

Has anyone seen jetty got initialized successfully under linux but throws exceptions under windows?

开发者 https://www.devze.com 2022-12-27 01:20 出处:网络
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:

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(df开发者_开发技巧tResource.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?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消