Hello, with the help of some colleague we managed to find how to fix the issue so that the DriverManager can find the actual s7 protocol. All I had to do is to create a maven project (karaf-blueprint) archetype and do as follow:
1. Inside the pom, add the S7PlcDriver under "imports" 2. create a service under main/java/resources/META-INF/services/xxx.xxx.PlcDriver containing the implementation (S7PlcDriver) and license 3. Create a simple XML blueprint (with a real address this time connected to a real PLC) <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy"> <camelContext id="PLC-Context" xmlns="http://camel.apache.org/schema/blueprint" streamCache="true"> <route id="Route1"> <from uri="plc4x:s7://192.168.178.10/1/1"/> <log message=" Sending ${body}" loggingLevel="INFO" /> <to uri="mock:test?retainLast=10" /> </route> </camelContext> </blueprint> So now I have the next issue, I can see from the log that a connection is established but it tells me that the connection doesn't support connection. Am I missing a parameter or what could be the issue? Here the log: https://i.imgur.com/KgWz8DF.png On 2020/02/17 12:11:56, Christofer Dutz <[email protected]> wrote: > Hi all, > > having a more detailed look at the log-trace, it seems the DriverManager > isn't able to find the S7 driver at all ... > But I guess if it even was available, as Cesar pointed out, the field address > is that of the mock driver and not of the S7 so this will not work. > Also are you connecting to localhost, which is also probably not what you > want. Unless you are running a S7 simulator on your machine. > > Depending of if you're using a released version of the s7 driver the > connection URL is correct, however if you switch to the new S7 driver it > would look like this: s7://{ip or host} > Not the "/1/1" are now missing. > > Chris > > > > > Am 17.02.20, 13:04 schrieb "Cesar Garcia" <[email protected]>: > > Hi, > > The PLC address does not look correct, can you confirm that it really > points to a real PLC or an S7 simulator? > > <from uri="plc4x:s7:localhost/1/1"/> > > Best regards, > > > El vie., 14 feb. 2020 a las 18:34, Etienne Robinet (<[email protected]>) > escribió: > > > Hello everyone, > > I've spent some days trying to figure out how to make PLC4X work inside > a > > karaf container in combination with camel blueprints for routing. > > I've downloaded the latest release (0.5.0) and built it with maven. I > then > > installed the driver-s7-feature and plc4j-apache-camel bundle into my > > container and got following bundles running: > > > > >PLC4J: API > > >PLC4J: Driver: S7 > > >PLC4J: Protocol: Driver-Base: Base > > >PLC4J: Protocol: Driver-Base: TCP > > >PLC4J: Protocol: ISO on TCP > > >PLC4J: Protocol: ISO TP > > >PLC4J: Protocol: S7 > > >PLC4j: Utils: Driver Base: Java > > >PLC4J: Integrations: Apache Camel > > > > After trying a simple route with this consumer component: > > <from uri="plc4x:s7:localhost/1/1"/> (the address is for testing > purpose) > > I get the following error: > > Error occurred during starting CamelContext: PLC-Context > > org.apache.camel.FailedToCreateRouteException: Failed to create route > > Route1: Route(Route1)[[From[plc4x:s7:localhost/1/1]] -> [To[mock:tes... > > because of Unable to find driver for protocol 's7' > > > > I've tested numerous version of PLC4X and got the same results, so I > think > > I might be close to fix it! > > Any help would be appreciated! > > > > Here the full log > > > > 16:30:45.578 INFO [Blueprint Event Dispatcher: 1] Attempting to start > > CamelContext: PLC-Context > > 16:30:45.579 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.24.2 > > (CamelContext: PLC-Context) is starting > > 16:30:45.580 INFO [Blueprint Event Dispatcher: 1] StreamCaching is > enabled > > on CamelContext: PLC-Context > > 16:30:45.580 INFO [Blueprint Event Dispatcher: 1] JMX is enabled > > 16:30:45.600 INFO [Blueprint Event Dispatcher: 1] Instantiating new PLC > > Driver Manager with class loader > > BundleDelegatingClassLoader(plc4j-route.xml [67]) > > 16:30:45.600 INFO [Blueprint Event Dispatcher: 1] Registering available > > drivers... > > 16:30:45.601 TRACE [Blueprint Event Dispatcher: 1] FindResource: > > META-INF/services/org.apache.plc4x.java.spi.PlcDriver > > 16:30:45.627 INFO [Blueprint Event Dispatcher: 1] StreamCaching in use > > with spool directory: > > > C:\karaf\bin\..\data\tmp\camel\camel-tmp-00f849ac-0ccf-4b12-822d-dda62267eb6c > > and rules: [Spool > 128K body size] > > 16:30:45.629 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.24.2 > > (CamelContext: PLC-Context) is shutting down > > 16:30:45.639 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.24.2 > > (CamelContext: PLC-Context) uptime 0.060 seconds > > 16:30:45.640 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.24.2 > > (CamelContext: PLC-Context) is shutdown in 0.011 seconds > > 16:30:45.640 WARN [Blueprint Event Dispatcher: 1] Changing Camel state > for > > bundle 67 to Failure > > 16:30:45.641 ERROR [Blueprint Event Dispatcher: 1] Error occurred during > > starting CamelContext: PLC-Context > > org.apache.camel.FailedToCreateRouteException: Failed to create route > > Route1: Route(Route1)[[From[plc4x:s7:localhost/1/1]] -> [To[mock:tes... > > because of Unable to find driver for protocol 's7' > > at > > org.apache.camel.impl.RouteService.warmUp(RouteService.java:147) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3954) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3861) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3647) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3488) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3247) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3243) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3266) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3243) > > ~[!/:2.24.2] > > at > > org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3159) > > ~[!/:2.24.2] > > at > > > org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:255) > > ~[!/:2.24.2] > > at > > > org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:297) > > ~[!/:2.24.2] > > at > > > org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent(BlueprintCamelContext.java:188) > > [!/:2.24.2] > > at > > > org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:190) > > [!/:1.10.2] > > at > > > org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:188) > > [!/:1.10.2] > > at java.util.concurrent.FutureTask.run(FutureTask.java:264) > [?:?] > > at > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) > > [?:?] > > at java.util.concurrent.FutureTask.run(FutureTask.java:264) > [?:?] > > at > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) > > [?:?] > > at java.util.concurrent.FutureTask.run(FutureTask.java:264) > [?:?] > > at > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) > > [?:?] > > at > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) > > [?:?] > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) > > [?:?] > > at java.lang.Thread.run(Thread.java:834) [?:?] > > Caused by: org.apache.plc4x.java.api.exceptions.PlcConnectionException: > > Unable to find driver for protocol 's7' > > at > > > org.apache.plc4x.java.PlcDriverManager.getDriver(PlcDriverManager.java:98) > > ~[?:?] > > at > > > org.apache.plc4x.java.PlcDriverManager.getConnection(PlcDriverManager.java:71) > > ~[?:?] > > at > > org.apache.plc4x.camel.Plc4XConsumer.<init>(Plc4XConsumer.java:57) > ~[?:?] > > at > > > org.apache.plc4x.camel.Plc4XEndpoint.createConsumer(Plc4XEndpoint.java:72) > > ~[?:?] > > at > > > org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69) > > ~[!/:2.24.2] > > at > > > org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:107) > > ~[!/:2.24.2] > > at > > org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172) > > ~[!/:2.24.2] > > at > > org.apache.camel.impl.RouteService.warmUp(RouteService.java:145) > > ~[!/:2.24.2] > > ... 24 more > > > > > > > > -- > *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: 0416-681.03.99* > > *Cel: 0414-760.98.95* > > *Hotline Técnica SIEMENS: 0800 1005080* > > *Email: [email protected] > <[email protected]>* > > >
