LocationAwareLogger no such method exception at startup

1,960 views
Skip to first unread message

cam

unread,
Apr 14, 2011, 7:49:41 AM4/14/11
to red5
Hi,

I've downloaded the lastest red5 dist - 1.0.0-RC1 and installed on
osx. When i attempt to run from red5.sh i encounter the following
error:

Red5 Server 1.0.0 RC1 $Rev: 4193 $ (http://code.google.com/p/red5/)
Exception in thread "main" java.lang.reflect.InvocationTargetException
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:597)
at org.red5.server.Bootstrap.bootStrap(Bootstrap.java:118)
at org.red5.server.Bootstrap.main(Bootstrap.java:49)
Caused by: java.lang.NoSuchMethodError:
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/
String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at
org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:
159)
at
org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:
456)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:
394)
at org.red5.server.Launcher.launch(Launcher.java:64)
... 6 more


It would appear that this is caused by some classpath conflict with
slf4j however i have been unable to track down where the conflicted
might be coming from. I've tried putting the slf4j and logback
libraries at the start of the classpath, as recommended in other msgs,
but this doesn't seem to work:

export CLASSPATH=$RED5_HOME/lib/com.springsource.slf4j.api-1.6.1.jar:
$RED5_HOME/lib/logback-core-0.9.26.jar:$RED5_HOME/lib/logback-
classic-0.9.26.jar

Classpath is confirmed by echo in red5.sh:

echo "Classpath=$CLASSPATH"
echo "Red5 Classpath=$RED5_CLASSPATH"

Which outputs the following at startup:

Quadraplex:red5-1.0.0-RC1 cam$ ./red5.sh
Running on Darwin
Starting Red5
Classpath=./lib/com.springsource.slf4j.api-1.6.1.jar:./lib/logback-
core-0.9.26.jar:./lib/logback-classic-0.9.26.jar
Red5 Classpath=./boot.jar:./conf:./lib/
com.springsource.slf4j.api-1.6.1.jar:./lib/logback-core-0.9.26.jar:./
lib/logback-classic-0.9.26.jar


I've tried starting with no libraries and adding in as required but
hit the same error. I've also tried searching through the binaries for
references to LocationAwareLogger but can't find any. I've also tried
to decompile the jcl bridge and other slf4j libraries to find out
where this conflict might be coming from but to no avail.

I'm sure this must be a simple problem to fix but i can't seem to find
it!! Any help is most appreciated!

I also see someone is running into this problem from StackOverflow in
the last month:

http://stackoverflow.com/questions/5403525/whats-wrong-for-this-error

Thanks!
cam

Olivier Dellicour

unread,
Apr 14, 2011, 9:44:16 AM4/14/11
to red5in...@googlegroups.com
I had the same error yesterday and that was because I had jcl-over-slf4j-1.5.10.jar included in the classpath along with the jcl-over-slf4j-1.6.1.jar.
Did you copy some jars from an older red5 version (e.g 0.9) ?
--
Olivier Dellicour

cam

unread,
Apr 14, 2011, 9:50:16 AM4/14/11
to red5
This is what i find really strange! I can't find any references to any
other jar files!!!

The installation is completely new from the .tar.gz distribution.

I've grep-ed, find-ed...tried overriding the classpath...

It seems really strange because i find it hard to understand from a
clean install especially if others are installing and running this
build on osx?

thanks!
cam


On Apr 14, 2:44 pm, Olivier Dellicour <olivier.dellic...@gmail.com>
wrote:

cam

unread,
Apr 14, 2011, 11:45:10 AM4/14/11
to red5
I've tested the same distro on a Solaris VM and it starts up and runs
without error. This must either be a problem with running on OSX or on
my laptop.

Being unable to reinstall my laptop i can't rule out that this is only
a problem with my machine. Can anyone confirm they have the 1.0.0-RC1
binary running on OSX?

Thanks!
Cam

cam

unread,
Apr 14, 2011, 1:06:52 PM4/14/11
to red5
I've tracked down the classpath conflict to the OSX java distribution
which includes the slf4j api and log4j adapter under:

/Library/Java/Extensions

If you move/remove the slf4j-api-1.5.8.jar and slf4j-log4j12-1.5.8.jar
files from this location, red5 starts as expected.

These may have been added to extensions in java 1.6 as i used to run
red5 about a year ago without this problem. I would expect this to be
the same cause for problems seen in other apps when searching for
LocationAwareLogger.

Remove the files isn't an ideal solution however i'm not sure why they
are there or how to go about over-loading the classloader. These jars
are being loaded by the extension classloader which forms part of the
launcher's external classloader. Reading the slf4j documentation,
http://www.slf4j.org/nlog4j/TROUBLESHOOT.html -

"Upon receiving a class load request, the classloader usually
delegates it to the parent before attempting to service the request.
This allows the bootstrap and extension loaders to deliver any classes
that are part of the JDK or its extensions. Only after this delegation
fails will the classloader attempt to find the class itself. Note that
classloaders do not delegate requests to children. "

It would seem that the application classloader is delegating to the
extension classloader bring about this conflit. There would seem to be
no way to counter-act this other than waiting for slf4j to bring about
some backward compatibility, the jars being removed from osx java, or
the red5 bootstrap classloader might be able to override this behavior
directly.

Thanks,
Cam
Reply all
Reply to author
Forward
0 new messages