Im really new to Java, really sorry !
Using maven like this (see below), I have the following error: "Missing artifact org.apache.plc4x:plc4x-parent:pom:0.8.0-SNAPSHOT" <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.noovelia.plc4xtest</groupId> <artifactId>plc4xtest</artifactId> <version>1</version> <name>plc4xtest</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4x-parent</artifactId> <version>0.8.0-SNAPSHOT</version> <type>pom</type> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.30</version> </dependency> </dependencies> <build> <pluginManagement> <!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.7.1</version> </plugin> <plugin> <artifactId>maven-project-info-reports-plugin</artifactId> <version>3.0.0</version> </plugin> </plugins> </pluginManagement> </build> </project> Patrick Boisclair Analyste - Programmeur senior / Senior Analyst Programmer [cid:image5f52f2.PNG@9f2ad524.4c9e310e]<https://www.noovelia.com> 462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA noovelia.com<https://www.noovelia.com> [cid:image587f80.PNG@0d05f877.4ab61e6b] "Veuillez noter ma nouvelle adresse courriel. / Please note my new email address." ________________________________ De : Ben Hutcheson <hutc...@apache.org> Envoyé : 4 décembre 2020 20:06 À : dev@plc4x.apache.org Objet : Re: ADS Driver: org.apache.plc4x.java.api.exceptions.PlcRuntimeException: java.util.concurrent.TimeoutException Hi Patrick, I'll offer some general PLC4X hints as I don't have any experience with the Beckoff specific stuff, in exchange for some documentation updates when you sort it out. ;) 1) Make sure you are using the latest 0.8-SNAPSHOT version and not version 0.7. 2) The line PlcReadResponse response = request.execute().get(); supports a timeout. PlcReadResponse response = request.execute().get(1000, TimeUnit.MILLISECONDS); otherwise it won't return if there is a timeout. 3) Does the error happen all the time? 4) Can you narrow down what line the error occurs? 5) Do you see any packets being sent using Wireshark? Kind Regards Ben On Fri, Dec 4, 2020 at 5:21 PM Patrick Boisclair <pboiscl...@noovelia.com> wrote: > Hello everyone, > > > Im getting this error from a connection with a Beckhoff connection (ADS). > > > org.apache.plc4x.java.api.exceptions.PlcRuntimeException: > java.util.concurrent.TimeoutException > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.getFromFuture(AdsAbstractPlcConnection.java:236) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.lambda$mapFields$3(AdsAbstractPlcConnection.java:180) > at > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.mapFields(AdsAbstractPlcConnection.java:163) > > Here is the Java code: > > > public class App { > public static void main(String[] args) throws PlcConnectionException { > PlcDriverManager driver = new PlcDriverManager(); > try { > PlcConnection connection = driver.getConnection("ads:tcp:// > 10.10.11.77/5.62.206.200.1.1:851"); > if (connection.isConnected()) { > System.out.println("CONNECTED"); > if (connection.getMetadata().canRead()) { > System.out.println("CAN READ"); > > PlcReadRequest.Builder builder = connection. > readRequestBuilder(); > builder.addItem("value-1", "MAIN.Rand_1:DINT"); > > PlcReadRequest request = builder.build(); > PlcReadResponse response = request.execute().get(); > } > } > } catch (Exception e) { > e.printStackTrace(); > } > > } > } > > > > I tried with C# and the TwinCatAds.dll from beckhoff and it works. > > > public void Open() > { > try > { > tcClient.Connect("5.62.206.200.1.1", 851); > if (tcClient.IsConnected) > { > Console.WriteLine("CONNECTED"); > > BinRead = new BinaryReader(DataStream, Encoding.ASCII); > PlcVariables[0] = tcClient.AddDeviceNotification("MAIN.Rand_1", > DataStream, 0, 1, AdsTransMode.OnChange, 100, 0, null); > > tcClient.AdsNotification += new > AdsNotificationEventHandler(OnNotification); > } > } > catch (Exception ex) > { > Console.WriteLine(ex.ToString()); > } > } > > > private void OnNotification(object sender, AdsNotificationEventArgs e) > { > string strValue = string.Empty; > e.DataStream.Position = e.Offset; > if (e.NotificationHandle == PlcVariables[0]) > { > strValue = BinRead.ReadInt16().ToString(); > } > Console.WriteLine(strValue); > } > > Im new with PLC4x and the Java world also [image: ☹] > > Can anyone points me what I miss or doing wrong ? > > > > > Patrick Boisclair > Analyste - Programmeur senior / Senior Analyst Programmer > > <https://www.noovelia.com> [https://www.noovelia.com/_media/image/342/noovelia-og-image-v2.jpg]<https://www.noovelia.com/> Noovelia - Business management software and process automation<https://www.noovelia.com/> www.noovelia.com Digitize, automate and connect your systems and equipment to increase business efficiency: optimal logistics, production and inventory management. > > > 462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA > noovelia.com <https://www.noovelia.com> [https://www.noovelia.com/_media/image/342/noovelia-og-image-v2.jpg]<https://www.noovelia.com/> Noovelia - Business management software and process automation<https://www.noovelia.com/> www.noovelia.com Digitize, automate and connect your systems and equipment to increase business efficiency: optimal logistics, production and inventory management. > > > > > *"Veuillez noter ma nouvelle adresse courriel. / Please note my new email > address." * >