Forum Discussion

myLogin_24886's avatar
myLogin_24886
Icon for Nimbostratus rankNimbostratus
Oct 16, 2007

Need help on CreateParition error....

Hi

 

 

Follwoing code throwing Null Pointer Exception when I try to run it

 

 

// Create partition

 

void createPartition() throws Exception

 

{

 

iControl.ManagementPartitionAuthZPartition partition = new

 

iControl.ManagementPartitionAuthZPartition();

 

 

partition.setDescription("Customer 1 Partition");

 

partition.setPartition_name("Customer1");

 

 

iControl.ManagementPartitionAuthZPartition[] partitions = {partition};

 

 

m_partition.create_partition(partitions);

 

System.out.println(" Partition created sucessfully ");

 

}
  • I don't see anything wrong with the code. Is the Null Pointer Exception on the client side before the SOAP request is made or it an iControl exception returned from the server in a SOAP Fault?

     

     

    A couple of questions that might have been overlooked.

     

     

    1. Is m_partition null?

     

    2. Is partitions initialized as an array with 1 dimension?

     

    3. Is partitions[0] null?

     

     

    The only one I'm not sure about is 1 as I don't see where you initialize that variable. I'd step through in a debugger and find out which line is causing the exception and then which variable is null at the point of the exception.

     

     

    -Joe
  • Thanks for pointing out. It was my mistack I didn't initilized the

     

     

    m_partition = (iControl.ManagementPartitionBindingStub)

     

    new iControl.ManagementPartitionLocator().getManagementPartitionPort(new java.net.URL(m_endpoint));

     

    it works now.
  • Great! It's funny how often it turns out the source of issues are not really what it seems...

     

     

    -Joe