[groovy-user] MissingMethodException

8 views
Skip to first unread message

Eric Kolotyluk

unread,
Feb 11, 2008, 6:30:48 PM2/11/08
to us...@groovy.codehaus.org

I have the following line of code

 

            if (LOG.isTraceEnabled()) LOG.info("LOG.isTraceEnabled() = true")

 

Which results in the stack trace you see below. I’m using Apache log4j 1.2.15 which does have method isTraceEnabled() – in fact the Groovy plug-in for Eclipse found this and did the text completion for this. I’m perplexed – why is there a problem.

 

Help please.

 

Cheers, Eric

 

 

Exception in thread "Thread-26 Startup" groovy.lang.MissingMethodException: No signature of method: org.apache.log4j.Logger.isTraceEnabled() is applicable for argument types: () values: {}

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:169)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:195)

      at com.kodak.proofer.groovy.tools.ProoferViewerLauncher.match(ProoferViewerLauncher.groovy:47)

DEBUG 2008-02-11 15:24:22,675 [pool-1-thread-5] NetworkConduit - Connected to Controller TAGNORMTEST at 10.1.52.222:30207 from port 3411

      at com.kodak.proofer.groovy.tools.ProoferViewerLauncher.this$3$match(ProoferViewerLauncher.groovy)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)

      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:335)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)

      at com.kodak.proofer.groovy.tools.ViewerLauncher$_initialize_closure1.doCall(ViewerLauncher.groovy:98)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)

      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:250)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)

      at groovy.lang.Closure.call(Closure.java:292)

      at groovy.lang.Closure.call(Closure.java:305)

      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1041)

      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1018)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)

      at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)

      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)

      at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)

      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)

      at com.kodak.proofer.groovy.tools.ViewerLauncher.initialize(ViewerLauncher.groovy:96)

      at com.creo.proofer.service.ServiceRepository.addListener(ServiceRepository.java:101)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)

      at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)

      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)

      at com.kodak.proofer.groovy.tools.ViewerLauncher.postConstruct(ViewerLauncher.groovy:49)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)

      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)

      at com.kodak.proofer.groovy.tools.ProoferViewerLauncher.<init>(ProoferViewerLauncher.groovy:38)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

      at org.codehaus.groovy.runtime.MetaClassHelper.doConstructorInvoke(MetaClassHelper.java:528)

      at groovy.lang.MetaClassImpl.doConstructorInvoke(MetaClassImpl.java:2347)

      at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1244)

      at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1174)

      at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:805)

      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNewN(ScriptBytecodeAdapter.java:227)

      at Startup.run(Startup.groovy:48)

      at java.lang.Thread.run(Thread.java:595)

 

Eric Kolotyluk | Software Developer, Enterprise Solutions | Graphic Communications Group |
Kodak Graphics Communications Company,
Canada | 4225 Kincaid Street | Burnaby, BC V5G 4P5 | Canada |
+1.604.451.2700 x 6471 tel  |  +1.604.437.9891 fax  | +1.604.834.0129 mobile
www.graphics.kodak.com

 

image001.gif

Guillaume Laforge

unread,
Feb 12, 2008, 6:09:31 AM2/12/08
to us...@groovy.codehaus.org
How is LOG defined?

--
Guillaume Laforge
Groovy Project Manager
G2One, Inc. Vice-President Technology
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Eric Kolotyluk

unread,
Feb 12, 2008, 11:01:56 AM2/12/08
to us...@groovy.codehaus.org

private static final Logger LOG = Logger.getLogger(ProoferViewerLauncher.class)

 

What’s perplexing is that this code used to work. I recently upgraded from Groovy 1.1beta2 to Groovy 1.5.2, but my code was running fine after that too. Then I switched from jog4j 1.2.14 to 1.2.15 and the problem started. I tried switching back to 1.2.14 and the problem is still there. I even tried using jog4j 1.3alpha8 which I was using when I developed the code. I tried switching back to Groovy 1.1b2, but no luck.

 

Bottom line is I have not changed my Groovy code – it used to work just fine – been mucking with different versions of Groovy and log4j – now the Groovy code doesn’t work and I can’t get back to a working configuration.

 

Cheers, Eric

Guillaume Laforge

unread,
Feb 12, 2008, 11:04:50 AM2/12/08
to us...@groovy.codehaus.org
And you've recompiled your whole source code?

Eric Kolotyluk

unread,
Feb 12, 2008, 11:30:29 AM2/12/08
to us...@groovy.codehaus.org

Yes, I just did a clean in Eclipse and the same problem happens.

 

Note, I'm using the following Java code to invoke my Groovy code

 

GroovyClassLoader groovyClassLoader = new GroovyClassLoader(Main.class.getClassLoader());

Class groovyClass = groovyClassLoader.parseClass(startupFile);

Runnable runnable = (Runnable) groovyClass.newInstance();

Thread thread = new Thread(runnable);

thread.setName(thread.getName() + " Startup");

thread.start();

Eric Kolotyluk

unread,
Feb 13, 2008, 12:18:11 PM2/13/08
to us...@groovy.codehaus.org

Problem solved!

 

Thanks to someone on the log4j mailing list it got me thinking: I found an earlier release of log4j in my classpath. It seems when I upgraded to log4j 1.2.15 recently it got sent to the end of my classpath without me noticing that. The older log4j JAR is included from another project my main project is dependent on and was previously later in my classpath so there was no problem then.

 

What's curious is that even though the older JAR file came before the newer jar file in the classpath, the compiler was still able to find the right version which supports trace.

 

Phew! I thought I was going insane.

 

Cheers, Eric

 


Reply all
Reply to author
Forward
0 new messages