• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. Aurelien

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    A
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Aurelien

    @Aurelien

    0
    Reputation
    562
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Aurelien Unfollow Follow

    Latest posts made by Aurelien

    • RE: [SOLVED] Modbus TCP Master error

      Thanks ! :-D

      I have found the solution.

      It's necessary to add commons logging library.

      Download :
      http://commons.apache.org/proper/commons-logging/download_logging.cgi

      posted in Modbus4J general discussion
      A
      Aurelien
    • [SOLVED] Modbus TCP Master error

      Hello everybody,

      I want to use Modbus4J rather than Jamod. I use Modbus4J version 3.0.0.

      I'm trying to test the smallest possible example :

      package testModbus;
      
      import com.serotonin.modbus4j.ModbusFactory;
      import com.serotonin.modbus4j.ModbusMaster;
      import com.serotonin.modbus4j.code.DataType;
      import com.serotonin.modbus4j.ip.IpParameters;
      import com.serotonin.modbus4j.locator.BaseLocator;
      
      public class Main {
      
          public static void main(String[] args) throws Exception {
              IpParameters params = new IpParameters();
              params.setHost("localhost");
              params.setPort(502);
              
              ModbusFactory masterF = new ModbusFactory();
              
              ModbusMaster master = masterF.createTcpMaster(params, false);
              master.init();
      
              System.out.println(master.testSlaveNode(5));
      
              // Define the point locator.
              BaseLocator<Number> loc = BaseLocator.holdingRegister(1, 0, DataType.TWO_BYTE_INT_UNSIGNED);
      
              // Set the point value
              master.setValue(loc, 1800);
      
              // Get the point value
              System.out.println(master.getValue(loc));
          }
      }
      

      I have this error when I tryto execute the Java program :

      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
      	at com.serotonin.modbus4j.ip.tcp.TcpMaster.<init>(TcpMaster.java:57)
      	at com.serotonin.modbus4j.ModbusFactory.createTcpMaster(ModbusFactory.java:69)
      	at testModbus.Main.main(Main.java:18)
      Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
      	at java.net.URLClassLoader.findClass(Unknown Source)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      	... 3 more
      

      With another bigger test, the error is the same.

      I don't know where is the real problem with the code, or configuration, ... ?

      Thanks you in advance for the help :-)
      Aurélien, France

      posted in Modbus4J general discussion
      A
      Aurelien