This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is there a limit on nesting of requires?


I keep coming across unexpected "java.lang.NoClassDefFoundError" errors. I
think I've isolated it. The following code doesn't run:

In test.scm:
(begin
  (require "test1.scm")

  (define (mytest)
    (format #t "mytest before mytest1~%~!")
    (mytest1)
    (format #t "mytest after mytest1~%~!")))

In test1.scm:
(begin
  (require "test2.scm")

  (define (mytest1)
    (format #t "mytest1 before mytest2~%~!")
    (mytest2)
    (format #t "mytest1 after mytest2~%~!")))

In test2.scm:
(begin
  (require "test3.scm")

  (define (mytest2)
    (format #t "mytest2 before mytest3~%~!")
    (mytest3)
    (format #t "mytest2 after mytest3~%~!")))

In test3.scm:
(define (mytest3)
  (format #t "mytest3~%~!"))

When I load the file into the interpreter, I get:
#|kawa:1|# (load "test.scm")
java.lang.NoClassDefFoundError: Ltest3;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2259)
    at java.lang.Class.getDeclaredField(Class.java:1852)
    at gnu.expr.ModuleContext.findInstance(ModuleContext.java:74)
    at gnu.expr.ModuleContext.findInstance(ModuleContext.java:57)
    at gnu.expr.ModuleInfo.getInstance(ModuleInfo.java:241)
    at kawa.standard.require.find(require.java:105)
    at atInteractiveLevel$2.<clinit>(test.scm)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
    at 
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorF
actory.java:25)
    at 
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
    at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
    at java.lang.reflect.Field.get(Field.java:357)
    at gnu.expr.ModuleExp.evalModule1(ModuleExp.java:242)
    at gnu.expr.ModuleExp.evalModule(ModuleExp.java:174)
    at kawa.Shell.run(Shell.java:273)
    at kawa.standard.load.loadSource(load.java:115)
    at kawa.standard.load.apply(load.java:236)
    at kawa.standard.load.apply(load.java:179)
    at kawa.standard.load.apply2(load.java:154)
    at kawa.standard.load.apply1(load.java:145)
    at gnu.mapping.Procedure.apply(Procedure.java:112)
    at gnu.mapping.Procedure.apply(Procedure.java:95)
    at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
    at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:353)
    at gnu.expr.ModuleExp.evalModule(ModuleExp.java:177)
    at kawa.Shell.run(Shell.java:273)
    at kawa.Shell.run(Shell.java:184)
    at kawa.Shell.run(Shell.java:165)
    at kawa.repl.main(repl.java:887)
exception while initializing module test1
    at gnu.expr.ModuleContext.findInstance(ModuleContext.java:85)
    at gnu.expr.ModuleContext.findInstance(ModuleContext.java:57)
    at gnu.expr.ModuleInfo.getInstance(ModuleInfo.java:241)
    at kawa.standard.require.find(require.java:105)
    at atInteractiveLevel$2.<clinit>(test.scm)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
    at 
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorF
actory.java:25)
    at 
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
    at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
    at java.lang.reflect.Field.get(Field.java:357)
    at gnu.expr.ModuleExp.evalModule1(ModuleExp.java:242)
    at gnu.expr.ModuleExp.evalModule(ModuleExp.java:174)
    at kawa.Shell.run(Shell.java:273)
    at kawa.standard.load.loadSource(load.java:115)
    at kawa.standard.load.apply(load.java:236)
    at kawa.standard.load.apply(load.java:179)
    at kawa.standard.load.apply2(load.java:154)
    at kawa.standard.load.apply1(load.java:145)
    at gnu.mapping.Procedure.apply(Procedure.java:112)
    at gnu.mapping.Procedure.apply(Procedure.java:95)
    at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
    at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:353)
    at gnu.expr.ModuleExp.evalModule(ModuleExp.java:177)
    at kawa.Shell.run(Shell.java:273)
    at kawa.Shell.run(Shell.java:184)
    at kawa.Shell.run(Shell.java:165)
    at kawa.repl.main(repl.java:887)
Caused by: java.lang.NoClassDefFoundError: Ltest3;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2259)
    at java.lang.Class.getDeclaredField(Class.java:1852)
    at gnu.expr.ModuleContext.findInstance(ModuleContext.java:74)
    ... 27 more
#|kawa:2|# 


With one less level of nesting, ie. loading test1.scm into the interpreter,
its fine. Is there a limit on the nesting of requires? This is creating
problems for me as I have some real code with at least the same level of
nesting. 

Note that I'm running the latest build from svn.

Any suggestions or solutions would be greatly appreciated!

thanks,
Alex



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]