Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » [SOLVED] java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper(Error while trying to add a MappingJacksonHttpMessageConverter to s spring MVC osgi webapp)
[SOLVED] java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634843] Sun, 24 October 2010 14:44 Go to next message
Frederic Esnault is currently offline Frederic EsnaultFriend
Messages: 10
Registered: October 2010
Junior Member
Hi all,

I'm facing a problem with an osgi webapp in Virgo (got same error in spring DM server).
I had a spring MVC webapp running withtout problem, serving jsp. I wanted to add ajax capabitlies so i created a controller with a service method annotated with @ResponseBody to write directly into the response.
I'm trying to return java beans to the client as json using MappingJacksonHttpMessageConverter.

The webbundle is correctly installed, but trying to hit the application fails with a server error :

root cause

java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>(MappingJacksonHttpMessageConverter.java:55)
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)


Here is my application definition. First the controller method :

@RequestMapping(value="/connect.do", method=RequestMethod.POST)
	public @ResponseBody ConnectionBean connect(@RequestParam String login, @RequestParam String password)    {
        return new ConnectionBean(); // No real work here, it's just to send back something to be converted as json
    }


Here's the pom part where i reference those needed jars :

                <dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>com.springsource.org.codehaus.jackson.mapper</artifactId>
			<version>1.4.3</version>
		</dependency>
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>com.springsource.org.codehaus.jackson</artifactId>
			<version>1.4.3</version>
		</dependency>


I started to declare them with the provided scope but removed it ton include them in the war's lib folder, but it didn't help.

The MANIFEST.MF part importing the needed dependencies:

I
mport-Bundle: com.springsource.org.codehaus.jackson.mapper;version="[1.4.3, 1.4.3]"
Import-Package: org.eclipse.virgo.web.dm;version="[2.0.0, 3.0.0)",
 javax.servlet;version="[2.5, 2.5]",javax.servlet.http;version="[2.5, 2.5]",
 javax.servlet.jsp.jstl.core;vers ion="[1.1.2,1.2.0)",org.phoenix.bundles.ssh.service;version="[1.0.0, 
 1.0.0]",org.phoenix.bundles.svn.service;version="[1.0.0, 1.0.0]",org.
 springframework.beans.factory.annotation;version="[3.0, 3.1)",org.spr
 ingframework.stereotype;version="[3.0, 3.1)",org.springframework.web.
 bind.annotation;version="[3.0, 3.1)",org.springframework.web.context;
 version="[3.0, 3.1)",org.springframework.web.servlet;version="[3.0, 3
 .1)",org.springframework.web.servlet.mvc.annotation;version="[3.0, 3.
 1)",org.springframework.web.servlet.view;version="[3.0, 3.1)"
Excluded-Imports: 
 org.springframework.test.*,
 org.junit.*


And then my webapp-servlet.xml definitiion :

        <context:component-scan base-package="myapp.controllers" />
	
	<mvc:annotation-driven/>

	<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>
	
	<bean id="messageAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <property name="messageConverters">
            <util:list>
 		<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
 		<!-- bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
 		<bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/>
                <bean class="org.springframework.http.converter.FormHttpMessageConverter"/-->
               <!-- Below the offending resource causing error while initializing spring context -->
               <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/>
            </util:list>
        </property>
    </bean>


I'm quite tuck on this, and would appreciate any input on this. Thanks !


[Updated on: Mon, 25 October 2010 11:25]

Report message to a moderator

Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634929 is a reply to message #634843] Mon, 25 October 2010 07:37 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
I cannot see any reason why the web app should not be able to load the ObjectMapper class if the MANIFEST.MF file is in the correct location in the web app (inside META-INF). So I am wondering if some other bundle is causing the error.

Were there more diagnostics around the root cause as it is not clear which bundle initiated the class load? For instance an ExtendedClassNotFoundException describes the KernelBundleClassLoader which initiated the class load.

[Updated on: Mon, 25 October 2010 07:38]

Report message to a moderator

Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634951 is a reply to message #634929] Mon, 25 October 2010 08:18 Go to previous messageGo to next message
Frederic Esnault is currently offline Frederic EsnaultFriend
Messages: 10
Registered: October 2010
Junior Member
Thanks for reply.
Basically the stacktrace shows the exception being raised while spring tries to instantiate the MappingJacksonHttpMessageConverter (typical spring context init exception). I had once the ExtendedClassNotFoundException you're talking about, when i removed the MessageConverter and declared another Jackons class (for content negotiating). But in the end the problematic class is always the same.

And my manifest is in the correct place : /src/main/webapp/META-INF. It is actually read, because the import bundle (or package) i added to import jackson packages are used (i can see the jackson packages in the imported packages, in the Virgo admin console for my webapp bundle. And it gives me the id of the bundle providing them.

I saw someone having the same problem with a regular webapp (non osgi) importing jackson core and mapper jars. Seems his problem was solved by adding jackson-mapper-asl jar, but it didn't help me when i added it to my webapp pom (included in the WEB-INF/lib dir) and no osgi bundle exists for it in Spring Enterprise Bundle Repository.

But the jar i reference contain the ObjectMapper class, and the package is imported so i really cannot see where is the problem.
Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634955 is a reply to message #634951] Mon, 25 October 2010 08:33 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
So it sounds like some Spring bundle initiates the class load. Please could you paste the full event log diagnostics here?

Spring Web, for instance, has an optional import of org.codehaus.jackson.map, so if Spring Web initiates the class load for ObjectMapper, then the class load will fail if the optional import has been dropped. One reason the optional import would be dropped is if the bundle exporting the package was not available when Virgo started.

Please make sure the bundle exporting the package is present in repository/usr and restart Virgo with -clean and see if this solves the problem.
Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634960 is a reply to message #634955] Mon, 25 October 2010 09:14 Go to previous messageGo to next message
Frederic Esnault is currently offline Frederic EsnaultFriend
Messages: 10
Registered: October 2010
Junior Member
Here is the full stack trace:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet tool threw exception
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	com.springsource.server.web.tomcat.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:37)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Thread.java:619)
root cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jacksonMessageConverter' defined in ServletContext resource [/WEB-INF/tool-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:946)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	javax.servlet.GenericServlet.init(GenericServlet.java:212)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	com.springsource.server.web.tomcat.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:37)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Thread.java:619)
root cause

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
	org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
	org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	javax.servlet.GenericServlet.init(GenericServlet.java:212)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	com.springsource.server.web.tomcat.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:37)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Thread.java:619)
root cause

java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>(MappingJacksonHttpMessageConverter.java:55)
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
	org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	javax.servlet.GenericServlet.init(GenericServlet.java:212)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	com.springsource.server.web.tomcat.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:37)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Thread.java:619)
root cause

com.springsource.kernel.osgi.framework.ExtendedClassNotFoundException: org.codehaus.jackson.map.ObjectMapper in KernelBundleClassLoader: [bundle=org.springframework.web_3.0.0.RELEASE]
	com.springsource.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:149)
	java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>(MappingJacksonHttpMessageConverter.java:55)
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
	org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	javax.servlet.GenericServlet.init(GenericServlet.java:212)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	com.springsource.server.web.tomcat.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:37)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Thread.java:619)
root cause

java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
	org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	com.springsource.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:145)
	java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>(MappingJacksonHttpMessageConverter.java:55)
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
	org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:938)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:890)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	javax.servlet.GenericServlet.init(GenericServlet.java:212)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	com.springsource.server.web.tomcat.ApplicationNameTrackingValve.invoke(ApplicationNameTrackingValve.java:37)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Thread.java:619)


I tried installing my webapp without jackson bundle installed in virgo, and it failed (as expected) :
[2010-10-25 10:39:27.325] fs-watcher                   <DE0003E> Install failed for bundle 'myapp.web.bundle' version '1.0.0'. 
[2010-10-25 10:39:27.328] fs-watcher                   <> com.springsource.kernel.deployer.core.DeploymentException: Unsatisfied dependency detected when expanding imports for [bundle 'myapp.web.bundle' version '1.0.0' in scope 'null']
Caused by: com.springsource.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'myapp.web.bundle' at version '1.0.0': Import-Bundle with symbolic name 'org.codehaus.jackson.map' in version range '[1.4.3, 1.4.3]' could not be satisfied


And if i install jackson in virgo, then deployment works :
[2010-10-25 10:40:44.399] fs-watcher                   <HD0001I> Hot deployer processing 'MODIFIED' event for file 'myapp-1.0.0-SNAPSHOT.war'. 
[2010-10-25 10:40:44.704] fs-watcher                   <DE0000I> Installing bundle 'myapp.web.bundle' version '1.0.0'. 
[2010-10-25 10:40:44.975] fs-watcher                   <DE0001I> Installed bundle 'myapp.web.bundle' version '1.0.0'. 
[2010-10-25 10:40:45.055] fs-watcher                   <DE0004I> Starting bundle 'myapp.web.bundle' version '1.0.0'. 
[2010-10-25 10:40:45.058] Thread-3                     <WE0000I> Starting web bundle 'myapp.web.bundle' version '1.0.0' with context path '/tool'. 
[2010-10-25 10:40:45.259] Thread-3                     <WE0001I> Started web bundle 'myapp.web.bundle' version '1.0.0' with context path '/tool'. 
[2010-10-25 10:40:45.262] start-signalling-3           <DE0005I> Started bundle 'myapp.web.bundle' version '1.0.0'. 


And in the console, when i go to see my bundle imported packages :
org.codehaus.jackson.map	[0.0.0, oo)	76 (com.springsource.org.codehaus.jackson.mapper - 1.4.3)	 resolution:=static
bundle-version=[1.4.3,1.4.3]
bundle-symbolic-name=com.springsource.org.codehaus.jackson.mapper
version=0.0.0



I tried to stop and restart the server with jackson bundles in the repository/usr directory (tried also in ext and pickup), using the command : ./startup.sh -clean
Keep getting the same error.

[Updated on: Mon, 25 October 2010 09:16]

Report message to a moderator

Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634962 is a reply to message #634960] Mon, 25 October 2010 09:19 Go to previous messageGo to next message
Frederic Esnault is currently offline Frederic EsnaultFriend
Messages: 10
Registered: October 2010
Junior Member
I didn't see in the log, in fact it was a good idea to try to put bunldes in the usr dir, as the error shows a userregion classloader error.

com.springsource.kernel.osgi.framework.ExtendedClassNotFoundException: org.codehaus.jackson.map.ObjectMapper in KernelBundleClassLoader: [bundle=org.springframework.web_3.0.0.RELEASE]
	com.springsource.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:149)
	java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>(MappingJacksonHttpMessageConverter.java:55)


But now that my jackson bundles are there, why am i keeping getting this error ?

Oh and another thing, i don't see jackson bundles appear in the server starting trace, but they seem to be here, as my webapp bundle is successfully installed and imports the packages from jackson bundles...

EDIT : FYI, i was using virgo at home and now i was on dmServer, byt in the meantime i installed virgo here and adapted my webapp to use eclipse packages. I put jackson, joda, and two other bundles in virgo repository/usr directory and started with -clean (even it was virgo first start here on this machine). Same error :

org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.codehaus.jackson.map.ObjectMapper in KernelBundleClassLoader: [bundle=org.springframework.web_3.0.0.RELEASE]
	org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
	java.lang.ClassLoader.loadClass(ClassLoader.java:248)

[Updated on: Mon, 25 October 2010 09:34]

Report message to a moderator

Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634997 is a reply to message #634962] Mon, 25 October 2010 11:24 Go to previous messageGo to next message
Frederic Esnault is currently offline Frederic EsnaultFriend
Messages: 10
Registered: October 2010
Junior Member
Ok i finally figured this out. Very Happy

Actually i should have done this a long time ago.
I tried to get some info through the osgi console. Went into the config/.....userregion.properties config file and uncommented the osgi.console=2401 line
Then i connected to it via telnet localhost 2401

The basic osgi commands didn't help a lot but virgo set of commands are quite useful. I used vsh bundle list to see my bundles and saw both org.springframework.web_3.0.0.RELEASE and my jackson 1.4.3 bundles.
But when i used vsh bundle examine on org.springframework.web_3.0.0.RELEASE, i didn't see jackson in the list of imported packages.

I decided then to unjar the org.springframework.web_3.0.0.RELEASE bundle and had a look at its MANIFEST.MF.
As expected (well as you said, Glyn), i found some jackson packages imports, with an optional resolution, but what shocked me (spent a lot of time on this...) was the version range....
it was expecting ranges in [1.0.0, 1.1.0)....and i was providing version 1.4.3.

Full of hope, i went to springsource enterprise bundle repository and downloaded the 1.0.0 version of both jackson core and jackson mapper, removed the 1.4.3 fron repository/usr, put the 1.0.0 in repository/usr and restarted.
Launched my webapp and....bingo ! It works ! (Well i have a 406 HTTP error now when trying to reach the ajax powered controller, but that's another story, the webb app has been launched Smile )

So thanks for your help Glyn, as your optional dependency advice helped me to look in the right direction.

EDIT: just for information. The 406 HTTP error "not acceptable" went away. If <mvc:annotation-config/> is in the servlet config file, and you use @ResponseBody expecing jackson mapper to convert your pojos into json format, then your client must send the request with the following header : "Accept: application/json"

Btw, no need to declare the jackson converter as i did in my first post. The <mvc:annotation-config/> is all it takes to allow jackson mapper to kick in when a json request is received.

[Updated on: Mon, 25 October 2010 12:31]

Report message to a moderator

Re: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper [message #634998 is a reply to message #634997] Mon, 25 October 2010 11:32 Go to previous message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Well done! Glad the problem is finally solved.
Previous Topic:Could Fragment bundles be used on Virgo?
Next Topic:Spring Web Services
Goto Forum:
  


Current Time: Fri Dec 27 05:49:24 GMT 2024

Powered by FUDForum. Page generated in 0.05958 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top