+ Start a Discussion
Lakshminarayana CVLakshminarayana CV 

Failed to create object (Login Response object)

Getting following error when I try to login through java client failing at          connection = new EnterpriseConnection(config); Thanks in advance for the answer.

com.sforce.ws.ConnectionException: Failed to create object
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:677)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:556)
    at com.sforce.soap.enterprise.LoginResponse_element.setResult(LoginResponse_element.java:38)
    at com.sforce.soap.enterprise.LoginResponse_element.loadFields(LoginResponse_element.java:69)
    at com.sforce.soap.enterprise.LoginResponse_element.load(LoginResponse_element.java:63)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:674)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:556)
    at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:180)
    at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:154)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
    at com.sforce.soap.enterprise.EnterpriseConnection.login(EnterpriseConnection.java:1097)
    at com.sforce.soap.enterprise.EnterpriseConnection.<init>(EnterpriseConnection.java:387)
    at com.orangelake.tourmanifest.client.QuickstartApiSample.login(abc.java:93)
    at com.orangelake.tourmanifest.client.QuickstartApiSample.run(abc.java:47)
    at com.orangelake.tourmanifest.client.QuickstartApiSample.main(abc.java:42)
Caused by: java.lang.InstantiationException: com.sforce.soap.enterprise.LoginResult
    at java.lang.Class.newInstance(Unknown Source)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:673)
    ... 14 more
Caused by: java.lang.NoSuchMethodException: com.sforce.soap.enterprise.LoginResult.<init>()
    at java.lang.Class.getConstructor0(Unknown Source)
smierasmiera
Are you providing security tokan with the password while connecting to Salesforce. And can you please provide your detail code snippet here , to understand it more clearly where you are getting below exception.
smierasmiera
And one more point is , Check your Proxy setting if you are using proxy server. 
And try to use setProxy method on your connection object.
Thanks!
Lakshminarayana CVLakshminarayana CV
Thanks Smiera. No security token is provided Or it is a just an empty string. I have just generated a stub "enterprise_stub.jar" by using the provided "enterprise.wsdl". Using Java 8. Then just to verify the connection used the following code snippet provided in the web site.

package wsc;

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

public class Main {
    static final String USERNAME = "YOUR DEVORG USERNAME";
    static final String PASSWORD = "YOUR DEVORG PASSWORD AND SECURITY TOKEN";
    static EnterpriseConnection connection;

    public static void main(String[] args) {

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

        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();
        } 
    }
}

When I run this program, getting the error mentioned above / earlier  at line "connection = Connector.newConnection(config);" . Looks like authentication is successful as not getting any error related to "LoginFault..."

Please provide your suggestion to resolve the issue. Thanks.