Karaf 4.1.1 and CXF 3.1.12

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Karaf 4.1.1 and CXF 3.1.12

jochenw
Hello,

the blueprint.core.compatibility bundle is no longer part of the aries blueprint feature in Karaf 4.1.1. When using CXF 3.1.12, I have received a class-not-found error for the MapMetaData class in org.apache.blueprint.core.reflect. After adding the compatibility bundle to the feature and restarting Karaf, it worked.

Is there another way to solve this?

Regards,
Jochen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jbonofre
Hi Jochen,

you just did feature:install cxf/3.1.12 on Karaf 4.1.1 ?

Let me try to reproduce and eventually create a Jira.

Regards
JB

On 07/18/2017 03:43 PM, jochenw wrote:

> Hello,
>
> the blueprint.core.compatibility bundle is no longer part of the aries
> blueprint feature in Karaf 4.1.1. When using CXF 3.1.12, I have received a
> class-not-found error for the MapMetaData class in
> org.apache.blueprint.core.reflect. After adding the compatibility bundle to
> the feature and restarting Karaf, it worked.
>
> Is there another way to solve this?
>
> Regards,
> Jochen
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-1-1-and-CXF-3-1-12-tp4051041.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jbonofre
In reply to this post by jochenw
I just tried, and even if I have a refresh when I install cxf feature, it
installs correctly.

The ClassNotFound happens in your service ?

Regards
JB

On 07/18/2017 03:43 PM, jochenw wrote:

> Hello,
>
> the blueprint.core.compatibility bundle is no longer part of the aries
> blueprint feature in Karaf 4.1.1. When using CXF 3.1.12, I have received a
> class-not-found error for the MapMetaData class in
> org.apache.blueprint.core.reflect. After adding the compatibility bundle to
> the feature and restarting Karaf, it worked.
>
> Is there another way to solve this?
>
> Regards,
> Jochen
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-1-1-and-CXF-3-1-12-tp4051041.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jbonofre
In reply to this post by jochenw
By the way, as an ugly workaround, you can define the MapMetaData class as
private package in your bundle.

Regards
JB

On 07/18/2017 03:43 PM, jochenw wrote:

> Hello,
>
> the blueprint.core.compatibility bundle is no longer part of the aries
> blueprint feature in Karaf 4.1.1. When using CXF 3.1.12, I have received a
> class-not-found error for the MapMetaData class in
> org.apache.blueprint.core.reflect. After adding the compatibility bundle to
> the feature and restarting Karaf, it worked.
>
> Is there another way to solve this?
>
> Regards,
> Jochen
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-1-1-and-CXF-3-1-12-tp4051041.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jochenw
Hi JB,

sounds easier to add the compatibility fragment bundle  - seems to work with blueprint.core 1.8. Below the exception I can see on startup before adding this. Installation of CXF works correctly, starting up the bundle using CXF fails. I assume the root cause is that the  cxf-rt-transports-http-jetty-3.1.12 bundle has org.apache.aries.blueprint.reflect;version="
 [1.0,2)" in its Import-Package section with resolution:=optional

As said, I have a workaround. But maybe there was a reason for not taking in the compabtibility bundle any longer in the 4.1 / 4.1.1 aries-blueprint feature.

Regards,
Jochen


2017-07-19T09:12:37,970 | ERROR | pool-3-thread-1  | BlueprintContainerImpl           | 151 - org.apache.aries.blueprint.core - 1.8.0 | Unable to start blueprint container for bundle XYZ
java.lang.NoClassDefFoundError: org/apache/aries/blueprint/reflect/MapMetadataImpl
        at org.apache.cxf.transport.http_jetty.blueprint.JettyServerEngineFactoryParser.parseEngineConnector(JettyServerEngineFactoryParser.java:110) ~[?:?]
        at org.apache.cxf.transport.http_jetty.blueprint.JettyServerEngineFactoryParser.parse(JettyServerEngineFactoryParser.java:86) ~[?:?]
        at org.apache.cxf.transport.http_jetty.blueprint.HTTPJettyTransportNamespaceHandler.parse(HTTPJettyTransportNamespaceHandler.java:71) ~[?:?]
        at org.apache.aries.blueprint.parser.Parser.parseCustomElement(Parser.java:1369) ~[?:?]
        at org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:427) ~[?:?]
        at org.apache.aries.blueprint.parser.Parser.populate(Parser.java:331) ~[?:?]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:350) ~[?:?]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:277) ~[?:?]
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300) ~[?:?]
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269) ~[?:?]
        at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265) ~[?:?]
        at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255) ~[?:?]
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) ~[?:?]
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) ~[?:?]
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) ~[?:?]
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) ~[?:?]
        at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) ~[?:?]
        at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179) ~[?:?]
        at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730) ~[?:?]
        at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485) ~[?:?]
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4562) ~[?:?]
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2229) ~[?:?]
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1281) ~[?:?]
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:890) ~[?:?]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1170) ~[?:?]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$0(FeaturesServiceImpl.java:1069) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.ClassNotFoundException: org.apache.aries.blueprint.reflect.MapMetadataImpl not found by org.apache.cxf.cxf-rt-transports-http-jetty [208]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
        ... 33 more
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jbonofre
Hi Jochen,

I guess your issue is in your bundle.

Can you share your code or provide a simple test case ?

Thanks,
Regards
JB

On 07/19/2017 09:23 AM, jochenw wrote:

> Hi JB,
>
> sounds easier to add the compatibility fragment bundle  - seems to work with
> blueprint.core 1.8. Below the exception I can see on startup before adding
> this. Installation of CXF works correctly, starting up the bundle using CXF
> fails. I assume the root cause is that the
> cxf-rt-transports-http-jetty-3.1.12 bundle has
> org.apache.aries.blueprint.reflect;version="
>   [1.0,2)" in its Import-Package section with resolution:=optional
>
> As said, I have a workaround. But maybe there was a reason for not taking in
> the compabtibility bundle any longer in the 4.1 / 4.1.1 aries-blueprint
> feature.
>
> Regards,
> Jochen
>
>
> 2017-07-19T09:12:37,970 | ERROR | pool-3-thread-1  | BlueprintContainerImpl
> | 151 - org.apache.aries.blueprint.core - 1.8.0 | Unable to start blueprint
> container for bundle XYZ
> java.lang.NoClassDefFoundError:
> org/apache/aries/blueprint/reflect/MapMetadataImpl
> at
> org.apache.cxf.transport.http_jetty.blueprint.JettyServerEngineFactoryParser.parseEngineConnector(JettyServerEngineFactoryParser.java:110)
> ~[?:?]
> at
> org.apache.cxf.transport.http_jetty.blueprint.JettyServerEngineFactoryParser.parse(JettyServerEngineFactoryParser.java:86)
> ~[?:?]
> at
> org.apache.cxf.transport.http_jetty.blueprint.HTTPJettyTransportNamespaceHandler.parse(HTTPJettyTransportNamespaceHandler.java:71)
> ~[?:?]
> at
> org.apache.aries.blueprint.parser.Parser.parseCustomElement(Parser.java:1369)
> ~[?:?]
> at org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:427)
> ~[?:?]
> at org.apache.aries.blueprint.parser.Parser.populate(Parser.java:331)
> ~[?:?]
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:350)
> ~[?:?]
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:277)
> ~[?:?]
> at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)
> ~[?:?]
> at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)
> ~[?:?]
> at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)
> ~[?:?]
> at
> org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)
> ~[?:?]
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
> ~[?:?]
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
> ~[?:?]
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
> ~[?:?]
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
> ~[?:?]
> at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
> ~[?:?]
> at
> org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)
> ~[?:?]
> at
> org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)
> ~[?:?]
> at
> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)
> ~[?:?]
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4562) ~[?:?]
> at org.apache.felix.framework.Felix.activateBundle(Felix.java:2229) ~[?:?]
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2144) ~[?:?]
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1281)
> ~[?:?]
> at
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:890)
> ~[?:?]
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1170)
> ~[?:?]
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$0(FeaturesServiceImpl.java:1069)
> ~[?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> [?:?]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> [?:?]
> at java.lang.Thread.run(Thread.java:748) [?:?]
> Caused by: java.lang.ClassNotFoundException:
> org.apache.aries.blueprint.reflect.MapMetadataImpl not found by
> org.apache.cxf.cxf-rt-transports-http-jetty [208]
> at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550)
> ~[?:?]
> at
> org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79)
> ~[?:?]
> at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958)
> ~[?:?]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
> ... 33 more
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-1-1-and-CXF-3-1-12-tp4051041p4051055.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jochenw
Hi,

I'll check. It's not exactly my bundle, so it will take some time to dig in.

Regards,
Jochen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Karaf 4.1.1 and CXF 3.1.12

jochenw
Hi,

how to reproduce: use a fresh KAraf 4.1.1 standard installation. Add the mvn:org.apache.cxf.karaf/apache-cxf/3.1.12/xml/features repo and the cxf feature to org.apache.karaf.feature.cfg and start Karaf.

Create a bundle (I named it org.test.cxftestbundle) with following blueprint file:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
        xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
        xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
        xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                                                http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
                                                http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
            http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
            http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">

        <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
                <property name="writeXsiType" value="false"/> 
        </bean>
       
        <jaxrs:server id="myRestServiceServ" address="<a href="http://localhost:9999&quot;">http://localhost:9999" depends-on="rest-config">
                <jaxrs:serviceBeans>
                     <ref component-id="myRestService"/>
                </jaxrs:serviceBeans>
                <jaxrs:providers>
                <ref component-id="jaxbProvider"/>
                </jaxrs:providers>
        </jaxrs:server>
     
        <bean id="myRestService" class="org.test.cxftestbundle.MyRestService">
        </bean>

        <httpj:engine-factory id="rest-config">
                <httpj:engine port="9999">
                </httpj:engine>
        </httpj:engine-factory>

</blueprint>

MyRestService can just be an empty class. Install the bundle and start it. It will lead to the exception mentioned above as long as the compatibility bundle is not installed. Please note that this simple example will also not start correctly with the compatibility bundle due to missing implementation of the rest service class, but it doesn't stumble over the class not found exception any longer.

Best Regards,
Jochen

P.S.: to make it fully work with the compatibility bundle, the MyRestService class can e.g. be

package org.test.cxftestbundle;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;

import org.json.JSONObject;

@Path("somepath")
public class MyRestService {

        @POST
        @Path("/somepost")
        @Produces(MediaType.APPLICATION_JSON)
        public String getSomething(@Context HttpHeaders headers) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("ObjectID", "4711");
                jsonObject.put("ObjectName", "First Object");
                return jsonObject.toString();
        }

}


But then you also have to install org.json/json in Karaf to meet the dependencies.
Loading...