Announcement Announcement Module
Collapse
No announcement yet.
Unable to call third party API within Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to call third party API within Spring

    I'm trying to instantiate a third party API (available in a jar) from within a Spring based app and get a “java.lang.NoClassDefFoundError: JavaAPI.XMLable.XMLable”. The jar of third party APIs has the following 2 classes among others:
    JavaAPI.USPurchase.class
    JavaAPI.XMLable.XMLable.class

    The .jar file is available in app's, lib folder and included in the Build path of the project.
    The Bean that calls the third party classes is defined in Spring's configuration file. The bean instantiates "USPurchase" (that references "XMLable"). The code compiles just fine but fails with the abovementioned error at runtime. When I try to call the third party APIs from a Java Application, it works just fine. To me it seems like a ClassLoader issue but am at a loss for ideas as to what can be done to resolve this. Any help is appreciated.

  • #2
    How r you running hte application?

    if it works at build time but fails at compile time, mayb some jars are missing
    when you run the application


    hth
    marco

    Comment


    • #3
      I got it to work. When I copied over the third party jar to the app/lib folder in RAD, it didn't automatically update the classpath Manifest.MF file and so didn't include the jar. When I included it manually and also switched the order in which the jars should be loaded (the classes referenced in the thirdparty classes first, followed by the third party class itself and then my app's business jar), it worked just fine. Thanks.

      Comment


      • #4
        Originally posted by abhinavpooja View Post
        I got it to work. When I copied over the third party jar to the app/lib folder in RAD, it didn't automatically update the classpath Manifest.MF file and so didn't include the jar.
        Any time that you add a new JAR file to a project in Eclipse/RAD, you have to refresh the project for it to be picked up. That's assuming that you have your project's build path set correctly, as well.

        Comment

        Working...
        X