[kaffe] jBoss & Kaffe
Helmer Krämer
hkraemer@freenet.de
Wed May 14 05:51:02 2003
On Wed, 14 May 2003 05:32:42 -0700 (PDT)
Dalibor Topic <robilad@yahoo.com> wrote:
Hi Dalibor,
> --- Helmer Kr_mer <hkraemer@freenet.de> wrote:
> > 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).
>
> That's a very cool prospect. How long does it take to start up eclipse with
> your patch?
well, it doesn't start completely yet. The problem is that there
are some issues where I don't know who's right and who's wrong.
I.e. if you try something like new URL("file:/tmp").openStream(),
it works with sun's jdk, but doesn't with kaffe. To get on further,
I just hacked kaffe.net.www.protocol.file.FileURLConnection to
ignore directories, but I don't know whether that's the right way
of doing it.
Another interesting thing I found is that eclipse assumes that
System.mapLibraryName() returns a valid file name so that you
can test for existance of that library with something like
new File (System.mapLibraryName()).exists(). However, this also
doesn't work with kaffe (kaffe doesn't append ".so" to the file
name to let libtool try the various possible endings). However,
the api spec doesn't seem to imply that System.mapLibraryName
returns a valid file name. On the other hand, if it doesn't
return a complete file name, implementing ClassLoader.findNativeLibrary
would be impossible (if you can search through multiple directories,
how do you determine which of them contains the native lib?).
When I "fix" these, eclipse starts, finds all the plugins that
are installed, tries to load my preferences and crashes thereby.
The last time I looked at this, I had absolutely no clue why it
crashes (complains about not finding a method which is definitely
available). Will probably try fixing this one this weekend...
> I'm asking since Mark Wielaard has posted a challenge to get eclipse to load on
> a free software java virtual machine using free software only, in less then a
> minute [1]. There is even a real prize beyound eternal fame to be won ;)
Yeah, I know of the challenge. However, I need to get it up
and running first, before I can optimize it ;)
Greetings,
Helmer