• Charles Dou
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi,

I have been struggled for a long time with the salesforce auothrization, and I just cannot pass. I checked the credentials in the code like a thousand times so I am sure they are correct. And I also tried everything I can find online. I am still wondering if there's anything wrong within the code.
 
$params = array(
		'grant_type' => 'password',
		'client_id' => '3Mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
		'client_secret' => 'xxxxxxxxxxxxxx',
		'username' => 'xxxx@xxxxxxx.com',
		'password' => 'password+token'
	);
	$ch = curl_init("https://test.salesforce.com/services/oauth2/token");
	curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($params));
	curl_setopt($ch, CURLOPT_POST,true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencoded;charset=UTF-8'));
	var_dump(curl_exec($ch));
here're things I've tried:
  •  added Content-Type: application/x-www-form-urlencoded to request header
  • made sure the "password" parameter is password+ API security tocken
  • made sure the credentials are correct.
Environment:
- Eclipse Neon 4.6.1 (Mac)
- Force.com IDE 37.0.0.201609220436
- following the install instructions and using https://developer.salesforce.com/media/force-ide/eclipse45

When creating a new Run Configuration, I 
- click on the new Icon 
- select a Force.com project
- click on the "Test" tab - the Search for the test class is grayed out

An error has occurred. See error log for more details.
java.lang.NullPointerException

In the log:
Message: Unhandled event loop exception
java.lang.NullPointerException
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.lambda$1(ApexSourceUtils.java:293)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.filterSourcesByType(ApexSourceUtils.java:294)
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.filterSourcesByClass(ApexSourceUtils.java:243)
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.findTestClassesInProject(ApexSourceUtils.java:67)
    at com.salesforce.ide.ui.views.runtest.TestConfigurationsBuilder.buildTestsForProject(TestConfigurationsBuilder.java:59)
    at com.salesforce.ide.ui.views.runtest.TestConfigurationTab.buildTestsForProject(TestConfigurationTab.java:505)
    at com.salesforce.ide.ui.views.runtest.TestConfigurationTab.initializeFrom(TestConfigurationTab.java:591)
    at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchConfigurationTabGroup.java:90)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.initializeFrom(LaunchConfigurationTabGroupWrapper.java:201)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.handleRevertPressed(LaunchConfigurationTabGroupViewer.java:1443)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$3.getConfirmation(LaunchConfigurationsDialog.java:610)
    at org.eclipse.debug.internal.ui.launchConfigurations.AbstractLaunchConfigurationAction.run(AbstractLaunchConfigurationAction.java:97)
    at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
    at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
    at org.eclipse.jface.window.Window.open(Window.java:794)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1203)
    at org.eclipse.debug.ui.DebugUITools$3.run(DebugUITools.java:629)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:637)
    at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:570)
    at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:82)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
    at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1519)

I checked the code https://github.com/forcedotcom/idecore/blob/a78d00e17e729cb688faa8369564b51c6e81d9f5/com.salesforce.ide.apex.core/src/com/salesforce/ide/apex/internal/core/ApexSourceUtils.java

it is not the current/latest version - it was changed Jun 16, 2016 and uses the code before then.

Seems to me that the code is 37.0 - i.e. Spring 16
How do I install Winter 16??

As a result, I cannot run any tests in Eclipse.
Hi,

I have been struggled for a long time with the salesforce auothrization, and I just cannot pass. I checked the credentials in the code like a thousand times so I am sure they are correct. And I also tried everything I can find online. I am still wondering if there's anything wrong within the code.
 
$params = array(
		'grant_type' => 'password',
		'client_id' => '3Mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
		'client_secret' => 'xxxxxxxxxxxxxx',
		'username' => 'xxxx@xxxxxxx.com',
		'password' => 'password+token'
	);
	$ch = curl_init("https://test.salesforce.com/services/oauth2/token");
	curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($params));
	curl_setopt($ch, CURLOPT_POST,true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencoded;charset=UTF-8'));
	var_dump(curl_exec($ch));
here're things I've tried:
  •  added Content-Type: application/x-www-form-urlencoded to request header
  • made sure the "password" parameter is password+ API security tocken
  • made sure the credentials are correct.