In case if you're looking for working 0.6 build take a look this part of our project: https://github.com/ConnectorIO/connectorio-addons/tree/master/features/plc4x This was indented to be moved back to plc4x but eventually other contributors did osgification before I could.
While below feature set installs all necessary dependencies due to classloadeing issues in 0.6 I had to wrap some of plc4x classes together with the code: https://github.com/ConnectorIO/connectorio-addons/blob/master/binding/plc4x/siemens/pom.xml#L81 and initialize plc driver manager with appropriate class loader: new PlcDriverManager(getClass().getClassLoader()) which has access to both transport and driver itself. If you use a driver classloader you will likely miss transport classes which are not required to parse payloads. You really need to use classloader which has access to both, but then in 0.6 you face troubles with scanning of classpath for META-INF/services and Class.forName calls. The 0.7 release should be better in this regard. We had quite long discussion on that few months ago which span from April to May: https://mail-archives.apache.org/mod_mbox/plc4x-dev/202005.mbox/%3cca+sin1-oefj7pcsp8qjcchojvanlf1pfk8xfhexmqsazmgo...@mail.gmail.com%3e Best regards, Łukasz On 25.08.2020 08:58, 刘存杰 wrote: > > Hi Chris, i will try the Kar bundles of the driver > > Many thanks, > Jeff > >> -----原始邮件----- >> 发件人: "Christofer Dutz" <[email protected]> >> 发送时间: 2020-08-25 14:40:21 (星期二) >> 收件人: "[email protected]" <[email protected]> >> 抄送: >> 主题: Re: plc4j in osgi env >> >> You could try out the Kar bundles every driver should produce. Not 100% sure >> the 0.7.0 already had that feature, but the 0.8.0-SNAPSHOT definitely should. >> >> Chris >> ________________________________ >> Von: 刘存杰 <[email protected]> >> Gesendet: Dienstag, 25. August 2020 06:53 >> An: [email protected] <[email protected]> >> Betreff: plc4j in osgi env >> >> Hello all together >> >> I developed a small application and run in OSGi Env. with plc4j modbus >> driver 0.7.0, I try to do sth list below >> >> 1、I package all dependencies into a fat jar, and exception "Unable to find >> driver for protocol modbus", driver not registed >> >> 2、 i try >> PlcConnection plcConnection = new >> ModbusDriver().getConnection(connectionString) >> >> plcConnection.connect(); >> and exception "Unimplement transport tcp" >> >> >> >> >> 3、i package the dependencies into multi bundles, and the >> org.apache.org.plc4x.java.osgi package missing >> >> What can i use this project in osgi env.? >> >> Thanks and Regards, Jeff
