cancel
Showing results for 
Search instead for 
Did you mean: 

NoClassDefFoundError in WebService

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Raags,

Yes it sounds rather complex , I'll try it and say if it helps.

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.