<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="font-family: Times; "><pre><span class="Apple-style-span" style="font-family: Times; white-space: normal; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">Hi,</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">I came across the same problem: Domain.getSchedulerParameters() throws a NullPointerException systematically.</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><br></pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><span class="Apple-style-span" style="font-family: Times; white-space: normal; "> </span></pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">getSchedulerParameters</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">The culprit is the org.libvirt.jna.virSchedParameterValue class which should inherit from jna.Union instead of Structure:</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><span class="Apple-tab-span" style="white-space:pre"> </span>public class virSchedParameterValue extends Union { </pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><span class="Apple-tab-span" style="white-space:pre"> </span>...</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "> <span class="Apple-tab-span" style="white-space:pre"> </span>} <br></pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><br></pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">Regards,</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">Frederic</pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><br></pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "><br></pre><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">On 12/14/2009 04:22 AM, Marc Gonzalez Mateo wrote:
</pre><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">OK, let's see if Bryan has an idea/solution about this.
Thanks guys!
MARC
El 11/12/2009, a las 14:29, Daniel Veillard escribió:
</pre><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">On Fri, Dec 11, 2009 at 02:01:36PM +0100, Marc Gonzalez Mateo wrote:
</pre><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; position: static; z-index: auto; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">Hi everyvody,
I'm developing a new API based on libvirt.
I'm currently stucked using getSchedulerParameters, always is returning a
nullpointerexception, no matter which Xen Domain I'm passing to the
function.
Enclosing both the code and the error console:
public int getCPUPriority(String name) {
int res=-1;
try {
Domain d = getDomain(name);
SchedParameter[] pars = d.getSchedulerParameters();
</pre></blockquote><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "> Hum, it seems
Domain.getSchedulerParameters()
does
SchedParameter[] returnValue = new SchedParameter[0];
and
public static SchedParameter create(virSchedParameter vParam) {
SchedParameter returnValue = null;
switch (vParam.type) {
case (1):
and the create method getting there gets a null pointer as the
initialization argument, which it first dereference ...
so not surprizing looking at the code, maybe Bryan has an idea of what
is going on there, I'm a bit lost in this initialization process ...
Daniel
</pre><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "> for (SchedParameter pri : pars) {
if (pri.field=="weight")
res=Integer.parseInt(pri.getValueAsString());
}
} catch (LibvirtException e) {
log.error(" Error: getting CPU priority of \""+name+"\"." +
e.getClass());
e.printStackTrace();
}
return res;
}
Dec 11, 2009 1:04:18 PM net.emotivecloud.virtmonitor.VirtMonitor
getCPUCapacity
SEVERE: Error: getting CPU capacity of "XenTest".
java.lang.NullPointerException
at org.libvirt.SchedParameter.create(Unknown Source)
at org.libvirt.Domain.getSchedulerParameters(Unknown Source)
at
net.emotivecloud.virtmonitor.VirtMonitor.getCPUCapacity(VirtMonitor.java:462)
at net.emotivecloud.virtmonitor.VirtMonitor.main(VirtMonitor.java:763)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
at java.lang.Thread.run(Thread.java:636)
Any ideas?
Thanks in advance,
Marc Gonzalez Mateo
</pre></blockquote><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "></pre><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">--
Libvir-list mailing list
Libvir-list redhat com
<a rel="nofollow" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a>
</pre></blockquote><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; ">
--
Daniel Veillard | libxml Gnome XML XSLT toolkit <a rel="nofollow" href="http://xmlsoft.org/">http://xmlsoft.org/</a>
daniel veillard com | Rpmfind RPM search engine <a rel="nofollow" href="http://rpmfind.net/">http://rpmfind.net/</a>
<a rel="nofollow" href="http://veillard.com/">http://veillard.com/</a> | virtualization library <a rel="nofollow" href="http://libvirt.org/">http://libvirt.org/</a>
</pre></blockquote><pre style="margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "></pre></blockquote></span></pre><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "><blockquote style="border-left-color: rgb(85, 85, 238); border-left-style: solid; border-left-width: 0.2em; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; padding-left: 0.85em; "></blockquote></blockquote></blockquote></span><div><br></div></div><div><br></div><div><span class="Apple-style-span" style="font-size: 12px; "><div><span class="Apple-style-span" style="font-size: medium;">Frederic Dang Tran</span></div></span><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></body></html>