Ive been trying to re create the code Under the README for the gurux.dlms.client.example.java/
but I can't get the code compiled. I've never used Github before either so maybe 'm looking in the wrong place or overlooking a download for the source files.
I'm just trying to establish a connection to my meter and then read data from it. I've already connected to the meter using GXDLMSDirector but I want to get that data automatically every half hour. Any suggestions or can you possibly point me in the right direction please.
I'm using NetBeans but I tried to build it as a Java SE application.
do I need to install Maven using NetBeans or is it already built in.
Should I instead try to compile it as a Java Application using Maven?
I Have NetBeans and I've got maven installed. I have gurux.dlms-4.0.26.jar as a dependency and can import GXDLMSClient into my code. I'm trying to follow the example code on http://www.gurux.fi/Gurux.DLMS.Client but can't get it to compile. the readDLMSPacket method is giving me problems and its being used in quite a lot of operations. do you maybe have some insight on what I'm doing wrong. For a few days now I just cannot get the code compiled.
I've done this and that's why I am confused because it still is not compiling. after running mvn clean package is when I can see the.jar under dependencies in the projects tree view of netBeans. With this I'm assuming that it was compiled but I'm in the same place as when I just manually imported the jar life as a library without using maven. Is there maybe a complete piece of code that returns something when run just so I can test whether or not everything (maven and netbeans) is working as its supposed to
I just test this with the clean PC. I installed Java and Eclipse 12.4. Then Selected "Open Project" and selected folder where gurux.dlms.client.example.java is. It seems that the maven plugin is not needed anymore.
Then I selected "Clean and Build". Everything worked without problems or errors.
There's no errors in the code or anything and when I build it using command line there's no problems.
I'm getting Plugin (Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved) when i say clean and build in netbeans . even if I create a new Maven project I get the same Issue Is it maybe an issue with how I've installed maven?
HI,
I was using an old netbeans the last one oracle released I uninstalled it and installed the latest version of Apache netbeans and I can compile fine but now there's an error when i run sampleclient.java (Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0) is this still the IDE is it possibly that i have 2 mavens installed one externally installed and one that is installed by default with the IDE.
Ive devcided to use eclipse and now there's no issues .Another question, when I run sampleclient in gurux.dlms.client.example whats supposed to happen all I see is the Settings.showhelp() output . Where do i set my parameters I thought maybe in the console but after running the program terminates.
If you are running an application from the eclipse you can set correct parameters when you select "Debug As" and "Debug Parameters" from the pop-up menu.
I can run it now but all I see is communication Logs, I'm assuming its taking long because its reading the association view. is it possible for me to just get a value from a certain logical or short name to save time? Sorry for all the questions I'm very new to how smart meters work and this protocol seems very complex.
also i get a few errors in the console when running but they're all the same.
(Aug 03, 2021 12:11:35 PM gurux.dlms.GXDLMSClient parseLNObjects INFO: Unknown object : 10056 0.1.240.6.0.255)
is this just an item that is not in my meters association view?
Unknown object means that this is manufacturer specific object and it's not defined in DLMS standard. The structure and the meaning of the object are unknown.
You can read values without reading the association view. Comment association view (or save it to the file) and add objects what you want to read. You need to know the object type and logical name.
You can save the association view using -o parameter.
Does the -o parameter write data about the association view into a xml file that is then read by GXDLMSObjectCollection? I'm getting an exception (ParseError at [row,col]:[1,1]).
and because of this another exception is triggered saying premature end of file. My file that I point to using the -o parameter is empty, is this the cause?
I think I'm missing something here. the file that the -o parameter is pointing to is not supposed to be empty right? Meaning I should copy the data of the association view into there but how do I do that.
or am I completely misunderstanding what the purpose of that -o parameter is.
-o will save and load the association view to the file, so you don't need to read it from the meter. It makes reading much faster. Something like this:
I've tried everything with my arguments to try and get just one item instead of the association view.
is there maybe a way to save the association view to an XML file using GXDLMSDirector and then I can just point to that file using -o in eclipse?
I notest that association view is not read again if association file is corrupted. This is now fixed. Get the latest version from the client example and try again.
Hi,
Hi,
You didn't tell what compiler you are using, but if you are using Eclipse, you need to select "Import" and then "Existing Maven Project".
You need to install maven before you can build this.
BR,
Mikko
My apologies.
My apologies.
I'm using NetBeans but I tried to build it as a Java SE application.
do I need to install Maven using NetBeans or is it already built in.
Should I instead try to compile it as a Java Application using Maven?
Hi,
Hi,
No problems. I haven't use NetBeans for a while, but if I remember right you need to install the plugin for maven to NetBeans.
BR,
Mikko
Hi,
Hi,
I Have NetBeans and I've got maven installed. I have gurux.dlms-4.0.26.jar as a dependency and can import GXDLMSClient into my code. I'm trying to follow the example code on http://www.gurux.fi/Gurux.DLMS.Client but can't get it to compile. the readDLMSPacket method is giving me problems and its being used in quite a lot of operations. do you maybe have some insight on what I'm doing wrong. For a few days now I just cannot get the code compiled.
Hi,
Hi,
Run this:
mvn clean package
It will download all needed packages and build the project. There are also other dependencies than gurux.dlms.
BR,
Mikko
Hi Mikko,
Hi Mikko,
I've done this and that's why I am confused because it still is not compiling. after running mvn clean package is when I can see the.jar under dependencies in the projects tree view of netBeans. With this I'm assuming that it was compiled but I'm in the same place as when I just manually imported the jar life as a library without using maven. Is there maybe a complete piece of code that returns something when run just so I can test whether or not everything (maven and netbeans) is working as its supposed to
Hi,
Hi,
I just test this with the clean PC. I installed Java and Eclipse 12.4. Then Selected "Open Project" and selected folder where gurux.dlms.client.example.java is. It seems that the maven plugin is not needed anymore.
Then I selected "Clean and Build". Everything worked without problems or errors.
What is the error that you are receiving?
BR,
Mikko
HI,
HI,
There's no errors in the code or anything and when I build it using command line there's no problems.
I'm getting Plugin (Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved) when i say clean and build in netbeans . even if I create a new Maven project I get the same Issue Is it maybe an issue with how I've installed maven?
Hi,
Hi,
This is maven issue. Can you un-install Netbeans and then install the latest version? Maybe it helps?`
BR,
Mikko
HI,
HI,
I was using an old netbeans the last one oracle released I uninstalled it and installed the latest version of Apache netbeans and I can compile fine but now there's an error when i run sampleclient.java (Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0) is this still the IDE is it possibly that i have 2 mavens installed one externally installed and one that is installed by default with the IDE.
Hi,
Hi,
I'm sorry, but I can't help with this one. It worked without problems with a clean PC. I hope that you can solve this.
BR,
Mikko
Hi Mikko,
Hi Mikko,
Ive devcided to use eclipse and now there's no issues .Another question, when I run sampleclient in gurux.dlms.client.example whats supposed to happen all I see is the Settings.showhelp() output . Where do i set my parameters I thought maybe in the console but after running the program terminates.
Hi,
Hi,
If you are running an application from the eclipse you can set correct parameters when you select "Debug As" and "Debug Parameters" from the pop-up menu.
BR,
Mikko
Hi,
Hi,
I can run it now but all I see is communication Logs, I'm assuming its taking long because its reading the association view. is it possible for me to just get a value from a certain logical or short name to save time? Sorry for all the questions I'm very new to how smart meters work and this protocol seems very complex.
also i get a few errors in the console when running but they're all the same.
(Aug 03, 2021 12:11:35 PM gurux.dlms.GXDLMSClient parseLNObjects INFO: Unknown object : 10056 0.1.240.6.0.255)
is this just an item that is not in my meters association view?
Hi,
Hi,
Unknown object means that this is manufacturer specific object and it's not defined in DLMS standard. The structure and the meaning of the object are unknown.
You can read values without reading the association view. Comment association view (or save it to the file) and add objects what you want to read. You need to know the object type and logical name.
You can save the association view using -o parameter.
BR,
Mikko
Hi Mikko,
Hi Mikko,
Does the -o parameter write data about the association view into a xml file that is then read by GXDLMSObjectCollection? I'm getting an exception (ParseError at [row,col]:[1,1]).
and because of this another exception is triggered saying premature end of file. My file that I point to using the -o parameter is empty, is this the cause?
Hi,
Hi,
I believe that is the reason. You must give association file parameter like this:
-o out.xml
BR,
Mikko
HI,
HI,
Can the file be anywhere or must it be is the same directory as the project?
Hi,
Hi,
It can be anywhere you like if you give the path.
BR,
Mikko
Hi,
Hi,
I think I'm missing something here. the file that the -o parameter is pointing to is not supposed to be empty right? Meaning I should copy the data of the association view into there but how do I do that.
or am I completely misunderstanding what the purpose of that -o parameter is.
Hi,
Hi,
-o will save and load the association view to the file, so you don't need to read it from the meter. It makes reading much faster. Something like this:
-o association.xml
BR,
Mikko
Hi,
Hi Mikko,
I've tried everything with my arguments to try and get just one item instead of the association view.
is there maybe a way to save the association view to an XML file using GXDLMSDirector and then I can just point to that file using -o in eclipse?
Hi C dV,
Hi C dV,
I notest that association view is not read again if association file is corrupted. This is now fixed. Get the latest version from the client example and try again.
BR,
Mikko
Hi Mikko,
Hi Mikko,
The latest version fixes the problem. Thanks for the help it is very much appreciated.