简体   繁体   中英

Need Assistance setting proxy settings for Java (JVM Launcher)

I am a beginner in Java programming and I did a lot of research but still need assistance. I am trying to add proxy settings to my JVM Launcher but I do not know how to do this.

I have read responses to other questions stating it can be done in the CMD using below

java -Djava.net.useSystemProxies=true

OR

java -Dhttp.proxyHost=Host -Dhttp.proxyPort=Port -Dhttp.proxyUser=Username -Dhttp.proxyPassword=Password

But I need to end them with a Java class or .Jar file. The problem is I do not know the class or the .jar file the application is running off of. I need to do this for Pentaho Data Integration(PDI) and it runs off on Javaw.exe which is all I know.

I have seen other responses where people have coded in Java using eclipse, to add proxy settings will i need to go that route?

Basically I am trying to connect to Salesforce using PDI but my companies proxy settings are stopping me. PDI runs off of Java so I need to set up the proxy setting in Java but do not know where to start.

Any assistance is greatly appreciated. Thank you.


java.lang.Exception: Error connecting to Salesforce! Failed to send request to https://test.salesforce.com/services/Soap/u/37.0

at org.pentaho.di.ui.trans.steps.salesforce.SalesforceStepDialog.test(SalesforceStepDialog.java:97)
at org.pentaho.di.ui.trans.steps.salesforceupsert.SalesforceUpsertDialog.access$1700(SalesforceUpsertDialog.java:87)
at org.pentaho.di.ui.trans.steps.salesforceupsert.SalesforceUpsertDialog$10.handleEvent(SalesforceUpsertDialog.java:679)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.trans.steps.salesforceupsert.SalesforceUpsertDialog.open(SalesforceUpsertDialog.java:723)
at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:127)
at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:8766)
at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:3217)
at org.pentaho.di.ui.spoon.trans.TransGraph.mouseDoubleClick(TransGraph.java:783)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1366)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:8022)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9277)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:692)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)

The answer i found on the web states that to run PDI through a proxy it must be done through the batch file that launches PDI, thats Spoon.bat, this is the link i found. If your trasformation runs through CMD, and uses a .KJB, you'll want to add this parameter to Kitchen.bat ... likewise if you run a KTR through CMD you'll need to add this parameter to the Pan.bat

EDIT:

The set line in your Spoon.bat should like look this

-Dhttp.proxyHost= https://your.proxy -Dhttp.proxyPort=PORT NUMBER -Dhttp.proxyUser= USER -Dhttp.proxyPassword= PASSWORD

So the entire line should be something like

set OPT=%OPT% %PENTAHO_DI_JAVA_OPTIONS% "-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2" "-Djava.library.path=%LIBSPATH%" "-DKETTLE_HOME=%KETTLE_HOME%" "-DKETTLE_REPOSITORY=%KETTLE_REPOSITORY%" "-DKETTLE_USER=%KETTLE_USER%" "-DKETTLE_PASSWORD=%KETTLE_PASSWORD%" "-DKETTLE_PLUGIN_PACKAGES=%KETTLE_PLUGIN_PACKAGES%" "-DKETTLE_LOG_SIZE_LIMIT=%KETTLE_LOG_SIZE_LIMIT%" "-DKETTLE_JNDI_ROOT=%KETTLE_JNDI_ROOT%"-Dhttp.proxyHost= https://your.proxy -Dhttp.proxyPort=PORT NUMBER -Dhttp.proxyUser= USER -Dhttp.proxyPassword= PASSWORD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM