<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problems with start BACnet4j (java.lang.ClassNotFoundException)]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I am new to Bacnet4j.<br />
I just trying to start the BacnetTest example in Netbeans but I get an exception.<br />
Can anybody give me hint what it could be the problem?</p>
<p dir="auto">Here is the output I get from Netbeans</p>
<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils
	at com.serotonin.bacnet4j.obj.BACnetObject.setPropertyImpl(BACnetObject.java:269)
	at com.serotonin.bacnet4j.obj.BACnetObject.setProperty(BACnetObject.java:193)
	at com.serotonin.bacnet4j.obj.BACnetObject.&lt;init&gt;(BACnetObject.java:88)
	at com.serotonin.bacnet4j.LocalDevice.&lt;init&gt;(LocalDevice.java:118)
	at bacnettest.BacnetTest.main(BacnetTest.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.ObjectUtils
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 5 more
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
</code></pre>
<p dir="auto">the original Code from infiniteautomation/BACnet4J</p>
<pre><code>
import java.util.List;
import com.serotonin.bacnet4j.LocalDevice;
import com.serotonin.bacnet4j.RemoteDevice;
import com.serotonin.bacnet4j.event.DeviceEventAdapter;
import com.serotonin.bacnet4j.exception.BACnetException;
import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;
import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;
import com.serotonin.bacnet4j.service.unconfirmed.WhoIsRequest;
import com.serotonin.bacnet4j.transport.Transport;
import com.serotonin.bacnet4j.type.constructed.SequenceOf;
import com.serotonin.bacnet4j.type.constructed.ServicesSupported;
import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;
import com.serotonin.bacnet4j.type.enumerated.Segmentation;
import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
import com.serotonin.bacnet4j.type.primitive.UnsignedInteger;
import com.serotonin.bacnet4j.util.RequestUtils;
public class BacnetTest {
static LocalDevice localDevice;
public static void main(String[] args) throws Exception {
IpNetwork network = new IpNetwork();
Transport transport = new Transport(network);
// transport.setTimeout(15000);
// transport.setSegTimeout(15000);
localDevice = new LocalDevice(1234, transport);
try {
localDevice.initialize();
localDevice.getEventHandler().addListener(new Listener());
localDevice.sendGlobalBroadcast(new WhoIsRequest());
Thread.sleep(200000);
}
finally {
localDevice.terminate();
}
}
static class Listener extends DeviceEventAdapter {
@Override
public void iAmReceived(final RemoteDevice d) {
System.out.println("IAm received from " + d);
System.out.println("Segmentation: " + d.getSegmentationSupported());
d.setSegmentationSupported(Segmentation.noSegmentation);
new Thread(new Runnable() {
@Override
public void run() {
try {
getExtendedDeviceInformation(d);
System.out.println("Done getting extended information");
List oids = ((SequenceOf) RequestUtils.sendReadPropertyAllowNull(localDevice, d,
d.getObjectIdentifier(), PropertyIdentifier.objectList)).getValues();
System.out.println(oids);
}
catch (BACnetException e) {
e.printStackTrace();
}
}
}).start();
}
}
static void getExtendedDeviceInformation(RemoteDevice d) throws BACnetException {
ObjectIdentifier oid = d.getObjectIdentifier();
// Get the device's supported services
System.out.println("protocolServicesSupported");
ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(d, new ReadPropertyRequest(oid,
PropertyIdentifier.protocolServicesSupported));
d.setServicesSupported((ServicesSupported) ack.getValue());
System.out.println("objectName");
ack = (ReadPropertyAck) localDevice.send(d, new ReadPropertyRequest(oid, PropertyIdentifier.objectName));
d.setName(ack.getValue().toString());
System.out.println("protocolVersion");
ack = (ReadPropertyAck) localDevice.send(d, new ReadPropertyRequest(oid, PropertyIdentifier.protocolVersion));
d.setProtocolVersion((UnsignedInteger) ack.getValue());
// System.out.println("protocolRevision");
// ack = (ReadPropertyAck) localDevice.send(d, new ReadPropertyRequest(oid, PropertyIdentifier.protocolRevision));
// d.setProtocolRevision((UnsignedInteger) ack.getValue());
}
}

</code></pre>
]]></description><link>https://forum.mango-os.com/topic/1727/problems-with-start-bacnet4j-java-lang-classnotfoundexception</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 07:31:13 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1727.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Oct 2014 19:41:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problems with start BACnet4j (java.lang.ClassNotFoundException) on Mon, 13 Oct 2014 00:46:32 GMT]]></title><description><![CDATA[<p dir="auto">Thanks now it compiles :) (after i added one more jar file - seroUtils.jar).</p>
]]></description><link>https://forum.mango-os.com/post/9376</link><guid isPermaLink="true">https://forum.mango-os.com/post/9376</guid><dc:creator><![CDATA[balak1]]></dc:creator><pubDate>Mon, 13 Oct 2014 00:46:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problems with start BACnet4j (java.lang.ClassNotFoundException) on Fri, 10 Oct 2014 02:26:00 GMT]]></title><description><![CDATA[<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils  
</code></pre>
<p dir="auto">You are missing a jar file (commons-lang3-3.0.jar) in your classpath</p>
]]></description><link>https://forum.mango-os.com/post/9373</link><guid isPermaLink="true">https://forum.mango-os.com/post/9373</guid><dc:creator><![CDATA[joolz]]></dc:creator><pubDate>Fri, 10 Oct 2014 02:26:00 GMT</pubDate></item></channel></rss>