I am not able to make this work yet. Can some one suggest some thing what could be going wrong?
On Wed, May 11, 2016 at 9:51 PM, Debraj Manna <subharaj.ma...@gmail.com> wrote: > Hi Jean, > > I am facing a similiar problem when I tried to use Afterburner from my toy > application to an actual code base. In the same code base in one place it > is working perfectly fine and in one place it is failing with the error > java.lang.ClassNotFoundException: > com.fasterxml.jackson.module.afterburner.deser.BeanPropertyMutator.( I > have placed the full stack-trace towards the end of my email). The same > code base works perfectly fine when I run this as normal jar outside Karaf. I > have no issue in the MANIFEST.mf in the bundle. All the imports are > added:- > > Import-Package: com.fasterxml.jackson.core;resolut > ion:=optional;version="[2.7,3)",com.fasterxml.jackson.databind;resoluti > on:=optional;version="[2.7,3)",com.fasterxml.jackson.databind.annotatio > n;resolution:=optional;version="[2.7,3)",com.fasterxml.jackson.module.a > fterburner;resolution:=optional;version="[2.7,3)",org.json;reso > lution:=optional,org.osgi.service.blueprint;version="[1.0.0,2.0.0)";res > olution:=optional,com.fasterxml.jack > son.databind.ser;version="[2.7,3)",com.fasterxml.jackson.databind.deser > ;version="[2.7,3)",com.fasterxml.jackson.databind.ser.std;version="[2.7 > ,3)",com.fasterxml.jackson.databind.deser.std;version="[2.7,3)",com.fas > terxml.jackson.module.afterburner.ser;version="[2.7,3)",com.fasterxml.j > ackson.module.afterburner.deser;version="[2.7,3)" > > ... > > Even doing bundle:headers in Karaf I am seeing all the bundles correctly > imported > > karaf@root>bundle:headers 286 > > basecomponent (286) > ------------------- > Created-By = Apache Maven Bundle Plugin > Manifest-Version = 1.0 > Bnd-LastModified = 1462969467812 > Build-Jdk = 1.8.0_77 > Built-By = debraj > Tool = Bnd-3.0.0.201509101326 > > Bundle-Blueprint = > OSGI-INF/blueprint/authenticationBeans.xml,OSGI-INF/blueprint/awsBeans.xml,OSGI-INF/blueprint/blueprint.xml,OSGI-INF/blueprint/camelContext.xml,OSGI-INF/blueprint/catalogBeans.xml,OSGI-INF/blueprint/erpBeans.xml,OSGI-INF/blueprint/healthCheckBeans.xml,OSGI-INF/blueprint/orderBeans.xml,OSGI-INF/blueprint/productBeans.xml,OSGI-INF/blueprint/vendorBeans.xml > Bundle-ManifestVersion = 2 > Bundle-SymbolicName = basecomponent > Bundle-Version = 0.0.1 > Bundle-Name = basecomponent > > Require-Capability = > osgi.ee;filter:=(&(osgi.ee=JavaSE)(version=1.8)) > > > Import-Package = > com.fasterxml.jackson.annotation;resolution:=optional;version="[2.7,3)", > com.fasterxml.jackson.core;resolution:=optional;version="[2.7,3)", > com.fasterxml.jackson.databind;resolution:=optional;version="[2.7,3)", > > com.fasterxml.jackson.databind.annotation;resolution:=optional;version="[2.7,3)", > > com.fasterxml.jackson.module.afterburner;resolution:=optional;version="[2.7,3)", > com.fasterxml.jackson.databind.ser;version="[2.7,3)", > com.fasterxml.jackson.databind.deser;version="[2.7,3)", > com.fasterxml.jackson.databind.ser.std;version="[2.7,3)", > com.fasterxml.jackson.databind.deser.std;version="[2.7,3)", > com.fasterxml.jackson.module.afterburner.ser;version="[2.7,3)", > com.fasterxml.jackson.module.afterburner.deser;version="[2.7,3)" > > ... > > The full stack trace:- > > OrderException-GetOrdersHTTPFailure > com.fasterxml.jackson.databind.JsonMappingException: Failed to load class > 'org.apache.camel.Message$Access4JacksonDeserializer98898f0f': > com.fasterxml.jackson.module.afterburner.deser.BeanPropertyMutator > at [Source: {"data":{"total":2,"order":[], > "status":{"success":true}},"_metaData":{"urlParams":{}},"status":{"success":true,"errors":null,"httpStatusCode":200}}; > line: 1, column: 1] > at > com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:290)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:269)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:444)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:948)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:446)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:296)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:477)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:3908)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3803)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2797)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.jabong.orchestratorservice.basecomponent.http.JSONCamelHttpResponseHandler.marshallJSON(JSONCamelHttpResponseHandler.java:73)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.http.JSONCamelHttpResponseHandler.handleResponse(JSONCamelHttpResponseHandler.java:38)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.http.BaseCamelHTTPComponent.prepareResponse(BaseCamelHTTPComponent.java:133)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.http.BaseCamelHTTPComponent.call(BaseCamelHTTPComponent.java:88)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.node.HttpWFNode.executeRequest(HttpWFNode.java:130)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.node.HttpWFNode.executeWithRetry(HttpWFNode.java:118)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.node.HttpWFNode.executeWithRetry(HttpWFNode.java:49)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.node.HttpWFNode.execute(HttpWFNode.java:43)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.adapter.order.executor.GetOrdersWorkflowExecutor.execute(GetOrdersWorkflowExecutor.java:44)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.adapter.order.OrderHelper.getMarketplaceOrders(OrderHelper.java:53)[286:basecomponent:0.0.1] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_77] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_77] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_77] > at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_77] > at > org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:177)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:38)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.DelayProcessorSupport.process(DelayProcessorSupport.java:160)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:412)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:380)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:270)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:380)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.ProducerCache.send(ProducerCache.java:238)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:128)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:132)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:331)[136:org.apache.camel.camel-core:2.16.1] > at > com.jabong.orchestratorservice.basecomponent.processor.AbstractProcessor.makeRequest(AbstractProcessor.java:47)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.processor.JSONRPCProcessor.processRequest(JSONRPCProcessor.java:167)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.processor.JSONRPCProcessor.processRequestAndSendResponse(JSONRPCProcessor.java:132)[286:basecomponent:0.0.1] > at > com.jabong.orchestratorservice.basecomponent.processor.JSONRPCProcessor.process(JSONRPCProcessor.java:72)[286:basecomponent:0.0.1] > at > org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[136:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.jetty.CamelContinuationServlet.service(CamelContinuationServlet.java:170)[250:org.apache.camel.camel-jetty-common:2.16.1] > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:668)[45:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0.0] > at > org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.Server.handle(Server.java:370)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[50:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415] > at java.lang.Thread.run(Thread.java:745)[:1.8.0_77] > Caused by: java.lang.IllegalArgumentException: Failed to load class > 'org.apache.camel.Message$Access4JacksonDeserializer98898f0f': > com.fasterxml.jackson.module.afterburner.deser.BeanPropertyMutator > at > com.fasterxml.jackson.module.afterburner.util.MyClassLoader.loadAndResolve(MyClassLoader.java:100) > at > com.fasterxml.jackson.module.afterburner.deser.PropertyMutatorCollector.generateMutatorClass(PropertyMutatorCollector.java:204)[278:com.fasterxml.jackson.module.jackson-module-afterburner:2.7.4] > at > com.fasterxml.jackson.module.afterburner.deser.PropertyMutatorCollector.buildMutator(PropertyMutatorCollector.java:102)[278:com.fasterxml.jackson.module.jackson-module-afterburner:2.7.4] > at > com.fasterxml.jackson.module.afterburner.deser.DeserializerModifier.updateBuilder(DeserializerModifier.java:62)[278:com.fasterxml.jackson.module.jackson-module-afterburner:2.7.4] > at > com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:239)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:143)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:406)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:352)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > at > com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)[267:com.fasterxml.jackson.core.jackson-databind:2.7.4] > ... 86 more > Caused by: java.lang.ClassNotFoundException: > com.fasterxml.jackson.module.afterburner.deser.BeanPropertyMutator > at java.lang.ClassLoader.findClass(ClassLoader.java:530)[:1.8.0_77] > at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[:1.8.0_77] > at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_77] > at java.lang.ClassLoader.defineClass1(Native Method)[:1.8.0_77] > at java.lang.ClassLoader.defineClass(ClassLoader.java:763)[:1.8.0_77] > at java.lang.ClassLoader.defineClass(ClassLoader.java:642)[:1.8.0_77] > at > com.fasterxml.jackson.module.afterburner.util.MyClassLoader.loadAndResolve(MyClassLoader.java:94) > ... 94 more > > The code where it is working looks like something like below (and is > called first in the flow) > > public static WFRequest fromJSON(String json, String targetClassName) > throws ClassNotFoundException, IOException { > WFRequest reqParam = null; > ObjectMapper mapper = new ObjectMapper(); > mapper.registerModule(new AfterburnerModule()); > reqParam = (WFRequest) mapper.readValue(json, > Class.forName(targetClassName)); > return reqParam; > } > > The code where it is failing looks like below:- > > @SuppressWarnings("unchecked") > private static <T extends BaseCamelHTTPComponentResponse> T > fromJSON(final JSONObject jsonObj, > String serviceResponseClass) throws ClassNotFoundException, > IOException { > LOG.info("Response: {}, Marshalling it to an object of {}", > jsonObj.toString(), serviceResponseClass); > ObjectMapper objectMapper = new ObjectMapper(); > AfterburnerModule afterBurner = new AfterburnerModule(); > afterBurner.setUseOptimizedBeanDeserializer(false); > objectMapper.registerModule(afterBurner); > return (T) objectMapper.readValue(jsonObj.toString(), > Class.forName(serviceResponseClass)); > } > > > Can you help me what could be going wrong? > > On Sun, May 8, 2016 at 2:22 PM, Jean-Baptiste Onofré <j...@nanthrax.net> > wrote: > >> When you use *, maven-bundle-plugin/bnd is checking the actual import in >> your byte code. Here, you "really" import >> com.fasterxml.jackson.module.afterburner, but the ser package is not in >> your byte code, but transitively to the afterburner package. That's why >> it's not imported by the wildcard (because not directly used in your code). >> >> Regards >> JB >> >> On 05/08/2016 09:40 AM, Debraj Manna wrote: >> >>> Thanks Jean. Updating the import as below in pom.xml solved the issue:- >>> >>> >>> <Import-Package>com.fasterxml.jackson.module.afterburner.ser;resolution:=optional,*</Import-Package> >>> >>> >>> Can you please let me know even though I specified * in the >>> Import-Package why com.fasterxml.jackson.module.afterburner.serwas not >>> getting imported even though the top level >>> packagecom.fasterxml.jackson.module.afterburnerwas getting imported? >>> >>> >>> >>> >>> On Sun, May 8, 2016 at 12:55 PM, Jean-Baptiste Onofré <j...@nanthrax.net >>> <mailto:j...@nanthrax.net>> wrote: >>> >>> It's not a Karaf issue ;) >>> >>> As you can see in bundle:headers, the package >>> com.fasterxml.jackson.module.afterburner.ser is not imported, so not >>> in the classloader: that's the issue. >>> >>> Just add com.fasterxml.jackson.module.afterburner.ser in the >>> Import-Package. >>> >>> Regards >>> JB >>> >>> On 05/08/2016 09:21 AM, Debraj Manna wrote: >>> >>> I updated to the latest Jackson:- >>> >>> |karaf@root>bundle:list | grep jackson 124 | Active | 50 | >>> 2.6.2 | >>> jackson-databind 239 | Active | 80 | 2.7.4 | jackson-databind >>> karaf@root>bundle:list | grep Jackson 123 | Active | 50 | 2.6.2 >>> | >>> Jackson-core 125 | Active | 50 | 2.6.2 | Jackson-annotations 237 >>> | >>> Active | 80 | 2.7.4 | Jackson-core 238 | Active | 80 | 2.7.4 | >>> Jackson-annotations 240 | Active | 80 | 2.7.1 | >>> Jackson-module-Afterburner| >>> >>> The Hello World Bundle is active:- >>> >>> *karaf@root*>bundle:list | grep Hello >>> >>> 243 | Active | 80 | 0.0.1 | >>> HelloWorld >>> >>> >>> So bundle:headers is also showing correct wiring:- >>> >>> *karaf@root*>bundle:headers 243 >>> >>> >>> >>> Hello World (243) >>> >>> ----------------- >>> >>> Created-By = Apache Maven Bundle Plugin >>> >>> Manifest-Version = 1.0 >>> >>> Bnd-LastModified = 1462691114227 >>> >>> Build-Jdk = 1.8.0_77 >>> >>> Built-By = debraj >>> >>> Tool = Bnd-2.1.0.20130426-122213 >>> >>> >>> Bundle-ManifestVersion = 2 >>> >>> Bundle-SymbolicName = world >>> >>> Bundle-Version = 0.0.1 >>> >>> Bundle-Name = Hello World >>> >>> Bundle-Activator = com.hello.world.HelloWorldActivator >>> >>> >>> Export-Package = >>> >>> com.hello;version=0.0.1, >>> >>> com.hello.world;uses:=org.osgi.framework;version=0.0.1 >>> >>> Import-Package = >>> >>> >>> com.fasterxml.jackson.databind;resolution:=optional;version="[2.7,3)", >>> >>> com.fasterxml.jackson.module.afterburner; >>> >>> resolution:=optional; >>> >>> version="[2.7,3)", >>> >>> org.osgi.framework;resolution:=optional;version="[1.6,2)" >>> >>> >>> But now getting the below error. It seems Karaf is not able to >>> load >>> classes at run time. >>> >>> |com.fasterxml.jackson.databind.JsonMappingException: Failed to >>> load >>> class >>> >>> 'com.hello.world.JsonDataBlob$Access4JacksonDeserializerb9aaf44d': >>> >>> com.fasterxml.jackson.module.afterburner.ser.BeanPropertyAccessor at >>> >>> com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:312) >>> at >>> >>> com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1172) >>> at >>> >>> com.fasterxml.jackson.databind.SerializerProvider.findValueSerializer(SerializerProvider.java:490) >>> at >>> >>> com.fasterxml.jackson.databind.SerializerProvider.findTypedValueSerializer(SerializerProvider.java:688) >>> at >>> >>> com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:107) >>> at >>> >>> com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3631) >>> at >>> >>> com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:2998) >>> at >>> >>> com.hello.world.HelloWorldActivator.getJsonDataAsString(HelloWorldActivator.java:26) >>> at >>> >>> com.hello.world.HelloWorldActivator.start(HelloWorldActivator.java:13) >>> at >>> >>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645) >>> at >>> org.apache.felix.framework.Felix.activateBundle(Felix.java:2146) >>> at >>> org.apache.felix.framework.Felix.startBundle(Felix.java:2064) at >>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955) >>> at >>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942) >>> at >>> >>> org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:27) >>> at >>> >>> org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:53) >>> at >>> >>> org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:50) >>> at >>> >>> org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:41) >>> at >>> >>> org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33) >>> at >>> >>> org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39) >>> at >>> >>> org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33) >>> at Proxy836eebee_bd0c_424a_b0d9_7fc71158b4ca.execute(Unknown >>> Source) at >>> Proxy836eebee_bd0c_424a_b0d9_7fc71158b4ca.execute(Unknown >>> Source) at >>> >>> org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78) >>> at >>> >>> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480) >>> at >>> >>> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406) >>> at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) at >>> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182) >>> at >>> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119) >>> at >>> >>> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94) >>> at >>> >>> org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:210) >>> at >>> >>> org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1$1.run(LocalConsoleManager.java:109) >>> at java.security.AccessController.doPrivileged(Native Method) at >>> >>> org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:57) at >>> >>> org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1.run(LocalConsoleManager.java:102) >>> Caused by: java.lang.IllegalArgumentException: Failed to load >>> class >>> >>> 'com.hello.world.JsonDataBlob$Access4JacksonDeserializerb9aaf44d': >>> >>> com.fasterxml.jackson.module.afterburner.ser.BeanPropertyAccessor at >>> >>> com.fasterxml.jackson.module.afterburner.util.MyClassLoader.loadAndResolve(MyClassLoader.java:100) >>> at >>> >>> com.fasterxml.jackson.module.afterburner.ser.PropertyAccessorCollector.generateAccessorClass(PropertyAccessorCollector.java:171) >>> at >>> >>> com.fasterxml.jackson.module.afterburner.ser.PropertyAccessorCollector.findAccessor(PropertyAccessorCollector.java:97) >>> at >>> >>> com.fasterxml.jackson.module.afterburner.ser.SerializerModifier.changeProperties(SerializerModifier.java:63) >>> at >>> >>> com.fasterxml.jackson.databind.ser.BeanSerializerFactory.constructBeanSerializer(BeanSerializerFactory.java:401) >>> at >>> >>> com.fasterxml.jackson.databind.ser.BeanSerializerFactory.findBeanSerializer(BeanSerializerFactory.java:271) >>> at >>> >>> com.fasterxml.jackson.databind.ser.BeanSerializerFactory._createSerializer2(BeanSerializerFactory.java:223) >>> at >>> >>> com.fasterxml.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:157) >>> at >>> >>> com.fasterxml.jackson.databind.SerializerProvider._createUntypedSerializer(SerializerProvider.java:1215) >>> at >>> >>> com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1167) >>> ... 33 more Caused by: java.lang.ClassNotFoundException: >>> >>> com.fasterxml.jackson.module.afterburner.ser.BeanPropertyAccessor at >>> java.lang.ClassLoader.findClass(ClassLoader.java:530) at >>> java.lang.ClassLoader.loadClass(ClassLoader.java:424) at >>> java.lang.ClassLoader.loadClass(ClassLoader.java:357) at >>> java.lang.ClassLoader.defineClass1(Native Method) at >>> java.lang.ClassLoader.defineClass(ClassLoader.java:763) at >>> java.lang.ClassLoader.defineClass(ClassLoader.java:642) at >>> >>> com.fasterxml.jackson.module.afterburner.util.MyClassLoader.loadAndResolve(MyClassLoader.java:94) >>> ... 42 more| >>> >>> >>> On Sun, May 8, 2016 at 1:10 AM, Jean-Baptiste Onofré >>> <j...@nanthrax.net <mailto:j...@nanthrax.net> >>> <mailto:j...@nanthrax.net <mailto:j...@nanthrax.net>>> wrote: >>> >>> Can you check with bundle:headers if it's correctly wired ? >>> >>> Regards >>> JB >>> >>> On 05/07/2016 07:14 PM, Debraj Manna wrote: >>> >>> Below is the generated MANIFEST:- >>> >>> Manifest-Version: 1.0 >>> Bnd-LastModified: 1462615570323 >>> Build-Jdk: 1.8.0_77 >>> Built-By: debraj >>> Bundle-Activator: com.hello.world.HelloWorldActivator >>> Bundle-ManifestVersion: 2 >>> Bundle-Name: Hello World >>> Bundle-SymbolicName: world >>> Bundle-Version: 0.0.1 >>> Created-By: Apache Maven Bundle Plugin >>> Export-Package: >>> com.hello;version="0.0.1",com.hello.world;uses:="org.osg >>> i.framework";version="0.0.1" >>> Import-Package: >>> com.fasterxml.jackson.databind;resolution:=optional;vers >>> >>> >>> >>> ion="[2.6,3)",com.fasterxml.jackson.module.afterburner;resolution:=opti >>> >>> >>> >>> onal;version="[2.7,3)",org.osgi.framework;resolution:=optional;version= >>> "[1.6,2)" >>> Tool: Bnd-2.1.0.20130426-122213 >>> >>> >>> I have installed afterburner then only I installed my >>> Hello >>> World bundle. >>> >>> >>> >>> >>> On Sat, May 7, 2016 at 10:40 PM, Jean-Baptiste Onofré >>> <j...@nanthrax.net <mailto:j...@nanthrax.net> >>> <mailto:j...@nanthrax.net <mailto:j...@nanthrax.net>> >>> <mailto:j...@nanthrax.net <mailto:j...@nanthrax.net> >>> <mailto:j...@nanthrax.net <mailto:j...@nanthrax.net>>>> wrote: >>> >>> Hi, >>> >>> 1. Can you check that the generated MANIFEST >>> contains the >>> afterburner import ? >>> 2. If you install afterburner bundle after your >>> bundle, you >>> have to >>> refresh your bundle as it's an optional import >>> >>> Regards >>> JB >>> >>> >>> On 05/07/2016 05:27 PM, Debraj Manna wrote: >>> >>> Hi, >>> >>> I have a simple Hello World type Karaf Bundle. >>> The >>> activator >>> code looks >>> like below:- >>> >>> |public class HelloWorldActivator implements >>> BundleActivator { >>> @Override >>> public void start(BundleContext bundleContext) >>> throws >>> Exception { >>> System.out.println("STARTING DEMO: hello, >>> world\n"); >>> System.out.println(getJsonDataAsString()); } >>> @Override >>> public void >>> stop(BundleContext bundleContext) throws >>> Exception { >>> System.out.println("STOPPING DEMO"); } private >>> String >>> getJsonDataAsString() { JsonDataBlob >>> jsonDataBlob = new >>> JsonDataBlob(); >>> ObjectMapper objectMapper = new ObjectMapper(); >>> objectMapper.registerModule(new >>> AfterburnerModule()); >>> try { return >>> objectMapper.writeValueAsString(jsonDataBlob); >>> } >>> catch(Exception >>> e) { >>> e.printStackTrace(); } return ""; } } | >>> >>> |pom.xml| looks like below:- >>> >>> |<project >>> xmlns="http://maven.apache.org/POM/4.0.0" >>> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> >>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >>> http://maven.apache.org/xsd/maven-4.0.0.xsd"> >>> <modelVersion>4.0.0</modelVersion> >>> <groupId>com.hello</groupId> >>> <artifactId>world</artifactId> >>> <version>0.0.1</version> >>> <packaging>bundle</packaging> <name>Hello >>> World</name> >>> <dependencies> >>> <!-- OSGi --> <dependency> >>> <groupId>org.osgi</groupId> >>> <artifactId>org.osgi.core</artifactId> >>> <version>4.3.1</version> >>> </dependency> <dependency> >>> <groupId>org.osgi</groupId> >>> <artifactId>org.osgi.compendium</artifactId> >>> <version>4.3.1</version> >>> </dependency> <dependency> >>> <groupId>org.json</groupId> >>> <artifactId>json</artifactId> >>> <version>20160212</version> >>> </dependency> >>> <dependency> >>> <groupId>com.fasterxml.jackson.core</groupId> >>> <artifactId>jackson-core</artifactId> >>> <version>2.6.2</version> >>> </dependency> <dependency> >>> <groupId>com.fasterxml.jackson.core</groupId> >>> <artifactId>jackson-annotations</artifactId> >>> <version>2.6.2</version> >>> </dependency> <dependency> >>> <groupId>com.fasterxml.jackson.core</groupId> >>> <artifactId>jackson-databind</artifactId> >>> <version>2.6.2</version> >>> </dependency> <dependency> >>> <groupId>com.fasterxml.jackson.module</groupId> >>> >>> <artifactId>jackson-module-afterburner</artifactId> >>> <version>2.7.1</version> </dependency> >>> </dependencies> >>> <build> >>> <sourceDirectory>src</sourceDirectory> >>> <plugins> <plugin> >>> <artifactId>maven-compiler-plugin</artifactId> >>> <version>3.3</version> >>> <configuration> <source>1.8</source> >>> <target>1.8</target> <excludes> >>> <exclude>**/com/hello/main/*</exclude> >>> </excludes> >>> </configuration> >>> </plugin> <plugin> >>> <groupId>org.apache.felix</groupId> >>> <artifactId>maven-bundle-plugin</artifactId> >>> <version>2.4.0</version> >>> <inherited>true</inherited> >>> <extensions>true</extensions> >>> <configuration> <instructions> >>> >>> >>> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> >>> >>> <Bundle-Version>${project.version}</Bundle-Version> >>> >>> >>> >>> <Bundle-Activator>com.hello.world.HelloWorldActivator</Bundle-Activator> >>> >>> <Import-Package>*;resolution:=optional</Import-Package> >>> </instructions> >>> </configuration> </plugin> </plugins> </build> >>> </project> | >>> >>> The java object which I am trying to convert >>> to json is >>> a simple >>> object >>> as shown below:- >>> >>> |package com.hello.world; public class >>> JsonDataBlob { >>> private >>> String add1 >>> = "JP Naagar"; private String add2 = ""; >>> private int >>> shippartagent = 1; >>> public String getAdd1() { return add1; } >>> public void >>> setAdd1(String >>> add1) { this.add1 = add1; } public String >>> getAdd2() { >>> return add2; } >>> public void setAdd2(String add2) { this.add2 = >>> add2; } >>> public int >>> getShippartagent() { return shippartagent; } >>> public void >>> setShippartagent(int shippartagent) { >>> this.shippartagent = >>> shippartagent; } } | >>> >>> Whenever I am trying to install the bundle I >>> am getting >>> the below >>> exception:- >>> >>> |2016-05-07 15:36:48,986 | WARN | >>> x-6.1-2.0/deploy | >>> fileinstall >>> | 7 - >>> org.apache.felix.fileinstall - 3.5.0 | Error >>> while >>> starting bundle: >>> >>> >>> >>> file:/Users/debraj/Downloads/apache-servicemix-6.1-2.0/deploy/world-0.0.1.jar >>> org.osgi.framework.BundleException: Activator >>> start >>> error in bundle >>> world [239]. at >>> >>> >>> >>> org.apache.felix.framework.Felix.activateBundle(Felix.java:2196)[org.apache.felix.framework-4.2.1.jar:] >>> at >>> >>> >>> >>> org.apache.felix.framework.Felix.startBundle(Felix.java:2064)[org.apache.felix.framework-4.2.1.jar:] >>> at >>> >>> >>> >>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.2.1.jar:] >>> at >>> >>> >>> >>> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245)[7:org.apache.felix.fileinstall:3.5.0] >>> at >>> >>> >>> >>> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217)[7:org.apache.felix.fileinstall:3.5.0] >>> at >>> >>> >>> >>> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:509)[7:org.apache.felix.fileinstall:3.5.0] >>> at >>> >>> >>> >>> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)[7:org.apache.felix.fileinstall:3.5.0] >>> at >>> >>> >>> >>> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)[7:org.apache.felix.fileinstall:3.5.0] >>> Caused by: java.lang.NoClassDefFoundError: >>> >>> >>> com/fasterxml/jackson/module/afterburner/AfterburnerModule at >>> java.lang.Class.getDeclaredConstructors0(Native >>> Method)[:1.8.0_77] at >>> >>> >>> >>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)[:1.8.0_77] >>> at >>> >>> java.lang.Class.getConstructor0(Class.java:3075)[:1.8.0_77] at >>> >>> java.lang.Class.newInstance(Class.java:412)[:1.8.0_77] at >>> >>> >>> >>> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4336) >>> at >>> >>> >>> org.apache.felix.framework.Felix.activateBundle(Felix.java:2141) >>> ... >>> 7 more Caused by: >>> java.lang.ClassNotFoundException: >>> >>> >>> com.fasterxml.jackson.module.afterburner.AfterburnerModule not >>> found by >>> world [239] at >>> >>> >>> >>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)[org.apache.felix.framework-4.2.1.jar:] >>> at >>> >>> >>> >>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.2.1.jar:] >>> at >>> >>> >>> >>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) >>> at >>> >>> >>> java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_77] >>> ... >>> 13 more | >>> >>> All the required Jackson bundles are installed >>> in Karaf:- >>> >>> |karaf@root>bundle:list | grep Jackson 123 | >>> Active | >>> 50 | 2.6.2 | >>> Jackson-core 125 | Active | 50 | 2.6.2 | >>> Jackson-annotations 238 | >>> Installed | 80 | 2.7.1 | >>> Jackson-module-Afterburner >>> karaf@root>bundle:list | grep jackson 124 | >>> Active | 50 >>> | 2.6.2 | >>> jackson-databind | >>> >>> Everything works fine if I just comment out >>> the below >>> line:- >>> >>> |objectMapper.registerModule(new >>> AfterburnerModule()); | >>> >>> I have placed the required code in github >>> >>> <https://github.com/debraj-manna/afterburner-issue> >>> >>> Has anyone able to execute the Jackson's >>> Afterburner >>> module in >>> Karaf 3.0.5? >>> >>> Thanks, >>> >>> Debraj >>> >>> >>> -- >>> Jean-Baptiste Onofré >>> jbono...@apache.org <mailto:jbono...@apache.org> >>> <mailto:jbono...@apache.org <mailto:jbono...@apache.org>> >>> <mailto:jbono...@apache.org >>> <mailto:jbono...@apache.org> <mailto:jbono...@apache.org >>> <mailto:jbono...@apache.org>>> >>> http://blog.nanthrax.net >>> Talend - http://www.talend.com >>> >>> >>> >>> -- >>> Jean-Baptiste Onofré >>> jbono...@apache.org <mailto:jbono...@apache.org> >>> <mailto:jbono...@apache.org <mailto:jbono...@apache.org>> >>> http://blog.nanthrax.net >>> Talend - http://www.talend.com >>> >>> >>> >>> -- >>> Jean-Baptiste Onofré >>> jbono...@apache.org <mailto:jbono...@apache.org> >>> http://blog.nanthrax.net >>> Talend - http://www.talend.com >>> >>> >>> >> -- >> Jean-Baptiste Onofré >> jbono...@apache.org >> http://blog.nanthrax.net >> Talend - http://www.talend.com >> > >