[SalesForce] access denied error in command line data loader

I am getting below error.Please suggest me how to resolve below error.I am pasting error log below

2016-01-05 10:59:17,448 INFO  [main] support.DefaultListableBeanFactory preInsta
ntiateSingletons (DefaultListableBeanFactory.java:557) - Pre-instantiating singl
etons in org.springframework.beans.factory.support.DefaultListableBeanFactory@11
ca803: defining beans [accountMasterProcess,opportunityUpsertProcess,databaseAcc
ountExtractProcess,csvAccountExtractProcess]; root of factory hierarchy
2016-01-05 10:59:17,542 INFO  [databaseAccountExtract] controller.Controller ini
tConfig (Controller.java:327) - config dir created at C:\Program Files (x86)\sal
esforce.com\Data Loader\samples\conf
2016-01-05 10:59:17,573 FATAL [databaseAccountExtract] process.ProcessRunner top
LevelError (ProcessRunner.java:238) - Unable to run process databaseAccountExtra
ct
java.lang.RuntimeException: com.salesforce.dataloader.exception.ControllerInitia
lizationException: java.io.IOException: Access is denied
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:112)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:100)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:253)
Caused by: com.salesforce.dataloader.exception.ControllerInitializationException
: java.io.IOException: Access is denied
        at com.salesforce.dataloader.controller.Controller.initConfig(Controller
.java:340)
        at com.salesforce.dataloader.controller.Controller.<init>(Controller.jav
a:110)
        at com.salesforce.dataloader.controller.Controller.getInstance(Controlle
r.java:212)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.jav
a:110)
        ... 2 more
Caused by: java.io.IOException: Access is denied
        at java.io.WinNTFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(Unknown Source)
        at com.salesforce.dataloader.controller.Controller.initConfig(Controller
.java:335)
        ... 5 more

process-conf.xml:

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="accountExport"
            class="com.salesforce.dataloader.process.ProcessRunner"
            singleton="false">
            <description>accountExport job export the account record to the CSV file</description>
            <property name="name" value="accountExport"/>
            <property name="configOverrideMap">
            <map>
                <entry key="sfdc.debugMessages" value="true"/>
                <entry key="sfdc.debugMessagesFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\accountUpsertSoapTrace.log"/>
                <entry key="sfdc.endpoint" value="https://test.salesforce.com"/>
                <entry key="sfdc.username" value="bijesh.kumar@wipro.com.lsdev"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="1c848ded92f4a5d0db429f3e2f02fa51fe794546cb73383c7b319e4ece8cc7a0289e74e73ff052d2"/>
                <entry key="process.encryptionKeyFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="5"/>

                <entry key="process.operation" value="extract"/>
                <entry key="dataAccess.type" value="csvWrite" />
                <entry key="dataAccess.writeUTF8" value="true" />               
                <entry key="dataAccess.writeBatchSize" value="1" /> 
                <entry key="sfdc.extractionRequestSize" value="1" /> 
                <entry key="process.enableExtractSuccessOutput" value="true" /> 

                <entry key="process.outputError" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\ERRORaccount.csv" /> 

                <entry key="dataAccess.name" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\accountExport.csv" /> 
                <entry key="sfdc.entity" value="Account"/>
                <entry key="sfdc.extractionSOQL" value="Select Id,Name FROM Account" />
            </map>
            </property>
    </bean>
</beans>

Below directories and folder has already been created.

<entry key="sfdc.debugMessagesFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\accountUpsertSoapTrace.log"/>
            <entry key="process.encryptionKeyFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\key.txt"/>
            <entry key="process.outputError" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\ERRORaccount.csv" /> 
            <entry key="dataAccess.name" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\accountExport.csv" />

Best Answer

Here is the root cause

Caused by: java.io.IOException: Access is denied
        at java.io.WinNTFileSystem.createFileExclusively(Native Method)

Below is a quote from another SO answer which covers your situation

The problem is that a file can't be created unless the entire containing path already exists - its immediate parent directory and all parents above it.

If you have a path c:\Temp and no subdirectories below it, and you try to create a file called c:\Temp\SubDir\myfile.txt, that will fail because C:\Temp\SubDir doesn't exist.

In other words - your data loader config references a local file system path which does not exist.

Another reason for the error like this could be related to the fact that Data Loader can not write into the files you specified. Not sure what is your local MS Windows setup is, but folders like "C:\Program Files (x86)" usually require admin password to write into. Try changing all output files to a location where password is not required, e.g. c:\temp or something.

Related Topic