• kanhu das
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I am trying to connect to a sandbox REST webservice from a Java application. Howevere I am getting "An internal server error has occurred".

Have used the TokenUrl :: https://vha--devops.cs81.my.salesforce.com/services/oauth2/token

Below is the complete error message ;

<html>
<head><title>An internal server error has occurred</title></head>
<body>
<div style="display:none;" id="errorTitle">An internal server error has occurred</div>
<div style="display:none;" id="errorDesc">An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact <a href="https://help.salesforce.com/apex/hthome">Salesforce Support</a>. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. <br/><br/>Thank you again for your patience and assistance. And thanks for using salesforce.com!</div>
<table cellspacing=10>
<tr><td><span style="font-weight: bold; font-size: 12pt;">An internal server error has occurred</span></td></tr>
<tr><td>
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact <a href="https://help.salesforce.com/apex/hthome">Salesforce Support</a>. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. <br/><br/>Thank you again for your patience and assistance. And thanks for using salesforce.com!
<br><br>
Error ID: 752922053-131984 (925905458)
</td>
</tr>
<tr><td>
<br clear="all"><br><br></td></tr>
</table></td></tr></table></body></html>
I am trying to connect to a sandbox REST webservice from a Java application. Howevere I am getting "An internal server error has occurred".

Have used the TokenUrl :: https://vha--devops.cs81.my.salesforce.com/services/oauth2/token

Below is the complete error message ;

<html>
<head><title>An internal server error has occurred</title></head>
<body>
<div style="display:none;" id="errorTitle">An internal server error has occurred</div>
<div style="display:none;" id="errorDesc">An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact <a href="https://help.salesforce.com/apex/hthome">Salesforce Support</a>. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. <br/><br/>Thank you again for your patience and assistance. And thanks for using salesforce.com!</div>
<table cellspacing=10>
<tr><td><span style="font-weight: bold; font-size: 12pt;">An internal server error has occurred</span></td></tr>
<tr><td>
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact <a href="https://help.salesforce.com/apex/hthome">Salesforce Support</a>. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. <br/><br/>Thank you again for your patience and assistance. And thanks for using salesforce.com!
<br><br>
Error ID: 752922053-131984 (925905458)
</td>
</tr>
<tr><td>
<br clear="all"><br><br></td></tr>
</table></td></tr></table></body></html>

Step 1: Create enterprise.jar using enterprise wsdl

java -Dpackage -classpath force-wsc-32.0.0.jar;tools.jar;antlr-runtime-3.5.jar;ST4-4.0.7.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar

Step 2: Added enterprise.jar and force-wsc-32.0.0.jar to java project class path.
Step 3: Create stub using enterprise.wsdl (com.sforce.soap.enterprise , com.sforce.soap.enterprise.fault , com.sforce.soap.enterprise.sobject )

Step 4: Created package wsc and a class


package wsc;

import com.sforce.soap.enterprise.Connector;
import com.sforce.soap.enterprise.EnterpriseConnection;
import com.sforce.soap.enterprise.GetUserInfoResult;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;

public class Main1 {
static final String USERNAME = "ux.p@gmail.com";
static final String PASSWORD = "Password with security token";
static EnterpriseConnection connection;

public static void main(String[] args) {

  ConnectorConfig config = new ConnectorConfig();
  config.setUsername(USERNAME);
  config.setPassword(PASSWORD);
  config.setTraceMessage(true);

  try {
   connection = Connector.newConnection(config);

   // display some current settings
   System.out.println("Auth EndPoint: "+config.getAuthEndpoint());
   System.out.println("Service EndPoint: "+config.getServiceEndpoint());
   System.out.println("Username: "+config.getUsername());
   System.out.println("SessionId: "+config.getSessionId());
  }
  catch (ConnectionException e1) { e1.printStackTrace();
  }
}

}


Step 5: When running this simple class getting below error

Exception in thread "main" java.lang.ClassCastException: com.sforce.soap.enterprise.LoginResult cannot be cast to com.sforce.ws.bind.XMLizable
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:650)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:527)
at com.sforce.soap.enterprise.LoginResponse_element.loadFields(LoginResponse_element.java:62)
at com.sforce.soap.enterprise.LoginResponse_element.load(LoginResponse_element.java:54)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:651)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:527)
at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:174)
at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:148)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
at com.sforce.soap.enterprise.EnterpriseConnection.login(EnterpriseConnection.java:568)
at com.sforce.soap.enterprise.EnterpriseConnection.<init>(EnterpriseConnection.java:364)
at com.sforce.soap.enterprise.Connector.newConnection(Connector.java:27)
at wsc.Main1.main(Main1.java:22)


Appreciate if anyone let me know what changes do i need to make it running.

I am having the enterprise.wsdl file and i am trying to create a jar file using command 

 

java -classpath wsc-20.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar

 

but getting an error "Error: Unable to find compiler. Make sure that tools.jar is in your classpath:

java.lang.ClassNotFoundException: com/sun/tools/javac/Main.class"

 

can anyone help me..............

 

thank you.......................