Forum Discussion

Andrei_Avris_46's avatar
Andrei_Avris_46
Icon for Nimbostratus rankNimbostratus
Jul 20, 2012

System::ConfigSync::upload_file- Error opening file for write operations

Hi,

 

 

I'm having some issues uploading a file to the BigIP. I use Java and here's a rough code sample of what I'm trying to do:

 

 

Interfaces interfaces = new Interfaces();

 

interfaces.initialize([address], [username], [password]);

 

 

SystemConfigSyncBindingStub stub = interfaces.getSystemConfigSync();

 

 

SystemConfigSyncFileTransferContext fileTransferContext = new SystemConfigSyncFileTransferContext();

 

 

fileTransferContext.setChain_type(CommonFileChainType.FILE_FIRST_AND_LAST);

 

 

File inputFile = new File("D:\\testing.txt");

 

byte[] fileData = new byte[(int)inputFile.length()];

 

FileInputStream str = null;

 

try {

 

str = new FileInputStream(inputFile);

 

str.read(fileData);

 

fileTransferContext.setFile_data(fileData);

 

} finally {

 

if(str != null) {

 

try {

 

str.close();

 

} catch(IOException ioe) {}

 

}

 

}

 

stub.upload_file("/home/[my_user]/test/testing.txt", fileTransferContext);

 

 

In this example I use a file with only a few characters inside so one chunk is enough.

 

Each time I run this code, I get the error:

 

 

Exception caught in System::urn:iControl:System/ConfigSync::upload_file()

 

Exception: Common::OperationFailed

 

primary_error_code : 16908289 (0x01020001)

 

secondary_error_code : 0

 

error_string : Error opening file for write operations

 

 

If I call other methods like upload_configuration() or get_version() they work fine.

 

 

I also tried using the iControlIntermediary like so:

 

 

ConfigSync configSync = new ConfigSync([username], [password], [bigip]);

 

configSync.uploadFile("D:\\testing.txt", "/home/[my_user]/test/testing.txt");

 

 

 

With this code however I get a: (401)F5 Authorization Required error.

 

 

We are using a BIG-IP version 9.4.7

 

My account role is Administrator and my terminal access is: Advanced shell.

 

 

Any help would really be appreciated as I have no idea what could be wrong.

 

 

Thank you in advance.