4

I am trying to build the enterprise and metadata jar files, but I am not successful. I have seen many similar posts but seem to be having a separate issue.

I have downloaded the rhino package, the file ST-4.0.jar , as well as the api version 37 jar file, and I am getting this error when I do this compilation:

SaulBrodskysMBP:src saulbrodsky$ java -classpath force-wsc-37.0.jar:js-1.7R2.jar:ST-4.0.jar com.sforce.ws.tools.wsdlc metadata.wsdl metadata.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/CharStream
at com.sforce.ws.tools.wsdlc.run(wsdlc.java:149)
at com.sforce.ws.tools.wsdlc.main(wsdlc.java:71)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.CharStream
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 2 more

[[ UPDATE ]]

SaulBrodskysMBP:src saulbrodsky$ java -classpath force-wsc-37.0.jar:js-1.7R2.jar:ST-4.0.jar:antlr-4.5.3-complete.jar com.sforce.ws.tools.wsdlc metadata.wsdl metadata.jar
[WSC][wsdlc.main:71]Generating Java files from schema ...
[WSC][wsdlc.main:71]Generated 732 java files.
[WSC][wsdlc.main:71]Compiling to target 1.6... 
warning: [options] bootstrap class path not set in conjunction with -source 1.6
/var/folders/yq/t9c7k4_57hjcxhwfj_m2x1980000gn/T/wsc-scratch3639753563837329210tmp/com/sforce/soap/metadata/Error.java:22: error: cannot find symbol
    private com.sforce.soap.metadata.ExtendedErrorDetails[] extendedErrorDetails = new com.sforce.soap.metadata.ExtendedErrorDetails[0];
                                    ^
  symbol:   class ExtendedErrorDetails
  location: package com.sforce.soap.metadata
/var/folders/yq/t9c7k4_57hjcxhwfj_m2x1980000gn/T/wsc-scratch3639753563837329210tmp/com/sforce/soap/metadata/Error.java:24: error: cannot find symbol
    public com.sforce.soap.metadata.ExtendedErrorDetails[] getExtendedErrorDetails() {
                                   ^
  symbol:   class ExtendedErrorDetails
  location: package com.sforce.soap.metadata
/var/folders/yq/t9c7k4_57hjcxhwfj_m2x1980000gn/T/wsc-scratch3639753563837329210tmp/com/sforce/soap/metadata/Error.java:28: error: cannot find symbol
    public void setExtendedErrorDetails(com.sforce.soap.metadata.ExtendedErrorDetails[] extendedErrorDetails) {
                                                                ^
  symbol:   class ExtendedErrorDetails
  location: package com.sforce.soap.metadata
/var/folders/yq/t9c7k4_57hjcxhwfj_m2x1980000gn/T/wsc-scratch3639753563837329210tmp/com/sforce/soap/metadata/Error.java:22: error: cannot find symbol
    private com.sforce.soap.metadata.ExtendedErrorDetails[] extendedErrorDetails = new com.sforce.soap.metadata.ExtendedErrorDetails[0];
                                                                                                               ^
  symbol:   class ExtendedErrorDetails
  location: package com.sforce.soap.metadata
/var/folders/yq/t9c7k4_57hjcxhwfj_m2x1980000gn/T/wsc-scratch3639753563837329210tmp/com/sforce/soap/metadata/Error.java:37: error: cannot find symbol
        setExtendedErrorDetails((com.sforce.soap.metadata.ExtendedErrorDetails[])__typeMapper.readObject(__in, extendedErrorDetails__typeInfo, com.sforce.soap.metadata.ExtendedErrorDetails[].class));
                                                         ^
  symbol:   class ExtendedErrorDetails
  location: package com.sforce.soap.metadata
/var/folders/yq/t9c7k4_57hjcxhwfj_m2x1980000gn/T/wsc-scratch3639753563837329210tmp/com/sforce/soap/metadata/Error.java:37: error: cannot find symbol
        setExtendedErrorDetails((com.sforce.soap.metadata.ExtendedErrorDetails[])__typeMapper.readObject(__in, extendedErrorDetails__typeInfo, com.sforce.soap.metadata.ExtendedErrorDetails[].class));
                                                                                                                                                                       ^
  symbol:   class ExtendedErrorDetails
  location: package com.sforce.soap.metadata
6 errors
1 warning
Error: Failed to compile

I don't understand why it's compiling to 1.6 when I have Java 1.7 installed.

How can I change that?

2
  • 1
    Don't agree that this is off-topic: calling the Salesforce API from Java is a very common requirement and WSC is a Salesforce tool provided to help with that.
    – Keith C
    Aug 22 '16 at 7:38
  • Its not giving me any error, but it still says 'compiling to target 1.6' even though i have 1.7 java installed on my system. How can make this to compile to 1.7? [WSC][wsdlc.main:71]Generating Java files from schema ... [WSC][wsdlc.main:71]Generated 805 java files. [WSC][wsdlc.main:71]Compiling to target 1.6... warning: [options] bootstrap class path not set in conjunction with -source 1.6
    – Kiran
    Sep 6 '17 at 19:17
1

A NoClassDefFoundError is generally caused by a JAR being missing so the class can't be found. In this case it appears to be ANTLR so download and add that JAR to your classpath.

1

I have encountered a similar error (ExtendedErrorDetails) while using WSC 37.0 jar file and when I have replaced it with the latest 38.0.3 WSC jar file in the -classpath the issue is resolved. Hope this helps someone.

1

https://www.antlr.org/download/antlr-4.7.2-complete.jar download the ANTLR jar and use this. It resolved my issue.

I have used the following command:

java -classpath .\force-wsc-45.0.0;.\antlr-4.7.2-complete.jar;.\js.jar;.\ST-4.1.jar;.\js.jar;.\tools.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar

All of my jar files are in the same directory. Also, do not save enterprise.wsdl with .xml extension, instead save this file with .wsdl extension.

1
  • I am getting java.lang.NullPointerException when generating partner jar. can you help....
    – Sisir
    Oct 21 '20 at 16:06

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.