Thread: [Sablevm-developer] Running jetty
Brought to you by:
egagnon
From: Laurent M. <la...@ao...> - 2004-05-19 14:59:43
|
I have a framework (http://jac.objectweb.org/) which uses Jetty to provide a web frontend for applications (via servlets). I almost have this running with sablevm but I have these exception: class org.mortbay.util.OutputStreamLogSink is not a org.mortbay.util.LogSink 1084973010357: EVENT ,Starting Jetty/4.2.x,[Main-1]org.mortbay.util.Log.event(Log.java:248) 1084973010512: EVENT ,Started HttpContext[/jac/resources],[Main-1]org.mortbay.util.Log.event(Log.java:248) 1084973010542: EVENT ,Started SocketListener on 0.0.0.0:8088,[Main-1]org.mortbay.util.Log.event(Log.java:248) 2004-05-19 13:23:30,554 ERROR gui.display: Failed to start webgui : org.mortbay.util.MultiException[java.lang.IllegalStateException: Servlet class org.objectweb.jac.aspects.gui.web.JacLocalServlet is not a javax.servlet.Servlet] 2004-05-19 13:23:30,562 ERROR gui.display: Check that another server is not running on port 8088 Our framework use a custom classloader, so my guess is that problems may arise from this in java.lang.Class.isAssignableFrom(). -- Laurent Martelli la...@ao... Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org |
From: Etienne G. <gag...@uq...> - 2004-05-21 16:02:56
|
Laurent Martelli wrote: > I have a framework (http://jac.objectweb.org/) which uses Jetty to > provide a web frontend for applications (via servlets). I almost have > this running with sablevm but I have these exception: >... > Our framework use a custom classloader, so my guess is that problems > may arise from this in java.lang.Class.isAssignableFrom(). Could you provide a small test case that fails, to help us identify the bug? Thanks, Etienne -- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |
From: Laurent M. <la...@ao...> - 2004-05-21 18:10:59
Attachments:
Servlet.java
JettyLog.java
|
I suspect it's classloader related because this small test is passed (it's a copy of the jetty code that triggers the above bug): |
From: Etienne G. <gag...@uq...> - 2004-05-21 19:52:18
|
Hmmm... Laurent Martelli wrote: > It's not really a small test case since it relies on Jetty, but it > triggers >... Somehow, the isAssignableFrom is called at a time when OutputStreamLogSink is not yet *prepared* (this is even before initialization!). As preparation is where the appropriate structures are created for doing constant-time instanceof checks, it explains why the check fails (as the data used for the check is invalid). So, some code lets a Class reference escape prior to preparation! This must be fixed... This will require some hunting. Feel free to help. To do so, reconfigure and recompile sablevm: $ cd sablevm-staging-... $ ./configure --enable-debugging-features # then any other option use previously used $ make clean $ make $ make install then, I recommend that you use ddd to debug sablevm: $ ddd path-to../bin/sablevm & [on Debian, you simply: $ apt-get install ddd ] Have fun! Etienne -- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |
From: Etienne G. <gag...@uq...> - 2004-05-21 21:38:19
|
OK. I found the bug. SableVM does depend on classes being prepared before you can use them in operations such as "instanceof". To this end, I have modified SableVM to be a little more eager in linking classes (this is *NOT* initialization, if you care about details such as Chapter 5 of the JVM spec.). The problem was that the System class loader (gnu.java.lang.SystemClassLoader) called java.lang.ClassLoader.defineClass() but not resolveClass(). I could have modified the System class loader to also call resolveClass, but this would have not been a robust fix. defineClass() documentation say: Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved. But, I think this can make a VM quite fragile. As the JVM spec allows for it, I have modified SableVM "link" the class in defineClass. I also made sure that no reference to java.lang.Class instances escape to java code before the related class is linked. This should make the VM more robust in face of weaker java code. Laurent, you can try the staging snapshot (staging+2298) in: http://www.info.uqam.ca/~egagnon/staging and report your findings. :-) Thanks a lot for the bug report! Etienne Etienne Gagnon wrote: > Hmmm... > > Laurent Martelli wrote: > >> It's not really a small test case since it relies on Jetty, but it >> triggers ... > > > Somehow, the isAssignableFrom is called at a time when OutputStreamLogSink > is not yet *prepared* (this is even before initialization!). As > preparation > is where the appropriate structures are created for doing constant-time > instanceof checks, it explains why the check fails (as the data used for > the check is invalid). > > So, some code lets a Class reference escape prior to preparation! This > must > be fixed... This will require some hunting. > > Feel free to help. To do so, reconfigure and recompile sablevm: > > $ cd sablevm-staging-... > $ ./configure --enable-debugging-features # then any other option use > previously used > $ make clean > $ make > $ make install > > then, I recommend that you use ddd to debug sablevm: > > $ ddd path-to../bin/sablevm & > > [on Debian, you simply: > $ apt-get install ddd > ] > > Have fun! > > Etienne > -- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |
From: Laurent M. <la...@ao...> - 2004-05-21 18:44:31
|
>>>>> "Laurent" == Laurent Martelli <la...@ao...> writes: [...] Laurent> I suspect it's classloader related because this small test Laurent> is passed Or maybe not. I've put some traces in Jetty and it turns that the class loader of both classes is gnu.java.lang.SystemClassLoader@14944. Anyway, the location of the problem in Jetty is org.mortbay..util.Log line 96. -- Laurent Martelli la...@ao... Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org |
From: Laurent M. <la...@ao...> - 2004-05-29 11:37:28
Attachments:
Servlet.java
|
Thanks for your help. -- Laurent Martelli la...@ao... Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org |