<?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[java.lang.String cannot be cast to org.netxms.client.objects.configs.CustomAttri]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I updated my netxms and nxshell version (2.2.15 =&gt; 3.1)</p>
<p dir="auto">An attribute creation script doesn't work anymore.<br />
Can you help it?</p>
<pre><code>import csv, sys
from java.util import HashMap
...
...
        MAT = s.findObjectByName(MATname)
        if MAT :
            MATId = MAT.getObjectId()
            md = NXCObjectModificationData(MATId)
            MODIF = HashMap()
            MODIF.put("UR1location", Location)
            md.setCustomAttributes(MODIF)
            session.modifyObject(md)
            w.writerow([
                MAT.getObjectId(),
                MAT.getObjectName(),
                MAT.getCustomAttributes(),
                ])
</code></pre>
<p dir="auto">I'm getting the next error:</p>
<pre><code>Traceback (most recent call last):
  File "/data/infra/scripts/NetXMS/Custom-Attributes_UR1location.py", line 27, in &lt;module&gt;
    session.modifyObject(md)
	at org.netxms.client.NXCSession.modifyObject(NXCSession.java:5152)
	at org.netxms.client.NXCSession.modifyObject(NXCSession.java:5691)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
java.lang.ClassCastException: java.lang.ClassCastException: java.lang.String cannot be cast to org.netxms.client.objects.configs.CustomAttribute
</code></pre>
<p dir="auto">Thank's</p>
]]></description><link>https://forum.netxms.org/topic/6421/java.lang.string-cannot-be-cast-to-org.netxms.client.objects.configs.customattri</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 10:39:22 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/6421.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Feb 2020 15:16:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to java.lang.String cannot be cast to org.netxms.client.objects.configs.CustomAttri on Fri, 28 Feb 2020 11:44:48 GMT]]></title><description><![CDATA[<p dir="auto">Sorry, I'm really a newbie (I think you can tell), I'm taking over someone's job...</p>
<p dir="auto">The "Snmp Location KO" card just didn't exist.<br />
After create it, it's ok.</p>
<p dir="auto">Many thanks.</p>
<p dir="auto">Best regards,<br />
BB</p>
]]></description><link>https://forum.netxms.org/post/27472</link><guid isPermaLink="true">https://forum.netxms.org/post/27472</guid><dc:creator><![CDATA[BigBlue]]></dc:creator><pubDate>Fri, 28 Feb 2020 11:44:48 GMT</pubDate></item><item><title><![CDATA[Reply to java.lang.String cannot be cast to org.netxms.client.objects.configs.CustomAttri on Fri, 28 Feb 2020 09:46:05 GMT]]></title><description><![CDATA[<p dir="auto">Are you sure that findObjectByName didn't fail? Try to check return value for None before using it for getObjectId.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/27469</link><guid isPermaLink="true">https://forum.netxms.org/post/27469</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 28 Feb 2020 09:46:05 GMT</pubDate></item><item><title><![CDATA[Reply to java.lang.String cannot be cast to org.netxms.client.objects.configs.CustomAttri on Fri, 28 Feb 2020 09:15:12 GMT]]></title><description><![CDATA[<p dir="auto">It's working great!<br />
Thank a lot.</p>
<p dir="auto">I have other problems when creating maps...</p>
<pre><code>Seed = s.findObjectByName("NameOfMySeed")
SeedId = Seed.getObjectId()

NetworkMaps = s.findObjectByName("Network Maps")
NetworkMapsId = NetworkMaps.getObjectId()

SnmpLocationKO = s.findObjectByName("Snmp Location KO")
SnmpLocationKOId = SnmpLocationKO.getObjectId()
</code></pre>
<p dir="auto">I have this error:</p>
<pre><code>Traceback (most recent call last):
  File "/data/infra/scripts/NetXMS/Creation-de-map_ALL.py", line 27, in &lt;module&gt;
    SnmpLocationKOId = SnmpLocationKO.getObjectId()
AttributeError: 'NoneType' object has no attribute 'getObjectId'
</code></pre>
<p dir="auto">Can you help me again?</p>
<p dir="auto">Thank you<br />
BB</p>
]]></description><link>https://forum.netxms.org/post/27468</link><guid isPermaLink="true">https://forum.netxms.org/post/27468</guid><dc:creator><![CDATA[BigBlue]]></dc:creator><pubDate>Fri, 28 Feb 2020 09:15:12 GMT</pubDate></item><item><title><![CDATA[Reply to java.lang.String cannot be cast to org.netxms.client.objects.configs.CustomAttri on Thu, 27 Feb 2020 15:54:30 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">setCustomAttributes methos now expects Map&lt;String, CustomAttribute&gt; instead of Map&lt;String, String&gt;. Try to replace line</p>
<p dir="auto">MODIF.put("UR1location", Location)</p>
<p dir="auto">with</p>
<p dir="auto">MODIF.put("UR1location", CustomAttribute(Location, 0, 0))</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/27461</link><guid isPermaLink="true">https://forum.netxms.org/post/27461</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 27 Feb 2020 15:54:30 GMT</pubDate></item></channel></rss>