> java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
It needs the asm library. Put kilim/libs/asm-all-2.2.3.jar in the
classpath.
Sent from my iPhone
> When I put it in the classpath it loses the current path in the class
> path...
>
> java -cp ../libs/:CLASSPATH kilim.tools.Weaver -d ../classes/
> kilim.examples.SimpleTask
You want to have the jar in the classpath.
java -cp ../libs/asm-all-2.2.3.jar ....
See the file test.sh.
> Question any thought about updating to use asm 3.3?
Any reason to update it, other than keeping with the times? asm3.3
adds a lot of code, but nothing that changes what I need from it.
--sriram.
but was just curious.
Sent from my iPhone
Shouldn't ./classes be in the classpath?
> A typical error:
> Exception in thread "main" java.lang.NoClassDefFoundError: API/Ba
> The real class it's looking for is OAPI.Bar (where OAPI is the library
> I've been referencing above). As you can see, it's truncating the
> first and last letters of the class name/path.
This is strange.
I can't imagine this to be a weaver error. But in case we run out of
more credible explanations, you can see which classes are being loaded
this way:
java -ea kilim.tools.DumpClass | perl -ne 'print $1, "\n" if (/(L[^ ]
+;)/);' | sort | uniq
>
>
> Is there some way I should reorganize my project or an alternative way
> to call it from the command-line? All of the weaving seems
> successful, but for whatever reason we can't get it to run.
>
No, there should be no special arrangement required.
--sriram.
oops. I forgot the argument to DumpClass. You can also egrep. I just
use perl reflexively.
java -ea kilim.tools.DumpClass classes/*.class | egrep -o 'L[^ ]+;' |
sort | uniq
See if the names have been mangled.
If so, don't !
No, not really. If there are multiple projects, there are multiple
output directories, so you would need to handle them independently
anyway.
> Ok, progress. You were right in assuming that public static void
> main() was marked Pausable, and that was because I had to do that in
> order to get rid of some pesky errors (main calls Pausable methods).
Well, since Pausable is a semantic construct, and main() doesn't
follow the same semantics. it is a bit more than a pesky compilation
error.
The whole idea of Pausable is that a method can _prematurely_ return
to its caller, and have the caller do the same. A non pausable method
such as main() is not geared to be told by its callee that it isn't
done yet: the implicit contract is that if the method returns, it has
finished its job.
To avoid this, call your pausable methods from within a task started
from main. main() can exit, but the program will not quit.
Alternatively, if you want to know when the task is finished, and have
main do other things subsequently, you can call join():
main()
Task t = new Mytask().start();
t.joinb(); // blocks thread until task t finish.
}
>
> However, while it works to a certain degree, anytime I use this
> interactive prompt to do something that references a class in the
> library project, it craps out with an error similar to last time:
>
> Exception in thread "main" java.lang.NoClassDefFoundError: API/Ba
>
.....
>
> Just to reiterate, the call I'm making via the terminal is:
> java -cp ./classes:./lib/asm-all-2.2.3.jar:./lib/kilim.jar:./lib/
> library.jar application.Main
>
Did you try the DumpClass one-liner I sent you? I'd like to know if
there is something like API/Ba referenced in the class files.
It'd be better if you could replicate this error with a much much
smaller example that mimics your project structure.
> From the root application directory, calling:
> java -ea kilim.tools.DumpClass classes/*.class | egrep -o 'L[^ ]+;' |
> sort | uniq
>
> -- or even --
>
> java -ea kilim.tools.DumpClass classes/*.class by itself
>
That's because kilim.jar is not in your classpath. Do one thing.
Instead of using the -cp flag, put all the jars and class directories
in the CLASSPATH environment.
I am now at a point where I will need to get Kilim up to asm 3.1 (at least)
What would be involved in getting that done?
I am trying to use hibernate and spring 3.1 in the same application
(different areas, but same classpath) as kilim and the asm causes
conflicts.
I guess I can try and create a separate classloader for compiling and
weaving - I already have the separate classloader, but because my
project is based on maven its going to be tricky to include both
versions of asm in the tar.gz produced by appassembler.
It would be far easier to just have one version of asm to have to deal with
Thanks
Jason