[kaffe] jBoss & Kaffe

Helmer Krämer hkraemer@freenet.de
Wed May 14 05:03:01 2003


On Wed, 14 May 2003 13:43:27 +0200
Ronald Aigner <ra3@os.inf.tu-dresden.de> wrote:

Hi Ronald,

> On Wednesday 14 May 2003 09:53, Dalibor Topic wrote:
> > argh, I wasn't finished with the code ...
> > in libraries/javalib/java/lang/Class.java:
> >
> >  public ClassLoader getClassLoader() {
> >          ClassLoader loader = getClassLoader0();
> >
> >          if (loader == null) {
> >                 loader = ClassLoader.getSystemClassLoader();
> >          }
> >
> >          return loader;
> >  }
> Tried this. Now jBoss exits in the line "String path = loc.getFile();", which 
> means that there is no URL for the code-source, which in turn means that it 
> should be set. This is only done by the URLClassLoader. Does JDK specify, 
> whether this has to be done by the other ClassLoaders as well?
> 
>    /**
>     * Boot up JBoss.
>     *
>     * @param args   The command line arguments.
>     *
>     * @throws Exception    Failed to boot.
>     */
>    public void boot(final String[] args) throws Exception
>    {
>       // Auto set HOME_DIR to ../bin/run.jar if not set
>       String homeDir = System.getProperty(ServerConfig.HOME_DIR);
>       if (homeDir == null)
>       {
>         ProtectionDomain pd = Main.class.getProtectionDomain();
>         CodeSource cs = pd.getCodeSource();
>         URL loc = cs.getLocation();
>          String path = loc.getFile();
>          /* The 1.4 JDK munges the code source file with URL encoding so run
>           * this path through the decoder so that is JBoss starts in a path 
> with
>           * spaces we don't come crashing down.
>          */
>          path = java.net.URLDecoder.decode(path);
>          File file = new File(path).getParentFile().getParentFile();
>          homeDir = file.getCanonicalPath();
>       }
>       props.setProperty(ServerConfig.HOME_DIR, homeDir);
> <code continues>

i'll commit a patch later this week, which will fix this
issue (that is, I hope so, since eclipse does something
similar and is starting w/o problems with my patch).

Grüsse,
Helmer