I try to extend java HttpServlet with Groovy class. All works fine until some
webapp jars are needed. In particular, WEB-INF/lib contains ANTLR3 runtime
jar, but Tomcat isn't happy (trace fragment is below).
Some tips and tricks?
Andrew
----------------------
java.lang.NoClassDefFoundError: antlr/RecognitionException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at
org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:131)
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:238)
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:217)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2380)
at
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:164)
at org.codehaus.groovy.runtime.Invoker.invokeConstructorOf(Invoker.java:125)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:95)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNewN(ScriptBytecodeAdapter.java:245)
...
---------------------------------------------------------------------
To unsubscribe from this list please visit:
WEB-INF/lib contains almost last (b893) groovy-all (with all jarjars)
snapshot.
Small addition. I have tried to use other external jar (javax.mail), a tried
class was found. So, it seems to be an ANTLR-related issue.
To be more talking - my Groovy extention od Java HttpServlet calls a chain of
other Groovy classes, at some point some of them calls java (also my) class,
and last one use ANTLR. I use compiled Groovy classes rather scripting.
there should be only one groovy-all jar and it would be best if you
remove all jars you don't really need.
> Small addition. I have tried to use other external jar (javax.mail), a tried
> class was found. So, it seems to be an ANTLR-related issue.
>
> To be more talking - my Groovy extention od Java HttpServlet calls a chain of
> other Groovy classes, at some point some of them calls java (also my) class,
> and last one use ANTLR. I use compiled Groovy classes rather scripting.
from the trace I see that you have a "new ..." in Groovy code and this
class needs ANTLR to load. SO far so good...
Does WEB-INF/lib contain only one antlr jar? If not remove all but one.
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/
This case takes place.
> from the trace I see that you have a "new ..." in Groovy code and this
> class needs ANTLR to load. SO far so good...
> Does WEB-INF/lib contain only one antlr jar? If not remove all but one.
# pwd
/wrk/usr/eclipse/projects/GS/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/xtestweb/WEB-INF/lib
# ls
activation-1.1.jar antlr-runtime-3.0.1.jar groovy-all-893.jar
mail-1.4.1.jar xlib.jar
Andrew
ok, I took a look ant the antlr runtime and... well there is no
antlr.RecognitionException, there is not even a antlr package. Instead
it is in org.antlr.rntime.RecognitionException
So I guess you compiled against an ANTLR before 3.0. 3.0 is no simple
update, it is a complete rework of ANTLR.
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/
---------------------------------------------------------------------
Jochen, thanks! Indeed, ANTLR2 was included (but not exported in Eclipse
meaning of export) to a lib-project, from which the web-project depends on.
ANTLR2 is needed to generate parsers from grammar files (which was done with
Groovy class also :-) ). After removing ANTLR2-related jars from the
lib-project dependencies all works fine.
Thanks again!
Andrew