Skip to Content
avatar image
Former Member

NoClassDefFoundError in WebService

I've created web service from java class in development component of type Java and added all libs it used to Used DCs of my component but still when I test it in Web Service navigator I get NoClassDefFoundError for class from caf\eu\gp\api. And I'm confused, isn't it enough to add libs to Used DC's? The same with web service created from EJB. 😔

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    May 29, 2007 at 05:44 PM

    Hi Kuchar,

    Add the Libs to an external library DC and then make this DC as the used DC for the main DC you want to.

    If the same external Library DC is used by other DCs which is interacting with your main DC, Then try to create a J2EE Library DC add external Library DC as the used DC. Now remove the external DC from Used Dcs of main DC. Then add J2EE Library DC as the used DC to all other DCs including Main DC which wants to access libs of extgernal DC.

    i know i put the words in complex.. but bottom line is that u have to use external lib in case of one DC references. Use j2EE Dc with exgternal DC as used dc when libs are used by multiple depended DCs.

    Let me know if you havent get what u r looking for.

    Thanks,

    Raags

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2007 at 02:05 PM

    Hi,

    If you want to use caf/eu/gp/api DC in your Web Service do the following:

    1. Create a DC of type External Library

    2. Copy the jar of the public part of DC caf/eu/gp/api to the library folder

    3. Create a Public Part of type <b>assembly</b> from the added jar file

    4. A the Ext Libs DC as used DC to your WS DC

    5. Build the whole thing an you'll have the jars in your WS ear file

    You've to do that, because all public parts of DC caf/eu/gp/api are defined as type compilation and caf/eu/gp/api is a JAVA DC, the jars won't be packed into your WS ear (only pp's ot type assembly would be packed into a deployable unit).

    But attention: In NW04s SP09 there is a bug in build tool and this procedure does'nt work!

    Hope this helps.

    Regards,

    Daniel

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Daniel,

      Your solution is like Devish, I think it will work but is not right because if versions of sda on server will change then we can fell in some troubles.

      Actually I resolved this problem by myself. To use GP in WebService it's enough

      1) Add GP to Used DC for Build Time only (because for Deploy and Runtime it will be ignored anyway)

      2) Add reference to application-j2ee-engine.xml. For this press Add->Create New and fill reference target with caf/eu/gp/api and vendor with sap.com another fields leave as is.

      Enjoy 😊

  • avatar image
    Former Member
    May 29, 2007 at 05:47 PM

    HI,

    It seems you are refering CAF and GP components in your project.

    Please check whether you have deployed CAF and GF components on the server or not. You have to first install these components before use.

    I am assuming, you are getting class Not found exception for some SAP standard class and not or your Java or EJB class.

    Let me know if I am wrong.

    Regards,

    Bhavik

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Devisha,

      Yes you are right GP class is not found as I wrote in my first post. CAF and GP is installed properly of course.

      Even more I've developed WebDynpro development component and used GP in it and it works fine because I've added library reference to GP in it, but with web service I can't do this because only type of development component I can use is Java or EJB module. And main problem is how to say to my component where to search GP DC's, because simple adding them to Used DC's doesn't help. I can add required jars to ear by myself of course but think this is not proper way.