Java NoClassDefFoundError:com.sforce.soap.enterprise.Connector
我试图从salesForce帐户查询联系人,但出现上述错误 我从我的帐户下载的WSDL生成了Java NoClassDefFoundError:com.sforce.soap.enterprise.Connector,java,android,soap,salesforce,soql,Java,Android,Soap,Salesforce,Soql,我试图从salesForce帐户查询联系人,但出现上述错误 我从我的帐户下载的WSDL生成了enterprise.jar文件 我在libs文件夹中有wsc-23-min.jar以及enterprise.jar文件 下面的方法用于查询联系人 private void queryContacts() { Log.i(TAG, "Querying for the 5 newest Contacts..."); ConnectorConfig config = new Connecto
enterprise.jar
文件
我在libs
文件夹中有wsc-23-min.jar
以及enterprise.jar
文件
下面的方法用于查询联系人
private void queryContacts() {
Log.i(TAG, "Querying for the 5 newest Contacts...");
ConnectorConfig config = new ConnectorConfig();
config.setUsername("***@***.com");
config.setPassword("***");
try {
connection = Connector.newConnection(config);
// query for the 5 newest contacts
com.sforce.soap.enterprise.QueryResult queryResults = connection.query("SELECT Id, FirstName, LastName, Account.Name " +
"FROM Contact WHERE AccountId != NULL ORDER BY CreatedDate DESC LIMIT 5");
if (queryResults.getSize() > 0) {
for (int i=0;i<queryResults.getRecords().length;i++) {
// cast the SObject to a strongly-typed Contact
Contact c = (Contact)queryResults.getRecords()[i];
Log.i(TAG, " ------------- Id: " + c.getId() + " - Name: "+c.getFirstName()+" "+
c.getLastName()+" - Account: "+c.getAccount().getName());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void queryContacts(){
Log.i(标记“查询5个最新联系人…”);
ConnectorConfig config=new ConnectorConfig();
config.setUsername(“***@***.com”);
config.setPassword(“***”);
试一试{
connection=Connector.newConnection(配置);
//查询5个最新联系人
com.sforce.soap.enterprise.QueryResult queryResults=connection.query(“选择Id、FirstName、LastName、Account.Name”+
“来自联系人,其中AccountId!=CreatedDate DESC LIMIT 5的空订单”);
if(queryResults.getSize()>0){
对于(int i=0;i您应该将jar放在libs
文件夹中,而不是lib
文件夹中。然后转到项目属性并将jar添加到java构建路径中最终解决了我的问题
是答案的链接。对不起。我编辑了我的问题。所有JAR都只在libs文件夹中。不在lib中。即使我跟帖了,但运气都不好。您的JAR是否出现在参考库中?
?是的。它们正在出现。可能是订单和导出有问题。请确保所有自定义库都在您的项目/gen下方代码>和所有都已检查。所有JAR都位于proj/gen文件夹下。我缺少“检查”部分,但在执行此操作后也没有运气。