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
arasuarasu 

Deploying Apex to PROD - Proxy authentication required error....

Hi,
 
I am trying to deploy an Apex Triiger and its related test class to production from sandbox. I am using Ant script for doing this. I get the following proxy authentication required error when I run ant deploy.
 
Error from ant deploy:

C:\workzone\Salesforce-ant\sample>ant -verbose deploy
Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_01\jre
Detected OS: Windows XP
parsing buildfile C:\workzone\Salesforce-ant\sample\build.xml with URI = file:/C
:/workzone/Salesforce-ant/sample/build.xml
Project base dir set to: C:\workzone\Salesforce-ant\sample
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apach
e/tools/ant/antlib.xml. It could not be found.
 [property] Loading C:\workzone\Salesforce-ant\sample\build.properties
 [property] Loading Environment env.
 [setproxy] Setting proxy to XXXXXXXX:8080
Build sequence for target(s) `deploy' is [deploy]
Complete build sequence is [deploy, deployUnpackaged, retrieveUnpackaged, test,
]
deploy:
parsing buildfile jar:file:/C:/apache-ant-1.7.0/lib/ant-salesforce.jar!/com/sale
sforce/antlib.xml with URI = jar:file:/C:/apache-ant-1.7.0/lib/ant-salesforce.ja
r!/com/salesforce/antlib.xml
[sf:compileAndTest] Using proxy: XXXXXXX:8080
[sf:compileAndTest] compileAndTest on https://www.salesforce.com/services/Soap/u
/11.0, compiling 1 classes and 1 triggers, deleting 0 classes and 0 triggers
[sf:compileAndTest] note: use ant -verbose to get more information on the failur
e
BUILD FAILED
C:\workzone\Salesforce-ant\sample\build.xml:34: Failed to login:Failed to send r
equest to https://www.salesforce.com/services/Soap/u/11.0
        at com.salesforce.ant.CompileAndTest.execute(CompileAndTest.java:190)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: com.sforce.ws.ConnectionException: Failed to send request to https://
www.salesforce.com/services/Soap/u/11.0
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:95)
        at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.jav
a:1193)
        at com.sforce.soap.partner.PartnerConnection.<init>(PartnerConnection.ja
va:301)
        at com.sforce.soap.partner.Connector.newConnection(Connector.java:27)
        at com.salesforce.ant.CompileAndTest.execute(CompileAndTest.java:120)
        ... 17 more
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "H
TTP/1.0 407 Proxy Authentication Required"
        at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnec
tion.java:1425)

        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:168)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLCo
nnection.java:836)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Htt
psURLConnectionImpl.java:230)
        at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.jav
a:115)
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:88)
        ... 21 more
--- Nested Exception ---
com.sforce.ws.ConnectionException: Failed to send request to https://www.salesfo
rce.com/services/Soap/u/11.0
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:95)
        at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.jav
a:1193)
        at com.sforce.soap.partner.PartnerConnection.<init>(PartnerConnection.ja
va:301)
        at com.sforce.soap.partner.Connector.newConnection(Connector.java:27)
        at com.salesforce.ant.CompileAndTest.execute(CompileAndTest.java:120)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "H
TTP/1.0 407 Proxy Authentication Required"
        at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnec
tion.java:1425)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:168)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLCo
nnection.java:836)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Htt
psURLConnectionImpl.java:230)
        at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.jav
a:115)
        at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:88)
        ... 21 more
Total time: 1 second
C:\workzone\Salesforce-ant\sample>
 
Buld.xml
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
    <property file="build.properties"/>
    <property environment="env"/>
    <setproxy proxyHost="${proxy.host}" proxyPort="${proxy.port}" />
    <!-- Test out deploy and retrieve verbs for package 'mypkg' -->
    <target name="test">
      <!-- Upload the contents of the "mypkg" package -->
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployroot="mypkg"/>
      <mkdir dir="retrieveOutput"/>
      <!-- Retrieve the contents into another directory -->
      <sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveOutput" packageNames="MyPkg"/>
    </target>
    <!-- Retrieve an unpackaged set of metadata from your org -->
    <!-- The file unpackaged/package.xml lists what is to be retrieved -->
    <target name="retrieveUnpackaged">
      <mkdir dir="retrieveUnpackaged"/>
      <!-- Retrieve the contents into another directory -->
      <sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" singlePackage="true" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
    </target>
    <!-- Deploy the unpackaged set of metadata retrieved with retrieveUnpackaged -->
    <target name="deployUnpackaged">
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployroot="retrieveUnpackaged" singlePackage="true"/>
    </target>
 <target name="deploy">
        <sf:compileAndTest
            username="${sf.username}"
            password="${sf.password}"
            server="${sf.serverurl}"
            apiversion="11.0"
            baseDir=".">
            <runTests>
                <class>compileAndTest</class>
            </runTests>
         </sf:compileAndTest>
</target>
</project>
 
I tried the following to set the following in build.xml file for retrieving the proxy userid and password, but did not work, probably due to wrong syntax:
 
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
    <property file="build.properties"/>
    <property environment="env"/>
    <setproxy proxyHost="${proxy.host}" proxyPort="${proxy.port}"  proxyUser="${proxy.user}"  proxyPassword="${proxy.password}" />
 
If anyone can please figure out how to set the proxyuser and password, that will be greatly appreciated.
 
Thanks,
Ambili


Message Edited by arasu on 02-11-2008 10:25 AM

Message Edited by arasu on 02-11-2008 10:26 AM
mba75mba75

Set up this target into your Build.xml
it works for me

<target
name="proxy">
  <setproxy proxyhost="xx.xxxx.xx.44" proxyport="8080" proxyuser="" proxypassword="" />
  </target>


sanket mahajan 1sanket mahajan 1
Hello All, 

Please go through my blog. I have setup with both Proxy and Non proxy settings.

https://sfdc-concepts.blogspot.com/2019/12/how-to-setup-ant-for-salesforce.html

Hope this will help!

Thanks,
Sanket