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
--
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
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
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();
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