NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper with Red5

ufk picture ufk · Jul 22, 2013 · Viewed 11.7k times · Source

I have a Red5 application. Since Red5 is based on Tomcat, Tomcat gurus can assist.

I have a class in my application that uses Spring Social and Spring Social Facebook version 1.1.0M3 that initialize stuff in order to prepare some real time statistics of purchases.

I have a bean configuration that initialize that class with parameters. When I start my Red5 and it tries to create my bean, I get the following error:

Error creating bean with name 'xpoFacebookPurchaseHandler' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:591)

How the bean is configured is irrelevant, so I didn't paste it here.

So I get NoClassDefFoundError on com/fasterxml/jackson/databind/ObjectMapper

Now I'm using maven so, whenever I add a package it makes sure that it adds all of it's dependencies and what not.

I have included Jackson Databind v. 2.2.2.

If I execute

strings jackson-databind-2.2.2.jar | grep -i ObjectMapper.class$com/fasterxml/jackson/databind/ObjectMapper.class

I do see that the class is there and that library is in the lib directory of my project. So what I can't figure out is why when I execute my project I still get NoClassDefFoundError.

Answer