Hi,
I started the Jira issue: https://issues.apache.org/jira/browse/PLC4X-177
Using this XML:
<route>
<from uri="timer://foo?fixedRate=true&period=1000"/>
<pollEnrich>
<constant>plc4x:s7://192.168.178.10/0/1?address=%MW102:INT</constant>
</pollEnrich>
<log message=" Sending ${body}" loggingLevel="INFO" />
<to uri="mock:test?retainLast=10" />
</route>
it creates a PollingConsumer and reads every 1s. The problem is after every
read, I get this warning
14:01:12.850 WARN [nioEventLoopGroup-2523-1] An exceptionCaught() event was
fired, and it reached at the tail of the pipeline. It usually means the last
handler in the pipeline did not handle the exception.
java.io.IOException: An existing connection was forcibly closed by the remote
host
at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[?:?]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) ~[?:?]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276) ~[?:?]
at sun.nio.ch.IOUtil.read(IOUtil.java:233) ~[?:?]
at sun.nio.ch.IOUtil.read(IOUtil.java:223) ~[?:?]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358) ~[?:?]
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247)
~[!/:4.1.39.Final]
at
io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1140)
~[!/:4.1.39.Final]
at
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
~[!/:4.1.39.Final]
at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
[!/:4.1.39.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697)
[!/:4.1.39.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632)
[!/:4.1.39.Final]
at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549)
[!/:4.1.39.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)
[!/:4.1.39.Final]
at
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
[!/:4.1.39.Final]
at
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
[!/:4.1.39.Final]
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[!/:4.1.39.Final]
at java.lang.Thread.run(Thread.java:834) [?:?]
Seems like the connection is closed then opened again every time? Here you can
see that I manage to get the data tho: https://i.imgur.com/K6TTwxA.png
Etienne
On 2020/02/19 12:20:40, Julian Feinauer <[email protected]> wrote:
> Hi Etienne,
>
> thanks fort he update.
> I think the Camel integration was never really used, so it could be a bit
> unhandy, so to say : )
> Probably you create an Issue in Jira
> https://issues.apache.org/jira/projects/PLC4X/issues where we track all
> activites and can help you with improvements.
>
> Best
> Julian
>
> Am 19.02.20, 12:50 schrieb "Etienne Robinet" <[email protected]>:
>
> Hi all,
> quick update, it worked on Camel inside Karaf with Julian's code. I
> managed to read from output, memento and datablock wit hthe correct adress
> input:
>
> <from uri="plc4x:s7://192.168.178.10/0/1?address=%25DB1:4.0:STRING"/>
> -"%25" gets encoded as "%" in XML
> -I fetch in the DB1 at byte 4 starting at his bit 0 and the data I want
> is a STRING.
> -To read a memento, this also worked: address+%25MW102:INT
>
> Now I am going to investigate the polling consumer, as I want to fetch
> the data from the PLC at a polling interval.
>
> Etienne
> On 2020/02/18 16:49:31, Etienne Robinet <[email protected]> wrote:
> > I managed to get the tool working. By that I mean I got to to a read on
> my PLC, but seems like the connection is crashing afterwards.
> > 17:46:56.556 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Instantiating new PLC Driver Manager with class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@78308db1
> > 17:46:56.563 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering available drivers...
> > 17:46:56.579 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol s7 (Siemens S7 (Basic))
> > 17:46:56.588 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol ab-eth (Allen Bradley ETH)
> > 17:46:56.628 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol ads (Beckhoff Twincat ADS)
> > 17:46:56.638 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol eip (EtherNet/IP (TCP))
> > 17:46:56.655 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol modbus (Modbus (TCP / Serial))
> > 17:46:56.723 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol opcua (OPC UA (TCP))
> > 17:46:56.736 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol test (PLC4X Test Protocol)
> > 17:46:57.059 [main] INFO o.a.p.j.s.connection.S7PlcConnection -
> Setting up S7 Connection with: host-name 192.168.178.10, rack 0, slot 1,
> pdu-size 1024, max-amq-caller 8, max-amq-callee 8
> > 17:46:58.758 [nioEventLoopGroup-2-1] INFO
> o.a.plc4x.java.s7.netty.S7Protocol - S7Connection established pdu-size 960,
> max-amq-caller 3, max-amq-callee 3
> > 17:46:58.776 [nioEventLoopGroup-2-1] INFO
> o.a.plc4x.java.s7.netty.S7Protocol - Successfully connected to S7: S7_1500
> wit PDU 960
> > 17:46:58.800 [main] INFO o.a.p.j.e.helloplc4x.HelloPlc4x - Synchronous
> request ...
> > 17:46:58.836 [main] INFO o.a.p.j.e.helloplc4x.HelloPlc4x -
> Value[value-0]: true
> > 17:46:58.836 [main] INFO o.a.p.j.e.helloplc4x.HelloPlc4x -
> Asynchronous request ...
> > 17:46:58.838 [nioEventLoopGroup-2-1] INFO
> o.a.p.j.e.helloplc4x.HelloPlc4x - Value[value-0]: true
> > 17:46:58.844 [nioEventLoopGroup-2-1] WARN
> i.n.channel.DefaultChannelPipeline - An exceptionCaught() event was fired,
> and it reached at the tail of the pipeline. It usually means the last handler
> in the pipeline did not handle the exception.
> > java.io.IOException: An existing connection was forcibly closed by the
> remote host
> > at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
> > at
> java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
> > at
> java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
> > at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
> > at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
> > at
> java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
> > at
> io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247)
> > at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1140)
> > at
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
> > at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
> > at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697)
> > at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632)
> > at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549)
> > at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)
> > at
> io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
> > at
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
> > at
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
> > at java.base/java.lang.Thread.run(Thread.java:834)
> > Disconnected from the target VM, address: '127.0.0.1:61672', transport:
> 'socket'
> >
> > Process finished with exit code 0
> >
> > This did the trick: I had o also enable PUT/GET on my PLC (via TIA
> Portal).
> > Etienne
> > On 2020/02/18 14:08:11, Etienne Robinet <[email protected]> wrote:
> > > Hi, I tried the HelloPLC4X Tool, but it seems like he gets stuck. I'm
> still not sure about the arguments I am passing, here's the log
> > >
> > > 15:05:42.838 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Instantiating new PLC Driver Manager with class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@78308db1
> > > 15:05:42.874 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering available drivers...
> > > 15:05:42.892 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol s7 (Siemens S7 (Basic))
> > > 15:05:42.899 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol ab-eth (Allen Bradley ETH)
> > > 15:05:42.933 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol ads (Beckhoff Twincat ADS)
> > > 15:05:42.941 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol eip (EtherNet/IP (TCP))
> > > 15:05:42.956 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol modbus (Modbus (TCP / Serial))
> > > 15:05:42.980 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol opcua (OPC UA (TCP))
> > > 15:05:43.018 [main] INFO o.apache.plc4x.java.PlcDriverManager -
> Registering driver for Protocol test (PLC4X Test Protocol)
> > > 15:05:43.553 [main] INFO o.a.p.j.s.connection.S7PlcConnection -
> Setting up S7 Connection with: host-name 192.168.178.10, rack 0, slot 1,
> pdu-size 1024, max-amq-caller 8, max-amq-callee 8
> > > 15:05:45.281 [nioEventLoopGroup-2-1] INFO
> o.a.plc4x.java.s7.netty.S7Protocol - S7Connection established pdu-size 960,
> max-amq-caller 3, max-amq-callee 3
> > > 15:05:45.299 [nioEventLoopGroup-2-1] INFO
> o.a.plc4x.java.s7.netty.S7Protocol - Successfully connected to S7: S7_1500
> wit PDU 960
> > > 15:05:45.321 [main] INFO o.a.p.j.e.helloplc4x.HelloPlc4x -
> Synchronous request ... <-----STUCKED
> > >
> > >
> > > And here are the arguments I am passing:
> > > --connection-string s7://192.168.178.10/0/1 --field-addresses
> %DB2:1.0:INT[1]
> > >
> > > I also subscribed to the list ;-)
> > >
> > > On 2020/02/18 13:28:24, Julian Feinauer
> <[email protected]> wrote:
> > > > Hi Etienne,
> > > >
> > > > first, you should try to just access it with the HelloPlc4X Tool,
> just to check that everything works.
> > > > And Second, please subscribe to the mailing list, otherwise all
> your mails have to go through moderation : )
> > > >
> > > > Julian
> > > >
> > > > Am 18.02.20, 14:22 schrieb "Etienne Robinet" <[email protected]>:
> > > >
> > > > Hi Julian, thanks for the fast reply!
> > > >
> > > > The route seems to be started, but I try to put the body in log
> (to check) but with no sucess. Here is what I get with your code
> > > >
> > > > https://i.imgur.com/biB9ZpW.png
> > > >
> > > > After checking the code a bit, I tried to adapt my route. I am
> trying to access a DB (number 2) on my PLC which has a String(Hello) and an
> Int(5). I then try to show the body of the component on the log to verify.
> Maybe my syntax of uri is again not correct?
> > > >
> > > > <from
> uri="plc4x:s7://192.168.178.10/0/1?address=%25DB2:2.0:STRING[1]&dataType=java.lang.String"/>
> > > > <log message=" Sending ${body}" loggingLevel="INFO"
> />
> > > > <to uri="mock:test?retainLast=10" />
> > > >
> > > > On 2020/02/18 12:28:53, Julian Feinauer
> <[email protected]> wrote:
> > > > > Hi Etienne,
> > > > >
> > > > > fort he sake of easiness... could you do a short test if it
> works, when you Replace the Content of PLC4XConsumer.java with the following:
> > > > >
> > > > > ```
> > > > > /*
> > > > > Licensed to the Apache Software Foundation (ASF) under one
> > > > > or more contributor license agreements. See the NOTICE file
> > > > > distributed with this work for additional information
> > > > > regarding copyright ownership. The ASF licenses this file
> > > > > to you under the Apache License, Version 2.0 (the
> > > > > "License"); you may not use this file except in compliance
> > > > > with the License. You may obtain a copy of the License at
> > > > >
> > > > > http://www.apache.org/licenses/LICENSE-2.0
> > > > >
> > > > > Unless required by applicable law or agreed to in writing,
> > > > > software distributed under the License is distributed on an
> > > > > "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> > > > > KIND, either express or implied. See the License for the
> > > > > specific language governing permissions and limitations
> > > > > under the License.
> > > > > */
> > > > > package org.apache.plc4x.camel;
> > > > >
> > > > > import org.apache.camel.*;
> > > > > import org.apache.camel.spi.ExceptionHandler;
> > > > > import org.apache.camel.support.LoggingExceptionHandler;
> > > > > import org.apache.camel.support.ServiceSupport;
> > > > > import org.apache.camel.util.AsyncProcessorConverterHelper;
> > > > > import org.apache.plc4x.java.api.PlcConnection;
> > > > > import org.apache.plc4x.java.api.exceptions.PlcException;
> > > > > import
> org.apache.plc4x.java.api.messages.PlcSubscriptionResponse;
> > > > > import
> org.apache.plc4x.java.api.messages.PlcUnsubscriptionRequest;
> > > > > import
> org.apache.plc4x.java.api.messages.PlcUnsubscriptionResponse;
> > > > > import org.slf4j.Logger;
> > > > > import org.slf4j.LoggerFactory;
> > > > >
> > > > > import java.util.Collection;
> > > > > import java.util.concurrent.*;
> > > > >
> > > > > public class Plc4XConsumer extends ServiceSupport implements
> Consumer {
> > > > > private static final Logger LOGGER =
> LoggerFactory.getLogger(Plc4XConsumer.class);
> > > > >
> > > > > private Plc4XEndpoint endpoint;
> > > > > private AsyncProcessor processor;
> > > > > private ExceptionHandler exceptionHandler;
> > > > > private PlcConnection plcConnection;
> > > > > private String fieldQuery;
> > > > > private Class<?> dataType;
> > > > > private PlcSubscriptionResponse subscriptionResponse;
> > > > >
> > > > > private ScheduledExecutorService executorService =
> Executors.newSingleThreadScheduledExecutor();
> > > > > private ScheduledFuture<?> future;
> > > > >
> > > > > public Plc4XConsumer(Plc4XEndpoint endpoint, Processor
> processor) throws PlcException {
> > > > > this.endpoint = endpoint;
> > > > > this.dataType = endpoint.getDataType();
> > > > > this.processor =
> AsyncProcessorConverterHelper.convert(processor);
> > > > > this.exceptionHandler = new
> LoggingExceptionHandler(endpoint.getCamelContext(), getClass());
> > > > > String plc4xURI =
> endpoint.getEndpointUri().replaceFirst("plc4x:/?/?", "");
> > > > > this.plcConnection =
> endpoint.getPlcDriverManager().getConnection(plc4xURI);
> > > > > this.fieldQuery = endpoint.getAddress();
> > > > > }
> > > > >
> > > > > @Override
> > > > > public String toString() {
> > > > > return "Plc4XConsumer[" + endpoint + "]";
> > > > > }
> > > > >
> > > > > @Override
> > > > > public Endpoint getEndpoint() {
> > > > > return endpoint;
> > > > > }
> > > > >
> > > > > public ExceptionHandler getExceptionHandler() {
> > > > > return exceptionHandler;
> > > > > }
> > > > >
> > > > > public void setExceptionHandler(ExceptionHandler
> exceptionHandler) {
> > > > > this.exceptionHandler = exceptionHandler;
> > > > > }
> > > > >
> > > > > @Override
> > > > > protected void doStart() throws InterruptedException,
> ExecutionException {
> > > > > // TODO: Is it correct to only support one field?
> > > > > future = executorService.schedule(() -> {
> > > > > plcConnection.readRequestBuilder()
> > > > > .addItem("default", fieldQuery)
> > > > > .build()
> > > > > .execute()
> > > > > .thenAccept(response -> {
> > > > > LOGGER.debug("Received {}", response);
> > > > > try {
> > > > > Exchange exchange =
> endpoint.createExchange();
> > > > >
> exchange.getIn().setBody(unwrapIfSingle(response.getAllObjects("default")));
> > > > > processor.process(exchange);
> > > > > } catch (Exception e) {
> > > > > exceptionHandler.handleException(e);
> > > > > }
> > > > > });
> > > > > }, 3, TimeUnit.SECONDS);
> > > > > }
> > > > >
> > > > > @Override
> > > > > protected void doStop() throws InterruptedException,
> ExecutionException, TimeoutException {
> > > > > // First stop the polling process
> > > > > if (future != null) {
> > > > > future.cancel(true);
> > > > > }
> > > > > // TODO: Handle the response ...
> > > > > try {
> > > > > plcConnection.close();
> > > > > } catch (Exception e) {
> > > > > LOGGER.error("Error closing connection", e);
> > > > > }
> > > > > }
> > > > >
> > > > > private Object unwrapIfSingle(Collection collection) {
> > > > > if (collection.isEmpty()) {
> > > > > return null;
> > > > > }
> > > > > if (collection.size() == 1) {
> > > > > return collection.iterator().next();
> > > > > }
> > > > > return collection;
> > > > > }
> > > > >
> > > > > }
> > > > > ```
> > > > >
> > > > > Julian
> > > > >
> > > > >
> > > > > Am 18.02.20, 13:22 schrieb "Julian Feinauer"
> <[email protected]>:
> > > > >
> > > > > Hi Etienne,
> > > > >
> > > > > oh, sorry, indeed. The Code in the Camel module is right,
> but does not work for Siemens S7.
> > > > > Let me try to write you an updated version in another
> branch ASAP then you can check it.
> > > > >
> > > > > Sorry!
> > > > > Julian
> > > > >
> > > > > Am 18.02.20, 12:56 schrieb "Etienne Robinet"
> <[email protected]>:
> > > > >
> > > > > I just cloned the rel/0.6 branch from git, until now
> I didn't change anything.
> > > > > Regards,,
> > > > > Etienne
> > > > >
> > > > > On 2020/02/18 11:10:39, Julian Feinauer
> <[email protected]> wrote:
> > > > > > Did you post your code somewhere? I cant find it..
> just post it somewhere and I will have a look!
> > > > > >
> > > > > > Julian
> > > > > >
> > > > > > Am 18.02.20, 11:28 schrieb "Etienne Robinet"
> <[email protected]>:
> > > > > >
> > > > > > Hi Julian,
> > > > > > thanks for the advice, but where should I
> change the code to apply your modification? Is it in the doStart() methode of
> de PLC4XConsumer?
> > > > > > Regards,
> > > > > >
> > > > > > Etienne
> > > > > >
> > > > > > On 2020/02/18 08:55:22, Julian Feinauer
> <[email protected]> wrote:
> > > > > > > Hi Etienne,
> > > > > > >
> > > > > > > thank you for your investigation.
> > > > > > > I just locked at your log and it seems that
> connection works fine and some messages are exchanged BUT you try to
> subscribe to a Value which is currently not supported.
> > > > > > > Try to just use the
> "readRequestBuilder().addItem("", "").build().execute().get()" approach to
> send a single request, that should work.
> > > > > > >
> > > > > > > Best
> > > > > > > Julian
> > > > > > >
> > > > > > > Am 18.02.20, 09:39 schrieb "Etienne Robinet"
> <[email protected]>:
> > > > > > >
> > > > > > > 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]>*
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> >
>
>
>