0

I want to integrate java with salesforce for that I'm trying to generate partner.jar, I'm following this link

Introduction to the Force.com Web Services Connector

I'm using Partner WSDL API. I'm stuck with generating Partner.jar file,

need some help here ..!!

I'm using command my command is **java -classpath J:\Practice\force-wsc-36.1.1.jar com.sforce.ws.tools.wsdlc J:\Practice\Partner.wsdl .\Partner.jar now I'm getting** now the exception is

Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/stringtemplate/v4 /STGroupDir at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.privateGetMethodRecursive(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.validateMainClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.stringtemplate.v4.STGroupDir at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 7 more

  • You should verify that you have installed JDK (JRE will not be enough). In addition, verify it's setup in your PATH – Liron C Mar 8 '17 at 11:51
  • Please share the complete command you are using to create the JAR? – Saroj Bera Mar 8 '17 at 12:04
  • I have updated my post please check that – Atul Rakate Mar 8 '17 at 12:10
  • Please check this link github.com/forcedotcom/wsc/issues/29 – Saroj Bera Mar 8 '17 at 12:11
2

You are trying to generate partner.jar using WSDL file and you are using "force-wsc-36.1.1.jar" (File as Web Service Connector).

As of WSC-36 connector required an additional framework to generate "partner.jar" call "StringTemplate engine framework".

Download latest "StringTemplate binary" jar file using below link: String Template jar file

Put that String template jar, wsc jar and WSDL files in one location.

  1. Open CMD
  2. Go to the directory where you put your all files.
  3. Fire below command to generate a partner.jar file.

    java -classpath force-wsc-36.1.1.jar;ST-4.0.8.jar com.sforce.ws.tools.wsdlc partner.wsdl partner.jar

    Syntax: Java -classpath [WSC jar file];[String template jar file] com.sforce.ws.tools.wsdlc [Partner.wsdl file] [Ouput file name with .jar extation]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.