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>*
>

Reply via email to