From dev-return-3887-apmail-plc4x-dev-archive=plc4x.apache.org@plc4x.apache.org Wed May 6 11:48:17 2020 Return-Path: X-Original-To: apmail-plc4x-dev-archive@minotaur.apache.org Delivered-To: apmail-plc4x-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id F0012197E6 for ; Wed, 6 May 2020 11:48:16 +0000 (UTC) Received: (qmail 27600 invoked by uid 500); 6 May 2020 11:48:16 -0000 Delivered-To: apmail-plc4x-dev-archive@plc4x.apache.org Received: (qmail 27571 invoked by uid 500); 6 May 2020 11:48:16 -0000 Mailing-List: contact dev-help@plc4x.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@plc4x.apache.org Delivered-To: mailing list dev@plc4x.apache.org Received: (qmail 27558 invoked by uid 99); 6 May 2020 11:48:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2020 11:48:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 14ED41A32D6 for ; Wed, 6 May 2020 11:48:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.461 X-Spam-Level: X-Spam-Status: No, score=0.461 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.2, KAM_DMARC_STATUS=0.01, KAM_SHORT=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-he-de.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id O6c2eQVepfuH for ; Wed, 6 May 2020 11:48:10 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.66; helo=mail-io1-f66.google.com; envelope-from=hedhman@gmail.com; receiver= Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id D7EE37DD54 for ; Wed, 6 May 2020 11:48:09 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id c2so1761544iow.7 for ; Wed, 06 May 2020 04:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=BqTOckaoJkSJH0W75I7OB6RdcOG91t7uQNMWcYMmPfQ=; b=CPdhLKxJIq3YX9J6BS1fe4Oegd8BKEVA2umTkWbdGjEcBMB1DJL7xC3SnkKmQ4zMDH AM+vyvA0T/two0Qz+C31SFdl+MAA9QVS9Lcde2epKCd/7CiJO+AMClDKrmvV/8Alq6XG E9VIgECXr7n22DCemxg9iMMEU8Skx5XLU3UyxIVFm2KwBCOVDhM/wpIKbU7xLFJL+hlP 4bF3V/IwUU4P6cHvcNQ7RW5oL2LPvWCU2zyKy2b3OZS67o0mYqSgO1oNyZG4hBqv7k+f PX4/B0R2D6Z8ditiZ3rfnm+AZzC74tAWsFwzDqLY8HqGZPEqVuuBvDGcskQUkVOYhc9p xD2w== X-Gm-Message-State: AGi0Pua8fDnjNBOwgMrm+LJdHrYzp28hHmt7eRKrloHAoTJEzmYW4W/j T4zPaDpvxn1RvCwD9ZM5qmIDtjImW1r4xfvSz7UFA8pKbSZgDA== X-Google-Smtp-Source: APiQypKrk/q2i7Mq4Gg8GW8Ks+qSCKz9lG7erd0oH1uDiH6XPQ5FqWZoA629mfBTkabUjmXOFNP+senWn6EvYsfKvr0= X-Received: by 2002:a05:6602:26d5:: with SMTP id g21mr7704044ioo.91.1588765682825; Wed, 06 May 2020 04:48:02 -0700 (PDT) MIME-Version: 1.0 References: <1654492C-E920-4FDE-BADA-400D3AC0EA1A@c-ware.de> <0C0E85B0-88C7-4F32-BC5A-8A647610F79C@pragmaticminds.de> In-Reply-To: From: Niclas Hedhman Date: Wed, 6 May 2020 19:47:50 +0800 Message-ID: Subject: Re: SPI Module - OSGi Bundle To: dev@plc4x.apache.org Content-Type: multipart/alternative; boundary="00000000000027feaf05a4f9563a" --00000000000027feaf05a4f9563a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable My suggestion was; 1. Don't do the BundleTracker classes, and instead change to a bundle activator for each. 2. Add the "Bundle-Activator: org.apache.plc4x.java.osgi.DriverActivator" to the driver META/MANIFEST.MF 3. Do the equivalent for the Transports. public class DriverActivator implements BundleActivator { private ServiceRegistration reg; @Override public void start( BundleContext context ) throws Exception { Hashtable props =3D new Hashtable<>(); props.put( OsgiDriverManager.PROTOCOL_CODE, driver.getProtocolCode(= ) ); props.put( OsgiDriverManager.PROTOCOL_NAME, driver.getProtocolName(= ) ); reg =3D context.registerService( PlcDriver.class, driver, props ); } @Override public void stop( BundleContext context ) { context.unregisterService( reg ); } } On Wed, May 6, 2020 at 2:33 PM Etienne Robinet wrote: > Hi all, > So concretely what changes should be done so that a Driver/Transport > declares itself his service? Beside the changes in the manifest? > Etienne > On 2020/05/06 01:26:42, Niclas Hedhman wrote: > > =C5=81ukasz, > > > > the reason I say it is not very OSGi-y, is that the principle of OSGi i= s > > that the bundle handles its own service registrations. In the case of > JDBC > > (I initiated that spec, and I am the founder of OPS4J as well as Pax > > subproject, 2005), it needed to address the problem that JDBC drivers > > existed and changing their build and/or manifests was decided to be "no= t > > viable". The approach there is a work-around for legacy code, which I a= nd > > Stuart McCulloch basically invented. IIRC, this happened in 2007. > > > > I didn't suggest that bundles require Declarative Services. I suggested > > that the "inside of the loop" in Etienne's code is put into an Activato= r, > > the code residing in the API and SPI bundles respectively, and that eac= h > > driver/transport has a "Bundle-Activator: ....." in the manifest > > referencing respective activator. It is not more intrusive than the > > Export-Package, Import-Package that will be required anyway. > > > > Advantages; It is more in the spirit of OSGi. But importantly, the > > driver/transport is now an active bundle, rather than a library bundle, > and > > in theory the start/stop of a bundle could (there might be other reason= s > > why not) turn it on/off in runtime. If special needs pop up, maybe to > > deploy for the OpenHAB project, it is possible to override the > > driver/transport with hacking the API/SPI bundles. > > > > And I can't see any disadvantages other than "need to rework a bit of > code". > > > > But I don't have skin in the game. Not in OSGi, not here, so take my > > recommendations into consideration or throw them away. I just got the > > impression that you didn't really get what I suggested. > > > > > > // Niclas > > > > > > > > On Wed, May 6, 2020 at 4:57 AM =C5=81ukasz Dywicki > wrote: > > > > > Hey Etienne, that's awesome piece of work. I can test it! :-) > > > > > > I believe that's what Etienne code does it in a valid OSGi way. And I > do > > > believe not because he mentioned me by name, but due to below > > > argumentation. > > > > > > Proposed code uses extender pattern to grab specific META-INF/service= s > > > entries and register them in OSGi service registry. If you will take = a > > > look on following line: > > > > > > > https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java= /org/apache/plc4x/java/osgi/ApiActivator.java#L63 > > > you will find that bundle is an jar which changes state to ACTIVE. > > > Additionally that bundle classloader is used to find services and tha= t > > > bundle context is used to register services. In the end service which > > > appears looks like one registered by driver/transport module. > > > > > > The main point for above implementation is basic - getting the standa= rd > > > PLC4X driver JAR working in OSGi without forcing it to knowing too mu= ch > > > about OSGi. Driver needs to ship manifest with import/export statemen= ts > > > and that's it. Additionally driver does not have to have a XML > > > descriptor which registers service. Quite many third parties might be > > > supplying drivers without any or with limited knowledge of OSGi. > > > Do drivers have to be a service? Well, it they can still be a valid > OSGi > > > service, registered using any other way! OSGi aware driver manager us= es > > > OSGi services instead of static list own classloader to find > > > META-INF/services entries: > > > > > > > https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java= /org/apache/plc4x/java/osgi/OsgiDriverManager.java#L62 > > > > > > JDBC JARs are handled in such a way already in pax-jdbc. Take a look > here: > > > > > > > https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc/src/main= /java/org/ops4j/pax/jdbc/impl/Activator.java#L72 > > > Same or very similar code can be found in apache-camel, which brought > > > hundreds of components to OSGi, so I believe their way can be seen as > > > high level guide. > > > What Etienne did is a pattern implementation. > > > > > > With regard to capabilities/requirements - this is a resolver puzzle. > It > > > relies on additional information. As an unbaptized, non-religious osg= i > > > guy (I take it as a tool and not act of faith), I often do skip it. I > do > > > find it useful, however quite often problematic and hard to understan= d > > > (yet another non-trivial syntax in manifest to follow). On older > > > runtimes capabilities are not even considered. For never ones there a= re > > > already existing namespaces: > > > https://www.osgi.org/capability-namespaces-reference/ > > > including, one for services: > > > > https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.namespaces.ht= ml > > > My point is that capabilities are used to attest that runtime will > > > consist all necessary things in place after provisioning operation. I= t > > > does not say HOW given capabilities should be made, cause resolver is > > > hit before bundle gets active. It is a safety check. I'm fine with > > > having one, however we need to make it right to do not narrow use of > > > driver bundles only with our own extender. > > > > > > Beside the point, I am not sure if plc4x-api is a best place for osgi > > > specific logic. That is a standard dilema to address in how we want t= o > > > treat osgi and non-osgi users. :-) > > > > > > Cheers! > > > =C5=81ukasz > > > > > > On 05.05.2020 12:34, Julian Feinauer wrote: > > > > Hi Etienne and Niclas, > > > > > > > > indeed we could orient (again) on how JDBC does that in OSGi. > > > > They really focus on "late binding" so that you resolve the driver > > > directly when you need it. > > > > In theory, there is no such thing as a DriverManager in OSGi but > only a > > > PlcDriver with the capability ("plc4x-protocol": "s7") or something. > > > > > > > > I did it witht he driver maanger mostly fort he ease as first > approach. > > > > > > > > Julian > > > > > > > > =EF=BB=BFAm 05.05.20, 12:30 schrieb "Niclas Hedhman" : > > > > > > > > Also, just in case, a custom activator is ever required, it can > be > > > > overridden easily without breaking the over all design > > > > > > > > On Tue, May 5, 2020 at 6:27 PM Niclas Hedhman < > niclas@hedhman.org> > > > wrote: > > > > > > > > > Yes, that's what I mean, because that is what you have inside > the > > > loop, so > > > > > it should work. > > > > > > > > > > On Tue, May 5, 2020 at 11:50 AM Robinet, Etienne < > > > 43823@etu.he2b.be> > > > > > wrote: > > > > > > > > > >> Hi Niclas, > > > > >> thanks for the feedback. So you mean to make the Activator i= n > > > API/SPI > > > > >> generic so every Driver would call it and declare the servic= e > > > itself? > > > > >> > > > > >> Le mar. 5 mai 2020 =C3=A0 05:25, Niclas Hedhman < > niclas@hedhman.org> > > > a =C3=A9crit : > > > > >> > > > > >> > What you are doing is not particularly OSGi-y... The > expected > > > way to do > > > > >> > this is to have each bundle register their PlcDriver or > > > Transport to the > > > > >> > OSGi service registry. > > > > >> > > > > > >> > That said, what you have done is otherwise fine, as you > > > basically > > > > >> trying to > > > > >> > centralize the BundleActivators away from respective > > > Driver/Transport. > > > > >> And > > > > >> > I assume you do so to limit code in the drivers/transports= . > > > > >> > > > > > >> > Another way would be to make two generic BundleActivator i= n > > > this bundle > > > > >> and > > > > >> > have each driver/transport just declare them in the > manifest. > > > That > > > > >> would be > > > > >> > a bit more conventional. > > > > >> > > > > > >> > // Niclas > > > > >> > > > > > >> > On Tue, May 5, 2020 at 11:06 AM Robinet, Etienne < > > > 43823@etu.he2b.be> > > > > >> > wrote: > > > > >> > > > > > >> > > Hi all, > > > > >> > > With the change of Christofer this problem got solved. > > > Nonetheless, I > > > > >> > kept > > > > >> > > the work I did (inspired by the work of Lukasz) to make = an > > > Activator > > > > >> for > > > > >> > > API (Driver Services) and SPI (Transport Services). I al= so > > > tested it, > > > > >> but > > > > >> > > as I am pretty new to this, if anyone could just give me= a > > > feedback on > > > > >> > the > > > > >> > > code: > > > > >> > > > > > > >> > > API Activator: > > > > >> > > > > > > >> > > > > > > >> > > > > > >> > > > > https://github.com/apache/plc4x/blob/feature/osgi/plc4j/api/src/main/java= /org/apache/plc4x/java/osgi/ApiActivator.java > > > > >> > > SPI Activator: > > > > >> > > > > > > >> > > > > > > >> > > > > > >> > > > > https://github.com/apache/plc4x/blob/feature/osgi/plc4j/spi/src/main/java= /org/apache/plc4x/java/osgi/SpiActivator.java > > > > >> > > > > > > >> > > If everything is alright, I could merge this today. > > > > >> > > > > > > >> > > Etienne > > > > >> > > > > > > >> > > Le mar. 7 avr. 2020 =C3=A0 17:52, Christofer Dutz < > > > > >> christofer.dutz@c-ware.de> > > > > >> > a > > > > >> > > =C3=A9crit : > > > > >> > > > > > > >> > > > Hi folks, > > > > >> > > > > > > > >> > > > I just pushed a change that might get rid of this erro= r. > > > > >> > > > > > > > >> > > > I added the Plc4xBootstrap in an attempt to get the > > > TestTransport > > > > >> > > working. > > > > >> > > > For some reasons the netty folks created the > EmbeddedChannel > > > > >> > differently > > > > >> > > > than the rest. > > > > >> > > > However as the TestTransport is the only one needing > this > > > change, I > > > > >> > moved > > > > >> > > > these classes to the test-transport module > > > > >> > > > and extended NettyChannelFactory with a createBootstra= p > > > method > > > > >> which is > > > > >> > > > simply overridden in TestTransport. > > > > >> > > > > > > > >> > > > So please give everything a try if it now works as > planned. > > > > >> > > > > > > > >> > > > Chris > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > Am 07.04.20, 17:36 schrieb "Etienne Robinet" < > > > 43823@etu.he2b.be>: > > > > >> > > > > > > > >> > > > Hi all, > > > > >> > > > I=E2=80=99ve checked the Manifest. If I put the > > > Embed-Dependency to the > > > > >> > > > plc4j-spi artifact it does not find the Transport > Service. > > > And if I > > > > >> > dont > > > > >> > > > it does not find the Plc4xBootstrap. > > > > >> > > > > > > > >> > > > Etienne ROBINET > > > > >> > > > > > > > >> > > > > Le 7 avr. 2020 =C3=A0 16:48, =C5=81ukasz Dywicki= < > > > luke@code-house.org> > > > > >> a > > > > >> > > > =C3=A9crit : > > > > >> > > > > > > > > >> > > > > I was updating my local checkout yesterday. Can'= t > > > promise if I > > > > >> > will > > > > >> > > > be > > > > >> > > > > able to help, but will give a try with 0.7 > snapshot. > > > > >> > > > > > > > > >> > > > > Best, > > > > >> > > > > =C5=81ukasz > > > > >> > > > > > > > > >> > > > > > > > > >> > > > >> On 07.04.2020 15:39, Etienne Robinet wrote: > > > > >> > > > >> Hi again, > > > > >> > > > >> I've been looking at this issue all day, and I = am > > > back to the > > > > >> > > > initial error: > > > > >> > > > >> https://i.imgur.com/LLfan8H.png > > > > >> > > > >> > > > > >> > > > >> The difference is I used and Activator for API > and > > > SPI to > > > > >> > register > > > > >> > > > the driver and transports Service, which are then > loaded by > > > the > > > > >> custom > > > > >> > > > blueprint. The error now is caused again because this > class > > > is not > > > > >> > > exported > > > > >> > > > (I think?) by the SPI, but is used by one of the > dependency > > > > >> (io.netty). > > > > >> > > > >> Any ideas on how to solve this? > > > > >> > > > >> > > > > >> > > > >> Etienne > > > > >> > > > >> > > > > >> > > > >>> On 2020/04/07 06:53:54, Etienne Robinet < > > > > >> erobinet@apache.org> > > > > >> > > > wrote: > > > > >> > > > >>> Hi all, > > > > >> > > > >>> the faulty ClassLoader is the > > > > >> > > > BundleDelegatingClassLoader(plc4x-test [191]). Which > means > > > that the > > > > >> > > custom > > > > >> > > > bundle can not find the class right? > > > > >> > > > >>> > > > > >> > > > >>> I'm sorry if it's a silly question but I am > pretty > > > new to > > > > >> this. > > > > >> > > > >>> > > > > >> > > > >>> Etienne > > > > >> > > > >>> > > > > >> > > > >>> On 2020/04/06 20:28:17, =C5=81ukasz Dywicki < > > > luke@code-house.org > > > > >> > > > > > >> > > > wrote: > > > > >> > > > >>>> I haven't used Camel for a while, but to me i= t > > > seems to be > > > > >> a > > > > >> > > > problem > > > > >> > > > >>>> caused by caller's classloader. > > > > >> > > > >>>> > > > > >> > > > >>>> See that in stack trace you have a thread > which is > > > started > > > > >> by > > > > >> > > > camel, so > > > > >> > > > >>>> there are 3 or even 4 classloaders to be > > > considered: > > > > >> > > > >>>> - plc4x, definitely not a faulty one > > > > >> > > > >>>> - netty, could be troublesome but unlikely to > be > > > used > > > > >> > > > >>>> - camel-core, or component itself > > > > >> > > > >>>> - custom bundle which started the route > > > > >> > > > >>>> > > > > >> > > > >>>> Anything beside last one which knows all the > > > dependencies > > > > >> will > > > > >> > > > blow up > > > > >> > > > >>>> whole universe. Here is why - only the custom > > > bundle knows > > > > >> all > > > > >> > > the > > > > >> > > > >>>> dependencies necessary to run logic and can b= e > > > used to fix > > > > >> > > messed > > > > >> > > > up > > > > >> > > > >>>> classpath. In most of the cases, that's the > > > "trick" you > > > > >> have > > > > >> > to > > > > >> > > > make in > > > > >> > > > >>>> order to get OSGi happy. > > > > >> > > > >>>> Camel component may not, and should not depen= d > on > > > specific > > > > >> > > driver, > > > > >> > > > >>>> however in your case it does. Possibly due to > new > > > APIs in > > > > >> > > > transport > > > > >> > > > >>>> layer its shouldn't be used for adhoc fixes. > > > > >> > > > >>>> > > > > >> > > > >>>> We can try to turn drivers into services (see > here > > > > >> > > > >>>> > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > https://github.com/splatch/plc4x/commit/5ce379cf8d2f5dc91fdfb6d8a8e2c0531= 906e69f > > > > >> > > > ) > > > > >> > > > >>>> in order to cut concrete class dependency and > rely > > > on > > > > >> isolated > > > > >> > > > APIs. > > > > >> > > > >>>> This code was done before new abstractions ov= er > > > netty were > > > > >> > > > introduced, > > > > >> > > > >>>> but it should cut in half API and caller side > (not > > > sure if > > > > >> > we're > > > > >> > > > on > > > > >> > > > >>>> declarative services). > > > > >> > > > >>>> > > > > >> > > > >>>> My tip to you Etienne - please verify which > class > > > loader is > > > > >> > used > > > > >> > > > in your > > > > >> > > > >>>> polling cycle. You can do that by making > > > breakpoint in > > > > >> faulty > > > > >> > > > method of > > > > >> > > > >>>> S7Driver and evaluating expression > > > > >> > > > >>>> > "Thread.currentThread().getContextClassLoader()". > > > > >> > > > >>>> Once you know that you can either fix > classloading > > > in the > > > > >> > > calling > > > > >> > > > class > > > > >> > > > >>>> loader or override classloader for thread to > > > proper one. > > > > >> > > > >>>> > > > > >> > > > >>>> Best, > > > > >> > > > >>>> =C5=81ukasz > > > > >> > > > >>>> > > > > >> > > > >>>> > > > > >> > > > >>>> On 03.04.2020 10:27, Etienne Robinet wrote: > > > > >> > > > >>>>> Hi Christian, > > > > >> > > > >>>>> you mean the code used in the Camel route? I= t > is > > > an > > > > >> > blueprint: > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > >> http://www.osgi.org/xmlns/blueprint/v1.0.0 > > > > >> > " > > > > >> > > > >>>>> xmlns:xsi=3D" > > > > >> > http://www.w3.org/2001/XMLSchema-instance > > > > >> > > " > > > > >> > > > >>>>> xsi:schemaLocation=3D " > > > > >> > > > http://www.osgi.org/xmlns/blueprint/v1.0.0 > > > > >> > > > > https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd > > > > >> > > > >>>>> > > > http://camel.apache.org/schema/blueprint > > > > >> > > > > > > http://camel.apache.org/schema/blueprint/camel-blueprint-2.24.2.xsd > > > > >> "> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > >> > > > http://camel.apache.org/schema/blueprint" > > > streamCache=3D"true" > > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > >> > > > uri=3D"timer://plcFetch?fixedRate=3Dtrue&period=3D1000= "/> > > > > >> > > > >>>>> > > > > >> > > > >>>>> plc4x:s7:tcp:// > > > > >> > > > 192.168.178.10?address=3D#fields > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> class=3D"java.util.ArrayList"> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > >> class=3D"org.apache.plc4x.camel.TagData"> > > > > >> > > > >>>>> > > value=3D"IntTest"/> > > > > >> > > > >>>>> > > > >> > value=3D"%DB1.DBW254:INT"/> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > >> class=3D"org.apache.plc4x.camel.TagData"> > > > > >> > > > >>>>> > > value=3D"StringTest"/> > > > > >> > > > >>>>> > > > >> > > value=3D"%DB1.DBX0:STRING"/> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> This code used to wrok actually, I just > wanted to > > > test the > > > > >> > new > > > > >> > > > TagData of the integration. This is the bundling in th= e > > > pom, these > > > > >> > > imports > > > > >> > > > had to be there before too > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > org.apache.felix > > > > >> > > > >>>>> > > > > >> maven-bundle-plugin > > > > >> > > > >>>>> 4.2.1 > > > > >> > > > >>>>> true > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > > > > ${project.artifactId} > > > > >> > > > >>>>> > > > > >> > > > ${project.version} > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > *;version=3D${project.version} > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > org.apache.plc4x.java.spi.transport, > > > > >> > > > >>>>> > > > > >> > org.apache.plc4x.java.s7.readwrite, > > > > >> > > > >>>>> * > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> > > > > >> > > > >>>>> Etienne > > > > >> > > > >>>>> > > > > >> > > > >>>>> On 2020/04/03 08:17:45, Christian Schneider = < > > > > >> > > > chris@die-schneider.net> wrote: > > > > >> > > > >>>>>> The code in plc4x directly uses the class > (not a > > > String > > > > >> of > > > > >> > the > > > > >> > > > name). This > > > > >> > > > >>>>>> is good. Normally such a class reference > should > > > work > > > > >> fine. > > > > >> > > > >>>>>> > > > > >> > > > >>>>>> Can you show your code as a complete exampl= e? > > > > >> > > > >>>>>> > > > > >> > > > >>>>>> Christian > > > > >> > > > >>>>>> > > > > >> > > > >>>>>> > > > > >> > > > >>>>>> Am Fr., 3. Apr. 2020 um 09:58 Uhr schrieb > Julian > > > > >> Feinauer < > > > > >> > > > >>>>>> j.feinauer@pragmaticminds.de>: > > > > >> > > > >>>>>> > > > > >> > > > >>>>>>> I am off with my knowledge. > > > > >> > > > >>>>>>> You could ask the Karaf friends (#karaf in > > > Slack). They > > > > >> are > > > > >> > > > all OSGi > > > > >> > > > >>>>>>> experts and very friendly and helpful. > > > > >> > > > >>>>>>> Or perhaps Christian has an idea here? > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> Best > > > > >> > > > >>>>>>> Julian > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> Am 03.04.20, 09:50 schrieb "Etienne > Robinet" < > > > > >> > > > erobinet@apache.org>: > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> Hi again, > > > > >> > > > >>>>>>> I've been struggling with this issue fo= r > 2 > > > days > > > > >> now... I > > > > >> > > > still don't > > > > >> > > > >>>>>>> get it why it can not find classes. here i= s > the > > > current > > > > >> > > > problem: > > > > >> > > > >>>>>>> https://i.imgur.com/LtZMdsu.png > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> We can see that the classes are > available and > > > > >> exported, > > > > >> > I > > > > >> > > > don't know > > > > >> > > > >>>>>>> why the Camel Context can't find it. I eve= n > > > tried to > > > > >> add an > > > > >> > > > Activator to my > > > > >> > > > >>>>>>> bundle, and load these classes there and i= t > > > works! But > > > > >> not > > > > >> > in > > > > >> > > > the > > > > >> > > > >>>>>>> blueprint. If anyone had any idea on where > the > > > problem > > > > >> > is... > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> Etienne > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> On 2020/04/01 01:31:15, Niclas Hedhman = < > > > > >> > > niclas@hedhman.org> > > > > >> > > > wrote: > > > > >> > > > >>>>>>>> It happens that OSGi classloading result = in > > > the wrong > > > > >> > NCDFE > > > > >> > > > and that > > > > >> > > > >>>>>>> one of > > > > >> > > > >>>>>>>> the classes "used" (i.e. return type, > > > parameter, > > > > >> throws, > > > > >> > > > extends, > > > > >> > > > >>>>>>>> implements) in the reported class is not > > > visible by the > > > > >> > > > classloader. > > > > >> > > > >>>>>>> And > > > > >> > > > >>>>>>>> occasionally, it is a "diamond problem", > i.e. > > > that the > > > > >> > > > Constraints > > > > >> > > > >>>>>>> (IIRC, > > > > >> > > > >>>>>>>> see chapter 3.8 in OSGi spec) can't be > > > satisfied. > > > > >> > > > >>>>>>>> > > > > >> > > > >>>>>>>> Sorry that I don't have time to dig into > the > > > actual > > > > >> > > situation > > > > >> > > > here, > > > > >> > > > >>>>>>> but I > > > > >> > > > >>>>>>>> thought I could share some of my past > (dark) > > > > >> history.... > > > > >> > ;-) > > > > >> > > > >>>>>>>> > > > > >> > > > >>>>>>>> Cheers > > > > >> > > > >>>>>>>> Niclas > > > > >> > > > >>>>>>>> > > > > >> > > > >>>>>>>> On Wed, Apr 1, 2020 at 12:43 AM Christofe= r > > > Dutz < > > > > >> > > > >>>>>>> christofer.dutz@c-ware.de> > > > > >> > > > >>>>>>>> wrote: > > > > >> > > > >>>>>>>> > > > > >> > > > >>>>>>>>> Hi all, > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> But If I search for uses of that class, > it's > > > only in > > > > >> the > > > > >> > > > >>>>>>>>> > > > > >> org.apache.plc4x.java.spi.connection.NettyChannelFactory > > > > >> > > > which is > > > > >> > > > >>>>>>> in the > > > > >> > > > >>>>>>>>> SPI module. > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> So I am not sure where this is accessed > > > directly from > > > > >> the > > > > >> > > > outside. > > > > >> > > > >>>>>>> I know > > > > >> > > > >>>>>>>>> every driver would use the > > > NettyChannelFactory, but > > > > >> that > > > > >> > > > shouldn't > > > > >> > > > >>>>>>> be an > > > > >> > > > >>>>>>>>> OSGi type problem as the SPI classes > should > > > be able to > > > > >> > > access > > > > >> > > > >>>>>>> their own > > > > >> > > > >>>>>>>>> classes. > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> Chris > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> Am 31.03.20, 16:07 schrieb "Etienne > Robinet" < > > > > >> > > > 43823@etu.he2b.be>: > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> Hi, > > > > >> > > > >>>>>>>>> From the log the class is called > outside > > > the SPI by > > > > >> > the > > > > >> > > > >>>>>>> transport > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> Etienne > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>>> Le 31 mars 2020 =C3=A0 15:24, Julian Fe= inauer > < > > > > >> > > > >>>>>>>>> j.feinauer@pragmaticminds.de> a =C3=A9cr= it : > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Hi, > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> yes, if ist only needed internally its > > > fine.But why > > > > >> does > > > > >> > > > >>>>>>> someone > > > > >> > > > >>>>>>>>> then get a Class Not Found Exception? > > > > >> > > > >>>>>>>>>> This is usually a hint to some class > loader > > > issue in > > > > >> > OSGi > > > > >> > > > >>>>>>> which is > > > > >> > > > >>>>>>>>> related to exports/ imports. > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> J > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Am 31.03.20, 15:23 schrieb "Christofer > Dutz" > > > < > > > > >> > > > >>>>>>>>> christofer.dutz@c-ware.de>: > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> As this package is only referenced fr= om > > > within SPI, > > > > >> > > > >>>>>>> couldn't we > > > > >> > > > >>>>>>>>> just exclude it from the package exports= ? > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Chris > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Am 31.03.20, 15:17 schrieb "Julian > > > Feinauer" < > > > > >> > > > >>>>>>>>> j.feinauer@pragmaticminds.de>: > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Hi, > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> the issue is that if we export it= , > > > then we > > > > >> break > > > > >> > > > >>>>>>> Nettys OSGi > > > > >> > > > >>>>>>>>> integration as we get a split package > > > situation (two > > > > >> > > bundles > > > > >> > > > >>>>>>> exporting the > > > > >> > > > >>>>>>>>> same package, which is forbidden in OSGi= ). > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> So I see no easy solution (but ha= d > to > > > do the > > > > >> same > > > > >> > > > >>>>>>> once as > > > > >> > > > >>>>>>>>> Netty is pretty... private). > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> J > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Am 31.03.20, 15:15 schrieb > "Christofer > > > Dutz" < > > > > >> > > > >>>>>>>>> christofer.dutz@c-ware.de>: > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Hi all, > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> I just discussed this issue > with > > > Etienne > > > > >> and I > > > > >> > > > >>>>>>> thought it > > > > >> > > > >>>>>>>>> was important for all, so I asked him to > > > bring it > > > > >> here. > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> In my effort to get the > > > EmbeddedChannel > > > > >> > working > > > > >> > > > >>>>>>> as a full > > > > >> > > > >>>>>>>>> "transport" module, I had to override th= e > > > Netty > > > > >> Bootstrap > > > > >> > > > >>>>>>> mechanism. > > > > >> > > > >>>>>>>>>> Unfortunately in order to do > so, I > > > need to > > > > >> > call > > > > >> > > > >>>>>>> "init" > > > > >> > > > >>>>>>>>> from the derived class. Unfortunately > this is > > > package > > > > >> > > > private in > > > > >> > > > >>>>>>> Netty so I > > > > >> > > > >>>>>>>>> had > > > > >> > > > >>>>>>>>>> To add it to the same package= . > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Would it help to just not > export > > > these > > > > >> > packages > > > > >> > > > >>>>>>> to OSGi? > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> But I'm also open for > alternatives > > > (Please > > > > >> > none > > > > >> > > > >>>>>>> involving > > > > >> > > > >>>>>>>>> mega-evil reflection hackery). > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Chris > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Am 31.03.20, 15:10 schrieb > "Etienne > > > > >> Robinet" < > > > > >> > > > >>>>>>>>> erobinet@apache.org>: > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Hi all, > > > > >> > > > >>>>>>>>>> I've been working on the > Camel > > > > >> Component > > > > >> > and > > > > >> > > > >>>>>>> decided > > > > >> > > > >>>>>>>>> to test it inside Karaf, but I noticed > that > > > I've got > > > > >> this > > > > >> > > > error > > > > >> > > > >>>>>>> now: > > > > >> > > > >>>>>>>>>> > > > https://i.imgur.com/kUZPwZ5.png > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Seems like this class is > not > > > exported > > > > >> by > > > > >> > the > > > > >> > > > >>>>>>> bundle > > > > >> > > > >>>>>>>>> so it can not be found. Anyone has an > idea on > > > how we > > > > >> > could > > > > >> > > > solve > > > > >> > > > >>>>>>> this? > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> Etienne > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>>> > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>>> > > > > >> > > > >>>>>>>> > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>>> > > > > >> > > > >>>>>> > > > > >> > > > >>>>>> -- > > > > >> > > > >>>>>> -- > > > > >> > > > >>>>>> Christian Schneider > > > > >> > > > >>>>>> http://www.liquid-reality.de > > > > >> > > > >>>>>> > > > > >> > > > >>>>>> Computer Scientist > > > > >> > > > >>>>>> http://www.adobe.com > > > > >> > > > >>>>>> > > > > >> > > > >>>> > > > > >> > > > >>> > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > > > > > > > > > > > > --00000000000027feaf05a4f9563a--