function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AnzarAnzar 

ApexDataLoad 16 command line script error

Hi,

 

I'm trying to use the ApexDataloader ver 16 command line option to export data from Salesforce to File (.csv) from one of the application. But I'm getting error message "Wrong process return code".

 

The content of config.properties file is as follows:

 

     #Loader Config
     username=<username>
     password=<password+security code>
     operation=extract
     extractionSOQL=select  Id,IsDeleted,MasterRecordId,Name,Type,ParentId,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,Phone,Fax,AccountNumber,Website,Sic,Industry,AnnualRevenue,NumberOfEmployees,Ownership,TickerSymbol,Description,Rating,Site,OwnerId,CreatedDate,CreatedById,LastModifiedDate,LastModifiedById,SystemModstamp,LastActivityDate,CustomerPriority__c,SLA__c,Active__c,NumberofLocations__c,UpsellOpportunity__c,SLASerialNumber__c,SLAExpirationDate__c from Account   where Type = 'Customer - Direct'
     extractionTarget=extract.csv


My command line script is as follows:

 

 cmd.exe /c C:/PROGRA~1/salesforce.com/APEXDA~1.0/_jvm/bin/java -Dsalesforce.config.dir=C:/PROGRA~1/salesforce.com/APEXDA~1.0/conf  -jar C:/PROGRA~1/salesforce.com/APEXDA~1.0/DataLoader.jar 1>"c:/production/data/salesforce/log/sforcedataloader.log" 2>"c:/production/data/salesforce/log/sforcedataloader.error"


Can anybody help me to fix this issue, please. It's very urgent.

 

I tried to find out the solution on net, but couldn't get.

 

Please help.

Thanks in advance,

Anzar

Best Answer chosen by Admin (Salesforce Developers) 
AnzarAnzar

I discovered what the problem was.  I was using   encrypt -g <password>, so, due to that reason, I was getting this problem:

 

2010-07-27 11:01:08,227 ERROR [csvAccountExtract] config.Config decryptProperty (Config.java:645) - Error loading parameter: sfdc.password of type: java.lang.String

javax.crypto.BadPaddingException: Given final block not properly padded

 

 

Now, I have used encrypt -e <password>, so it is working fine.

 

Thanks a lot your valuable comment. 

All Answers

BylithiumBylithium

I am using this and it works fine for me.I am attaching a sample config file you can pass ur parameters and it should work for you

if it doesnt work try it without the token

 

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

    <bean

          class="com.salesforce.dataloader.process.ProcessRunner"

          singleton="false">

        <description>Extracts all current Users.</description>

        <property value="csvExportUsers"/>

        <property>

            <map>

                <entry key="sfdc.debugMessages" value="True"/>

                <entry key="sfdc.debugMessagesFile" value="Y:\salesforce.com\Apex Data Loader 18.0\ExtractLeads\csvExtract.csv"/>

                <entry key="sfdc.endpoint" value="https://test.salesforce.com/services/Soap/u/18.0"/>

                <entry key="sfdc.username" value="Username"/>

                <entry key="sfdc.password" value="Password"/>

                <entry key="sfdc.timeoutSecs" value="540"/>

                <entry key="sfdc.loadBatchSize" value="200"/>

                <entry key="sfdc.entity" value="Lead"/>

                <entry key="sfdc.extractionRequestSize" value="500"/>

                <entry key="sfdc.extractionSOQL" value="SELECT Id, FirstName, LastName FROM Lead"/>

                <entry key="process.operation" value="extract"/>

                <entry key="process.mappingFile" value="Y:\salesforce.com\Apex Data Loader 18.0\ExtractLeads\Extract.sdl"/>

                <entry key="process.outputError" value="Y:\salesforce.com\Apex Data Loader 18.0\ExtractLeads\csvError.csv"/>

                <entry key="process.outputSuccess" value="Y:\salesforce.com\Apex Data Loader 18.0\ExtractLeads\csvSuccess.csv"/>

                <entry key="process.enableExtractSuccessOutput" value="true"/>

                <entry key="dataAccess.type" value="csvWrite"/>

                <entry key="dataAccess.writeUTF8" value="true"/>

                <entry key="dataAccess.name" value="Y:\salesforce.com\Apex Data Loader 18.0\ExtractLeads\extract.csv"/> 

                <entry key="process.initialLastRunDate" value="2008-08-28T00:00:00.000-0800"/>

            </map>

        </property>

   </bean>

</beans>

 

BylithiumBylithium

process.config is an xml file and it has to be in above format

AnzarAnzar

Thanks for your reply.

 

Infact, I dont want to use process-conf.xml to set the configuration parameters. For that I need to write little bit more of java code to generate this xml file with value and my client doesn't allow to write that much code for that particular product.

 

Due to that reason I am using config.properties file for passing the parameters. We can use either process-conf.xml or config.properties to pass the parameter. Please correct me if I am wrong.

 

Could you please verify above mentioned contents of both the config.properties file and command line script.

 

Thanks in advance.

 

BylithiumBylithium
 

I am not sure how it would work. I dont see any data target or mapping in your code.

 

As per my understanding config.prop is used to cache the parameters which are repetitive..correct me if i am wrong.

AnzarAnzar

I have changed my config.properties file with the following required parameters, but still facing the same issue. I am not using the process-conf.xml. Is this necessary to use this file (process-conf.xml)? I am using only config.properties file for passing the parameters. do we start the processRunner as it is mentioned in the process-config.xml file under bean tag.

 

Content of config.properties file:

 

 #Loader Config
sfdc.debugMessages=true
sfdc.debugMessagesFile=c:/production/data/salesforce/log/sforcedataloader.log
sfdc.connectionTimeoutSecs=60
sfdc.username=<username>
password=<encrypted password>
sfdc.endpoint=https://www.salesforce.com
sfdc.loadBatchSize=200
sfdc.entity=Account
sfdc.maxRetries=3
sfdc.resetUrlOnLogin=true
process.operation=extract
sfdc.extractionRequestSize=500
sfdc.extractionSOQL=select Id,IsDeleted,MasterRecordId,Name,Type,ParentId,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,Phone,Fax,AccountNumber,Website,Sic,Industry,AnnualRevenue,NumberOfEmployees,Ownership,TickerSymbol,Description,Rating,Site,OwnerId,CreatedDate,CreatedById,LastModifiedDate,LastModifiedById,SystemModstamp,LastActivityDate,CustomerPriority__c,SLA__c,Active__c,NumberofLocations__c,UpsellOpportunity__c,SLASerialNumber__c,SLAExpirationDate__c from Account   where Type = 'Customer - Direct'
dataAccess.writeBatchSize=500
process.mappingFile=C:/Program Files/salesforce.com/Apex Data Loader 16.0/samples/conf/accountExtractMap.sdl
process.outputError=C:/production/data/salesforce/log/csvError.csv
process.outputSuccess=C:/production/data/salesforce/log/csvSuccess.csv
process.enableExtractSuccessOutput=true
dataAccess.type=csvWrite
dataAccess.name=c:/dataloader/samples/data/account-extract.csv

 

If anything more, i am missing, please advise.

 

what will be command to execute from dos command prompt? I am using following one. is this correct?

 

cmd.exe /c C:/PROGRA~1/salesforce.com/APEXDA~1.0/_jvm/bin/java -Dsalesforce.config.dir=C:/PROGRA~1/salesforce.com/APEXDA~1.0/conf  -jar C:/PROGRA~1/salesforce.com/APEXDA~1.0/DataLoader.jar 1>"c:/production/data/salesforce/log/sforcedataloader.log" 2>"c:/production/data/salesforce/log/sforcedataloader.error"

 

 

BylithiumBylithium

you need the process-config file as you would be calling the process-config file to run the process.

 

In config-prop you would caching the unchanged parameters

AnzarAnzar

Thanks for your valuable commnet!!!

 

I have provided salesforce user name & password as follows

 

    <entry key="sfdc.username" value="user name"/>
    <entry key="sfdc.password" value="encrypted password"/>
    <entry key="process.encryptionKeyFile" value="C:\prod\data\sforce\sample.key"/>

 

But I am getting following error even password is correct:

 

2010-07-26 18:34:46,321 ERROR [csvAccountExtract] config.Config decryptProperty (Config.java:645) - Error loading parameter: sfdc.password of type: java.lang.String
javax.crypto.BadPaddingException: Given final block not properly padded
        at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
        at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
        at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA12275)
        at javax.crypto.Cipher.doFinal(DashoA12275)
        at com.salesforce.lexiloader.security.EncryptionUtil.decryptString(EncryptionUtil.java:197)
        at com.salesforce.lexiloader.config.Config.decryptProperty(Config.java:639)
        at com.salesforce.lexiloader.config.Config.postLoad(Config.java:591)
        at com.salesforce.lexiloader.config.Config.loadParameterOverrides(Config.java:617)
        at com.salesforce.lexiloader.process.ProcessRunner.run(ProcessRunner.java:106)
        at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)
2010-07-26 18:34:46,321 FATAL [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:156) - Error loading parameter: sfdc.password of type: java.lang.String

 

What could be reason? What is this padding? Please help.

 

 

 

BylithiumBylithium

Please use this format... I dont see the endpoint in your xml.

Make sure you have the same endpoint in your config.prop file as well..or if you can show me your xml I will correct it

 

<entry key="sfdc.endpoint" value="https://test.salesforce.com/services/Soap/u/18.0"/>

<entry key="sfdc.username" value="Username"/>

<entry key="sfdc.password" value="Password"/>

AnzarAnzar

I have put the endpoint tag into xml file too, but still getting same error. The xml file is as follows:

 

process-conf.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="csvAccountExtractProcess"
          class="com.salesforce.lexiloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                 <entry key="sfdc.debugMessages" value="True"/>
                <entry key="sfdc.debugMessagesFile" value="c:\prod\data\sforce\log\sforcedataloader.log"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
    <entry key="sfdc.connectionTimeoutSecs" value="60"/>
    <entry key="dataAccess.writeBatchSize" value="500"/>
    <entry key="sfdc.endpoint" value="
https://www.salesforce.com"/>
    <entry key="sfdc.username" value="
username"/>
    <entry key="sfdc.password" value="encrypted password"/>
    <entry key="process.encryptionKeyFile" value="C:\prod\data\sforce\sample.key"/>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="sfdc.extractionRequestSize" value="500"/>
                <entry key="sfdc.extractionSOQL" value="sfdc.extractionSOQL=select Id,IsDeleted,MasterRecordId,Name,Type,ParentId,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,Phone,Fax,AccountNumber,Website,Sic,Industry,AnnualRevenue,NumberOfEmployees,Ownership,TickerSymbol,Description,Rating,Site,OwnerId,CreatedDate,CreatedById,LastModifiedDate,LastModifiedById,SystemModstamp,LastActivityDate,CustomerPriority__c,SLA__c,Active__c,NumberofLocations__c,UpsellOpportunity__c,SLASerialNumber__c,SLAExpirationDate__c from Account   where Type = 'Customer - Direct'"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="c:\prod\data\sforce\mapping\accountExtractMap.sdl"/>
    <entry key="sfdc.enableRetries" value="true"/>
    <entry key="sfdc.maxRetries" value="3"/>
                <entry key="dataAccess.type" value="csvWrite"/>
                <entry key="dataAccess.name" value="c:\prod\data\sforce\account-extract.csv"/>
    <entry key="process.outputError" value="C:\prod\data\sforce\log\csvError.csv"/>
    <entry key="process.outputSuccess" value="C:\prod\data\sforce\log\csvSuccess.csv"/>
    <entry key="process.enableExtractSuccessOutput" value="true"/>
            </map>
        </property>
    </bean>
</beans>

 

config.properties

#Loader Config
sfdc.endpoint=https\://www.salesforce.com

 

 

The command line script:

 

process C:/PROGRA~1/salesforce.com/APEXDA~1.0/conf   csvAccountExtractProcess

 

The error message is as below:

 

2010-07-27 11:01:08,227 ERROR [csvAccountExtract] config.Config decryptProperty (Config.java:645) - Error loading parameter: sfdc.password of type: java.lang.String

javax.crypto.BadPaddingException: Given final block not properly padded
        at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
        at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
        at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA12275)
        at javax.crypto.Cipher.doFinal(DashoA12275)
        at com.salesforce.lexiloader.security.EncryptionUtil.decryptString(EncryptionUtil.java:197)
        at com.salesforce.lexiloader.config.Config.decryptProperty(Config.java:639)
        at com.salesforce.lexiloader.config.Config.postLoad(Config.java:591)
        at com.salesforce.lexiloader.config.Config.loadParameterOverrides(Config.java:617)
        at com.salesforce.lexiloader.process.ProcessRunner.run(ProcessRunner.java:106)
        at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)
2010-07-27 11:01:08,227 FATAL [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:156) - Error loading parameter: sfdc.password of type: java.lang.String

 

 

 

AnzarAnzar

I discovered what the problem was.  I was using   encrypt -g <password>, so, due to that reason, I was getting this problem:

 

2010-07-27 11:01:08,227 ERROR [csvAccountExtract] config.Config decryptProperty (Config.java:645) - Error loading parameter: sfdc.password of type: java.lang.String

javax.crypto.BadPaddingException: Given final block not properly padded

 

 

Now, I have used encrypt -e <password>, so it is working fine.

 

Thanks a lot your valuable comment. 

This was selected as the best answer
Gagandeep SinghGagandeep Singh

Please make sure that you have used the encryption key while encrypting your password+security token while using encrypt -e.

 

for example

 

encrypt -g someencryptioninput >C:\data\encrypt.key

 

encrypt -e password+securitytoken path_of_encrypt.key_file >C:\data\password.txt

 

use the encrypted password retrieved in password.txt file.

 

I was facing the same error and this solved my problem.