I'd like to use WBEM Services to build a prototipe for tha MAIS research project. (I'm using 0.95)
I try to use client API to crete instances but I cannot create Instaces of association class, I think I haven't understand something.
This is a part of my code:
...
CIMInstance transientInstance1 = protEndPointClass.newInstance();
transientInstance1.setProperty("Name",new CIMValue("135.175.20.22"));
transientInstance1.setProperty("NameFormat", new CIMValue("Ipv4"));
...
CIMObjectPath savedOp1 = tep.client.createInstance(transientInstance1.getObjectPath(), transientInstance1);
...
So for the second Object(ProtocolEndPoint):
...
transientInstance2.setProperty("Name",new CIMValue("135.175.20.21"));
transientInstance2.setProperty("NameFormat", new CIMValue("Ipv4"));
...
CIMObjectPath savedOp2 = tep.client.createInstance(transientInstance2.getObjectPath(), transientInstance2);
Now I try to create an instance of association class (ActiveConnection)
...
CIMInstance acInstance = acClass.newInstance();
CIMValue cmv1 = new CIMValue(savedOp2,acInstance.getProperty("Antecedent").getType());
acInstance.setProperty("Antecedent",cmv1);
CIMValue cmv2 = new CIMValue(savedOp1,acInstance.getProperty("Dependent").getType());
acInstance.setProperty("Dependent", cmv2);
acInstance.setProperty("TrafficType", new CIMValue("2"));
// The follow throw an Exception
CIMObjectPath savedOp4 = tep.client.createInstance(acInstance.getObjectPath(), acInstance);
At the step above I got a problem, An exception is thrown but I can udestand Why!!!
The StackTrace of this is the follow (it is too long):
[java] java.lang.NullPointerException
[java] at com.sun.wbem.cimom.CIMOMImpl.csInstance(CIMOMImpl.java:1377)
[java] at com.sun.wbem.cimom.CIMOMImpl.intaddCIMElement(CIMOMImpl.java:1385)
[java] at com.sun.wbem.cimom.CIMOMImpl.createInstance(CIMOMImpl.java:1411)
[java] at com.sun.wbem.cimom.adapters.client.rmi.CIMOMRMIImpl.createInstance(CIMOMRMIImpl.java:410)
[java] at com.sun.wbem.cimom.adapters.client.rmi.CIMOM_1Impl.createInstance(CIMOM_1Impl.java:163)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
[java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
[java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
[java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
[java] at java.lang.Thread.run(Thread.java:536)
[java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
[java] at com.sun.wbem.cimom.adapters.client.rmi.CIMOM_1Impl_Stub.createInstance(Unknown Source)
[java] at com.sun.wbem.client.adapter.rmi.RMIJavaxClient.createInstance(RMIJavaxClient.java:721)
[java] at com.sun.wbem.client.adapter.rmi.CIMClientRMI.createInstance(CIMClientRMI.java:437)
[java] at javax.wbem.client.CIMClient.createInstance(CIMClient.java:2111)
[java] at TestEndPoint.main(TestEndPoint.java:140)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd like to use WBEM Services to build a prototipe for tha MAIS research project. (I'm using 0.95)
I try to use client API to crete instances but I cannot create Instaces of association class, I think I haven't understand something.
This is a part of my code:
...
CIMInstance transientInstance1 = protEndPointClass.newInstance();
transientInstance1.setProperty("Name",new CIMValue("135.175.20.22"));
transientInstance1.setProperty("NameFormat", new CIMValue("Ipv4"));
...
CIMObjectPath savedOp1 = tep.client.createInstance(transientInstance1.getObjectPath(), transientInstance1);
...
So for the second Object(ProtocolEndPoint):
...
transientInstance2.setProperty("Name",new CIMValue("135.175.20.21"));
transientInstance2.setProperty("NameFormat", new CIMValue("Ipv4"));
...
CIMObjectPath savedOp2 = tep.client.createInstance(transientInstance2.getObjectPath(), transientInstance2);
Now I try to create an instance of association class (ActiveConnection)
...
CIMInstance acInstance = acClass.newInstance();
CIMValue cmv1 = new CIMValue(savedOp2,acInstance.getProperty("Antecedent").getType());
acInstance.setProperty("Antecedent",cmv1);
CIMValue cmv2 = new CIMValue(savedOp1,acInstance.getProperty("Dependent").getType());
acInstance.setProperty("Dependent", cmv2);
acInstance.setProperty("TrafficType", new CIMValue("2"));
// The follow throw an Exception
CIMObjectPath savedOp4 = tep.client.createInstance(acInstance.getObjectPath(), acInstance);
At the step above I got a problem, An exception is thrown but I can udestand Why!!!
The StackTrace of this is the follow (it is too long):
[java] java.lang.NullPointerException
[java] at com.sun.wbem.cimom.CIMOMImpl.csInstance(CIMOMImpl.java:1377)
[java] at com.sun.wbem.cimom.CIMOMImpl.intaddCIMElement(CIMOMImpl.java:1385)
[java] at com.sun.wbem.cimom.CIMOMImpl.createInstance(CIMOMImpl.java:1411)
[java] at com.sun.wbem.cimom.adapters.client.rmi.CIMOMRMIImpl.createInstance(CIMOMRMIImpl.java:410)
[java] at com.sun.wbem.cimom.adapters.client.rmi.CIMOM_1Impl.createInstance(CIMOM_1Impl.java:163)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
[java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
[java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
[java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
[java] at java.lang.Thread.run(Thread.java:536)
[java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
[java] at com.sun.wbem.cimom.adapters.client.rmi.CIMOM_1Impl_Stub.createInstance(Unknown Source)
[java] at com.sun.wbem.client.adapter.rmi.RMIJavaxClient.createInstance(RMIJavaxClient.java:721)
[java] at com.sun.wbem.client.adapter.rmi.CIMClientRMI.createInstance(CIMClientRMI.java:437)
[java] at javax.wbem.client.CIMClient.createInstance(CIMClient.java:2111)
[java] at TestEndPoint.main(TestEndPoint.java:140)
i dont know either