I guess its in your config. If I remember correctly you have to state the 
transport layer.
So in your case:

Modbus:tcp://xxx

Does that help?

Am 11.06.20, 12:13 schrieb "Alessio Bernesco Làvore" 
<alessio.berne...@gmail.com>:

    Thank you very much Cesar for your insight and your detailed explanation,
    much appreciated.
    I've used your feature to enable your example and my works, now they both
    find the Modbus driver and all the flow seems clear to me.

    Running your command, but also running my test using an activator, there's
    a transport error:

    karaf@root()> plc4x:read modbus modbus://192.168.70.73 coil:1


    Find driver service: Modbus
    Error executing command: Unsupported transport tcp

    I cannot understand if it's still related to a misconfiguration on my side
    or with the driver.

    Greetings,
    Alessio




    On Wed, Jun 10, 2020 at 8:25 AM Cesar Garcia <cesar.gar...@ceos.com.ve>
    wrote:

    >  Hello Alessio,
    >
    > As I pointed out, with the new design of the drivers it is necessary to
    > make a few modifications so that the system allows communication with the
    > OSGi container.
    >
    > In a default installation, the load of services in the SPI services are 
not
    > seen between the different bundles, and that is the problem that is
    > happening to you and, as Julian pointed out in his email, the Apache Aries
    > Fly project solves it.
    >
    > By default Karaf does not integrate the Aries Fly project (although the
    > page indicates that it does), it can be added in a feature or you can
    > generate your own version of Karaf (I always start from a minimal
    > installation), so I complement the feature you published  and you can see
    > in[1].
    >
    > Now each service / consumer must indicate within the manifest the methods
    > that it export or import as appropriate. In your case you need to specify
    > the transport services, specifically "PLC4J: Transports: TCP" and the
    > consumer "PLC4J: SPI", which are what cause the problem. Modifications in
    > [2] and [3] are made in the POMs.
    >
    > At this point you should already see the transport and the registered by
    > spifly like in [4].
    >
    > Well, here you can already use PLC4X in your bundle, in [5] leave an
    > example code, creating a Karaf command with which you can access the 
Modbus
    > or S7 driver indifferently (Just test the Modbus).
    >
    > This could somehow be treated as a PR for the project, it should be
    > evaluated.
    >
    > My grain of sand.
    >
    > 1. The feature
    >
    >     <feature name='${project.artifactId}' description='${project.name}'
    > version='${project.version}'>
    >         <details>${project.description}</details>
    >         <details>Implementation of the protocol adapters for usage as Java
    > library.</details>
    >         <bundle>mvn:org.apache.plc4x/plc4j-osgi/0.8.0-SNAPSHOT</bundle>
    >         <bundle>mvn:org.osgi/osgi.core/6.0.0</bundle>
    >         <bundle>mvn:org.apache.plc4x/plc4j-api/0.8.0-SNAPSHOT</bundle>
    >         <bundle>mvn:org.apache.plc4x/plc4j-spi/0.8.0-SNAPSHOT</bundle>
    >         <bundle>mvn:io.netty/netty-codec/4.1.47.Final</bundle>
    >         <bundle>mvn:io.netty/netty-common/4.1.47.Final</bundle>
    >         <bundle>mvn:io.netty/netty-transport/4.1.47.Final</bundle>
    >         <bundle>mvn:io.netty/netty-resolver/4.1.47.Final</bundle>
    >         <bundle>mvn:commons-beanutils/commons-beanutils/1.9.4</bundle>
    >         <bundle>mvn:commons-logging/commons-logging/1.2</bundle>
    >         <bundle>mvn:commons-collections/commons-collections/3.2.2</bundle>
    >         <bundle>mvn:com.github.jinahya/bit-io/1.4.3</bundle>
    >         <bundle>mvn:commons-codec/commons-codec/1.12</bundle>
    >
    > <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.8.0-SNAPSHOT</bundle>
    >
    >
    > <bundle>mvn:org.apache.plc4x/plc4j-driver-modbus/0.8.0-SNAPSHOT</bundle>
    >
    >
    > <bundle>mvn:org.apache.plc4x/plc4j-transport-tcp/0.8.0-SNAPSHOT</bundle>
    >
    >
    > <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.10.0</bundle>
    >         <bundle>mvn:org.apache.commons/commons-lang3/3.9</bundle>
    >         <bundle>mvn:io.netty/netty-buffer/4.1.47.Final</bundle>
    >         <bundle>mvn:io.vavr/vavr/0.10.2</bundle>
    >         <bundle>mvn:io.vavr/vavr-match/0.10.2</bundle>
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > *        <bundle>mvn:org.ow2.asm/asm/8.0.1</bundle>
    > <bundle>mvn:org.ow2.asm/asm-util/8.0.1</bundle>
    > <bundle>mvn:org.ow2.asm/asm-tree/8.0.1</bundle>
    > <bundle>mvn:org.ow2.asm/asm-commons/8.0.1</bundle>
    > <bundle>mvn:org.ow2.asm/asm-analysis/8.0.1</bundle>        <!--
    > <bundle>mvn:biz.aQute.bnd/aQute.libg/5.0.1</bundle>
    > <bundle>mvn:biz.aQute.bnd/biz.aQute.bndlib/5.0.1</bundle>        -->
    >
    > 
<bundle>mvn:org.apache.aries.spifly/org.apache.aries.spifly.weaver-internal/1.3.0</bundle>
    >
    >
    > 
<bundle>mvn:org.apache.aries.spifly/org.apache.aries.spifly.core-internal/1.3.0</bundle>
    >
    >
    > 
<bundle>mvn:org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle/1.3.0</bundle>
    >      *
    >
    >     </feature>
    >
    > [2] "PLC4J: Transports: TCP"
    >
    >       <plugin>
    >         <groupId>org.apache.felix</groupId>
    >         <artifactId>maven-bundle-plugin</artifactId>
    >         <extensions>true</extensions>
    >         <configuration>
    >           <instructions>
    >
    >
    > 
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
    >
    >
    > 
<Bundle-Activator>org.apache.plc4x.java.osgi.TransportActivator</Bundle-Activator>
    >
    >
    > 
<Export-Service>org.apache.plc4x.java.spi.transport.Transport,org.apache.plc4x.java.transport.tcp.TcpTransport</Export-Service>
    >            * <SPI-Provider>*</SPI-Provider>*
    >           </instructions>
    >         </configuration>
    >       </plugin>
    >
    > [3] "PLC4J: SPI"
    >       <plugin>
    >         <groupId>org.apache.felix</groupId>
    >         <artifactId>maven-bundle-plugin</artifactId>
    >         <extensions>true</extensions>
    >         <configuration>
    >           <instructions>
    >             <Export-package>io.netty.bootstrap,*</Export-package>
    >             *<SPI-consumer>*</SPI-consumer>*
    >           </instructions>
    >         </configuration>
    >       </plugin>
    >     </plugins>
    >
    > [4] karaf@root()> service:list Transport
    > [org.apache.plc4x.java.spi.transport.Transport]
    > -----------------------------------------------
    >  org.apache.plc4x.transport.code = tcp
    >  org.apache.plc4x.transport.name = IP/TCP Transport
    >  service.bundleid = 89
    >  service.id = 207
    >  service.scope = singleton
    > Provided by :
    >  PLC4J: Transports: TCP (89)
    > Used by:
    >  TestPLC4XOsgiWay Blueprint Bundle (51)
    >
    > [org.apache.plc4x.java.spi.transport.Transport]
    > -----------------------------------------------
    >  .org.apache.aries.spifly.provider.discovery.mode = SPI_PROVIDER_HEADER
    >  .org.apache.aries.spifly.provider.implclass =
    > org.apache.plc4x.java.transport.tcp.TcpTransport
    >  service.bundleid = 89
    >  service.id = 208
    >  service.scope = bundle
    >  serviceloader.mediator = 45
    > Provided by :
    >  PLC4J: Transports: TCP (89)
    >
    > [5] *https://github.com/glcj/TestPLC4X <https://github.com/glcj/TestPLC4X
    > >*
    >
    >
    > El mar., 9 jun. 2020 a las 5:23, Alessio Bernesco Làvore (<
    > alessio.berne...@gmail.com>) escribió:
    >
    > > Thank you Cesar,
    > > thanks for your insight, but i think i'm still lost somewhere.
    > >
    > > I've registered the driver inside my bundle context, at least i think 
so:
    > >
    > > [org.apache.plc4x.java.api.PlcDriver]
    > > -------------------------------------
    > >  org.apache.plc4x.driver.code = modbus
    > >  org.apache.plc4x.driver.name = Modbus
    > >  service.bundleid = 165
    > >  service.id = 247
    > >  service.scope = singleton
    > > Provided by :
    > >  PLC4J: Driver: Modbus (165)
    > > Used by:
    > >  edgecontroller Bundle (164) <--
    > >
    > > Anyway starting the bundle the PLC Driver Manager is unable to find the
    > > driver:
    > >
    > > 2020-06-09T09:17:50,132 | INFO  | pipe-bundle:update edgecontroller |
    > > PlcDriverManager                 | 152 - org.apache.plc4x.plc4j-api -
    > > 0.8.0.SNAPSHOT | Instantiating new PLC Driver Manager with class loader
    > > sun.misc.Launcher$AppClassLoader@764c12b6
    > > 2020-06-09T09:17:50,132 | INFO  | pipe-bundle:update edgecontroller |
    > > PlcDriverManager                 | 152 - org.apache.plc4x.plc4j-api -
    > > 0.8.0.SNAPSHOT | Registering available drivers...
    > > 2020-06-09T09:17:50,133 | ERROR | pipe-bundle:update edgecontroller |
    > > Activator                        | 164 - edgecontroller - 1.0.0 | Unable
    > to
    > > find driver for protocol 'modbus'
    > >
    > > Greetings,
    > > Alessio
    > >
    > > On Mon, Jun 8, 2020 at 10:52 PM Cesar Garcia <cesar.gar...@ceos.com.ve>
    > > wrote:
    > >
    > > >  Hello Alessio,
    > > >
    > > > Perform the test with the "feature" that you put online, and I can see
    > > that
    > > > the services associated with the drivers are active.
    > > >
    > > > karaf@root()> service:list PlcDriver
    > > > [org.apache.plc4x.java.api.PlcDriver]
    > > > -------------------------------------
    > > >  org.apache.plc4x.driver.code = modbus
    > > >  org.apache.plc4x.driver.name = Modbus
    > > >  service.bundleid = 59
    > > >  service.id = 98
    > > >  service.scope = singleton
    > > > Provided by :
    > > >  PLC4J: Driver: Modbus (59)
    > > >
    > > > [org.apache.plc4x.java.api.PlcDriver]
    > > > -------------------------------------
    > > >  org.apache.plc4x.driver.code = s7
    > > >  org.apache.plc4x.driver.name = Siemens S7 (Basic)
    > > >  service.bundleid = 60
    > > >  service.id = 97
    > > >  service.scope = singleton
    > > > Provided by :
    > > >  PLC4J: Driver: S7 (Step7) (60)
    > > >
    > > > The solution is to use the "BundleContext" with a filter and take the
    > > field
    > > > "org.apache.plc4x.driver.name " or  the field
    > > > "org.apache.plc4x.driver.code" ( They are the same ). I think that is
    > the
    > > > way to do it in an OSGi environment.
    > > >
    > > > Loading the services with SPI is redundant, and it may happen that the
    > > SPI
    > > > service does not see the PlcDriver Services (typical OSGi problem).
    > > >
    > > > My grain of sand,
    > > >
    > > > Best regards,
    > > >
    > > >
    > > >
    > > >
    > > > El lun., 8 jun. 2020 a las 15:41, Alessio Bernesco Làvore (<
    > > > alessio.berne...@gmail.com>) escribió:
    > > >
    > > > > Thank you Julian,
    > > > > i've tried to install th Aries SPI Bundle:
    > > > >
    > > > > 176 │ Active   │  80 │ 1.3.0              │ Apache Aries SPI Fly
    > > Dynamic
    > > > > Weaving Bundle
    > > > >
    > > > > But i'm still unable to resolve the drivers.
    > > > >
    > > > > Ale
    > > > >
    > > > > On Mon, Jun 8, 2020 at 8:13 PM Julian Feinauer <
    > > > > j.feina...@pragmaticminds.de>
    > > > > wrote:
    > > > >
    > > > > > Hi Alessio,
    > > > > >
    > > > > > if I remember correctly you need the Aries SPI Fly package loaded.
    > > > > > In Plain PLC4X we use ServiceLoader to discover drivers.
    > > > > > If you have nothing like Aries SPI Fly which mediates and
    > "immitates"
    > > > the
    > > > > > ServiceLoader then you dont get a wiring between the DriverManager
    > > and
    > > > > the
    > > > > > driver.
    > > > > > But I don’t checked the lastst implementation to be honest.
    > > > > >
    > > > > > Perhaps @Robinet, Etienne can help?
    > > > > >
    > > > > > Julian
    > > > > >
    > > > > > Am 08.06.20, 20:00 schrieb "Alessio Bernesco Làvore" <
    > > > > > alessio.berne...@gmail.com>:
    > > > > >
    > > > > >     Hello everyone,
    > > > > >     i've created a simple class reading values from a ModBus PLC.
    > > > > >
    > > > > >     I'm trying to use it inside Karaf, but at start the class is
    > > unable
    > > > > to
    > > > > > find
    > > > > >     the modbus driver. I've compiled and installed in Karaf the
    > > > > >     "driver-s7-feature", with added the modbus driver:
    > > > > >
    > > > > >     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    > > > > >     <features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0
    > "
    > > > > >     name="driver-s7-feature">
    > > > > >         <feature name="driver-s7-feature" description="PLC4J:
    > > > > > Karaf-Features:
    > > > > >     S7" version="0.8.0.SNAPSHOT">
    > > > > >             <details>Implementation of the protocol adapters for
    > > usage
    > > > as
    > > > > > Java
    > > > > >     library.</details>
    > > > > >
    > > > >  <bundle>mvn:org.apache.plc4x/plc4j-osgi/0.8.0-SNAPSHOT</bundle>
    > > > > >             <bundle>mvn:org.osgi/osgi.core/6.0.0</bundle>
    > > > > >
    > > > >  <bundle>mvn:org.apache.plc4x/plc4j-api/0.8.0-SNAPSHOT</bundle>
    > > > > >
    > > > >  <bundle>mvn:org.apache.plc4x/plc4j-spi/0.8.0-SNAPSHOT</bundle>
    > > > > >             <bundle>mvn:io.netty/netty-codec/4.1.47.Final</bundle>
    > > > > >             
<bundle>mvn:io.netty/netty-common/4.1.47.Final</bundle>
    > > > > >
    > >  <bundle>mvn:io.netty/netty-transport/4.1.47.Final</bundle>
    > > > > >
    >  <bundle>mvn:io.netty/netty-resolver/4.1.47.Final</bundle>
    > > > > >
    > > > >  <bundle>mvn:commons-beanutils/commons-beanutils/1.9.4</bundle>
    > > > > >
    >  <bundle>mvn:commons-logging/commons-logging/1.2</bundle>
    > > > > >
    > > > > > <bundle>mvn:commons-collections/commons-collections/3.2.2</bundle>
    > > > > >             <bundle>mvn:com.github.jinahya/bit-io/1.4.3</bundle>
    > > > > >             <bundle>mvn:commons-codec/commons-codec/1.12</bundle>
    > > > > >
    > > > > >
    > <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.8.0-SNAPSHOT</bundle>
    > > > > >
    > > > > >
    > > > > >
    > > >
    > <bundle>mvn:org.apache.plc4x/plc4j-driver-modbus/0.8.0-SNAPSHOT</bundle>
    > > > > >
    > > > > >
    > > > > >
    > > >
    > <bundle>mvn:org.apache.plc4x/plc4j-transport-tcp/0.8.0-SNAPSHOT</bundle>
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > >
    > >
    > <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.10.0</bundle>
    > > > > >
    >  <bundle>mvn:org.apache.commons/commons-lang3/3.9</bundle>
    > > > > >             
<bundle>mvn:io.netty/netty-buffer/4.1.47.Final</bundle>
    > > > > >             <bundle>mvn:io.vavr/vavr/0.10.2</bundle>
    > > > > >             <bundle>mvn:io.vavr/vavr-match/0.10.2</bundle>
    > > > > >         </feature>
    > > > > >     </features>
    > > > > >
    > > > > >     Inside Karaf i can find all the active bundles:
    > > > > >
    > > > > >     152 │ Active   │  80 │ 0.8.0.SNAPSHOT     │ PLC4J: API
    > > > > >     153 │ Active   │  80 │ 0.8.0.SNAPSHOT     │ PLC4J: Driver: S7
    > > > (Step7)
    > > > > >     154 │ Active   │  80 │ 0.8.0.SNAPSHOT     │ PLC4J: OSGi
    > > > > >     155 │ Active   │  80 │ 0.8.0.SNAPSHOT     │ PLC4J: SPI
    > > > > >     156 │ Active   │  80 │ 0.8.0.SNAPSHOT     │ PLC4J: Transports:
    > > TCP
    > > > > >     157 │ Active   │  80 │ 6.0.0.201403061837 │ osgi.core
    > > > > >     164 │ Active   │  80 │ 1.0                │ edgecontroller
    > Bundle
    > > > > >     165 │ Active   │  80 │ 0.8.0.SNAPSHOT     │ PLC4J: Driver:
    > Modbus
    > > > > >
    > > > > >     Anyway at startup the bundle doesnt find any driver:
    > > > > >
    > > > > >     2020-06-08T17:47:43,391 | INFO  | FelixStartLevel  |
    > > > PlcDriverManager
    > > > > >               | 152 - org.apache.plc4x.plc4j-api - 0.8.0.SNAPSHOT 
|
    > > > > >     Instantiating new PLC Driver Manager with class loader
    > > > > >     sun.misc.Launcher$AppClassLoader@764c12b6
    > > > > >     2020-06-08T17:47:43,391 | INFO  | FelixStartLevel  |
    > > > PlcDriverManager
    > > > > >               | 152 - org.apache.plc4x.plc4j-api - 0.8.0.SNAPSHOT 
|
    > > > > > Registering
    > > > > >     available drivers...
    > > > > >     2020-06-08T17:47:43,392 | ERROR | FelixStartLevel  | Activator
    > > > > >                | 164 - edgecontroller - 1.0.0 | Unable to find
    > driver
    > > > for
    > > > > >     protocol 'modbus'
    > > > > >
    > > > > >     edgecontroller is my bundle, looking at the Karaf log the
    > > > > > PlcDriverManager
    > > > > >     is unable to find any driver.
    > > > > >
    > > > > >     I cannot understand were i'm failing, could anyone provide 
some
    > > > > > insight?
    > > > > >
    > > > > >     Thank you,
    > > > > >     Ale
    > > > > >
    > > > > >
    > > > >
    > > >
    > > >
    > > > --
    > > > *CEOS Automatización, C.A.*
    > > > *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
    > > > *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
    > > >
    > > > *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
    > > > *Ing. César García*
    > > >
    > > > *Cel: +58 414-760.98.95*
    > > >
    > > > *Hotline Técnica SIEMENS: 0800 1005080*
    > > >
    > > > *Email: support.aan.automat...@siemens.com
    > > > <support.aan.automat...@siemens.com>*
    > > >
    > >
    >
    >
    > --
    > *CEOS Automatización, C.A.*
    > *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
    > *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
    >
    > *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
    > *Ing. César García*
    >
    > *Cel: +58 414-760.98.95*
    >
    > *Hotline Técnica SIEMENS: 0800 1005080*
    >
    > *Email: support.aan.automat...@siemens.com
    > <support.aan.automat...@siemens.com>*
    >

Reply via email to