Hi Chris,

Thank you very much for your help, really really appreciated.


In fact, we are evaluating PLC4X for one of our next big project.

I'm currently, just trying to make a "proof of concept".


Unfortunatly, I'm not a Java expert [☹] . Sorry, for my lack of knowledge...

We usually use C# (.net Core) as our main language, some Go (MicroServices),  
Flutter for our Mobile apps and TypeScript (Angular) for Web)




The project consist of this (1 java file):


package PLC4XTest;

import org.apache.plc4x.java.PlcDriverManager;
import org.apache.plc4x.java.api.PlcConnection;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;

public class App {
    public static void main(String[] args) throws PlcConnectionException {
        PlcDriverManager driver = new PlcDriverManager();

        try {
            PlcConnection connection = driver.getConnection("ads:tcp://...");  
//address hidden on purpose
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

And the entire pom.xml file: (

NOTE: I changed the version as suggested)


<?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>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</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>plc4j-api</artifactId>
      <version>0.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-protocol-ads</artifactId>
      <version>0.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-driver-s7</artifactId>
      <version>0.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-driver-opcua</artifactId>
      <version>0.6.0</version>
    </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>



Hope it gives you more info, and leas take my sincere thank you for you help.



Patrick Boisclair
Analyste - Programmeur senior / Senior Analyst Programmer

[cid:imageb437c6.PNG@ba18e707.4cabefa1]<https://www.noovelia.com>


462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA
noovelia.com<https://www.noovelia.com>

"Veuillez noter ma nouvelle adresse courriel. / Please note my new email 
address."
________________________________
De : Christofer Dutz <christofer.d...@c-ware.de>
Envoyé : 11 août 2020 02:59
À : dev@plc4x.apache.org
Objet : Re: plc4j-protocol-ads not registering

Hi Patrick,

first of all welcome here on our list. We will do our best to assist you.

I did notice a few things:

  *   You are using the API in version 0.6.0 but the drivers in 0.5.0 … I would 
strongly suggest not to mix versions
  *   The drivers you are using are in version 0.5.0 … I would suggest to 
update to version 0.6.0 as the 0.7.0 or 0.8.0-SNAPSHOT version don’t have ADS 
support yet

Are you using any form of “Fat-Jar” or shaded archive approach? Cause we have 
seen this behavior in these cases. The problem is that every driver has a 
property file in “META-INF/services” … each lists only the driver the module 
provides. So in case of the default settings the plugins for creating the fat 
jars just take one of these property files and skips the rest. You can however 
configure it to merge the content. For an example on this please see the 
examples pom.xml

<!-- Build a fat jar containing all dependencies -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-uber-jar</id>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <transformers combine.children="append">
          <transformer 
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
            <mainClass>${app.main.class}</mainClass>
          </transformer>
        </transformers>
      </configuration>
    </execution>
  </executions>
</plugin>

Hope that helps, if not … just come back and we’ll try to help you.


Chris









Von: Patrick Boisclair <pboiscl...@noovelia.com>
Antworten an: "dev@plc4x.apache.org" <dev@plc4x.apache.org>
Datum: Montag, 10. August 2020 um 20:15
An: "dev@plc4x.apache.org" <dev@plc4x.apache.org>
Betreff: plc4j-protocol-ads not registering


Hi,



I do have a question about "Ads (Beckhoff) protocol".



Im using S7 and OPCUA, and both are registering in the available drivers.

However, the ads one is not.



Here is my dependecies:


    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-api</artifactId>
      <version>0.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-protocol-ads</artifactId>
      <version>0.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-driver-s7</artifactId>
      <version>0.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.plc4x</groupId>
      <artifactId>plc4j-driver-opcua</artifactId>
      <version>0.5.0</version>
    </dependency>


Here is the error:


main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC 
Driver Manager with class loader 
jdk.internal.loader.ClassLoaders$AppClassLoader@30946e09
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available 
drivers...
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for 
Protocol s7 (Siemens S7 (Basic))
[main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver for 
Protocol opcua (OPC UA (TCP))
org.apache.plc4x.java.api.exceptions.PlcConnectionException: Unable to find 
driver for protocol 'ads'
        at 
org.apache.plc4x.java.PlcDriverManager.getDriver(PlcDriverManager.java:98)
        at 
org.apache.plc4x.java.PlcDriverManager.getConnection(PlcDriverManager.java:71)
        at PLC4XTest.App.main(App.java:12)


I don't know what I'm doing wrong for the ADS protocols, the other register 
just fine.



Can anyone help me pls ?



Thank you very much and best regards

Patrick Boisclair
Analyste - Programmeur senior / Senior Analyst Programmer

[cid:imagedccd7c.PNG@445fc9be.47b6fee8]<https://www.noovelia.com/>


462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA
noovelia.com<https://www.noovelia.com>
[https://www.noovelia.com/_media/image/332/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."

Reply via email to