cancel
Showing results for 
Search instead for 
Did you mean: 

Using deployed jar libraries in a Java DC

todor_petrov
Contributor
0 Kudos

Hello,

what I would like to do is build a Java Class, which uses some MDM libraries that are already deployed on the J2EE Server.

For the build time I am using an External Library DC, which has all the needed JARs and I am importing the the external library as Used DC in my Java DC and this is quite enough to get all the APIs I need.

However here the problem is that I am not getting a runtime reference to those libraries on the J2EE Server. Follows a short explanation:

To deploy my Java DC I am using a J2EE Server Component, which includes the SDA public part of my Java DC. So my Java DC is deployed on the server, just when I call it I get a ClassNotFound exception, which refers the libraries that I imported in my external library DC.

All in all the question states: How do I define runtime dependency within a JAVA DC to libraries that are already deployed on the J2EE Server?

Thanks in advance for the provided solution.

Greetings,

Todor

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

1:Create one java library project and put all required jar files in it.

2: Build and deploy .sda file in server.

3: Then go to Navigator, Right click and open properties

4: Select project references--> here select the Library project name created above

Regards

LN

todor_petrov
Contributor
0 Kudos

Hi LN,

what you are suggesting works of course, but it is not what I asked.

My wish is to use the already deployed MDM libraries on the J2EE Server and not to deploy them one more time using the external library DC.

Is that possible at all? Should be....

Greetings,

Todor

Former Member
0 Kudos

Hi,

Right click on the DC and click on "Set Additional Libraries".

By using the above you can use existing libraries.

Thanks & Regards,

Pradeep

todor_petrov
Contributor
0 Kudos

Hi Pradeep,

this is exactly what I was looking for. However our library is not a standard J2EE one and therefore it is not listed in the this menu. We have deployed the SCA archive for the MDM APIs manually.

Is it possible to extend the list of the available libraries by adding our MDM entry somewhere, somehow?

Thanks again,

Todor

Former Member
0 Kudos

Hi,

I think you can set only J2EE libraries.

This link will help you to set additional libraries.

http://help.sap.com/saphelp_nw04/helpdata/en/15/d5d93fe80fed06e10000000a1550b0/frameset.htm.

Reward if helpful.

Thanks & Regards,

Pradeep

todor_petrov
Contributor
0 Kudos

Hi Pradeep,

I was thinking that what you suggested would work. However it doesn't do the trick for me. I will try to give you the complete scenario structure and the errors that occur in the next few steps. Before I start I will state the purpose, which is: to use the deployed MDM API libraries from the J2EE Server instead of deploying them one more time with an external library.

1. I create an External Library DC, which has my MDM JAR libs and create a public part, in which I expose them to the other components (Build Time)

2. I create a Java DC , where I import the public part from step 1 and I can already use the MDM classes.

3. I create 2 public parts from the Java DC - one API and one for deployment

4. I create a J2EE Server Library Component, where as Used DCs I import the Java DC Public part, which I created for deployment

5. I build and deploy the J2EE server component

6. I create a Web Dynpro Component that will use my Java DC. Therefore I import in the Used DCs the Java DC API Public part. Now I can access my classes from the Java file

7. I build and deploy the Web Dynpro Applicaiton and I get a java.lang.NoClassDefFoundError exception for the MDM class that I used in my Java DC (Reason: Run reference to the deployed MDM libs is missing)

So those were the steps before you suggestion. After it, I inserted an additional step between steps 3 and 4, where I click on "Set additional libraries.." and from there select the library i need. Since there was no MDM lib there, I decided to try exactly the same with the security lib, since it is standard deployed and was also in the list. So the new steps look like this: (purpose use Security API from a Java DC in Web Dynpro DC)

1. I create a Java DC , where I import the public part from the security API and I can already use the Security classes(Build Time).

JAVA CODE:

public class SecurityConnectionControl {

public static IAuthentication getAuth(){

IAuthentication auth = UMFactory.getAuthenticator();

return auth;

}

}

2. I create 2 public parts from the Java DC - one API and one for deployment

3. I add the security API in java build path using "Set additional libraries.."

4. Build the Java DC component

5. I create a J2EE Server Library Component, where as Used DCs I import the Java DC Public part, which I created for deployment

6. I build and deploy the J2EE server component

7. I create a Web Dynpro Component that will use my Java DC. Therefore I import in the Used DCs the Java DC API Public part. Now I can access my classes from the Java file

WEB DYNPRO COMPONENT CODE:

public void wdDoInit()

{

//@@begin wdDoInit()

IAuthentication auth = SecurityConnectionControl.getAuth();

//@@end

}

8. I build and deploy the Web Dynpro Applicaiton and I get a java.lang.NoClassDefFoundError exception for the Security class that I used in my Java DC (Reason: Run reference to the deployed Security libs still missing???)

EXCEPTION:

java.lang.NoClassDefFoundError: com/sap/security/api/UMFactory

I hope this gives enough of an overview. Can you assimilate the problem? If yes an example of your own will be rewarded generously:)

Thanks in advance,

Todor Petrov