cancel
Showing results for 
Search instead for 
Did you mean: 

Correct steps to use Java class in WD Java DC from another WD Java DC

Former Member
0 Kudos

Hi, all.

Our env is NW2004s SP10 NWDS + NWDI.

Our scenario is like the following.

- We have two Web Dynpro Java DCs. DC A, DC B.

- DC A has only java library classes(say HelloClass) but we

created DC A as WD Java DC for deployment

- DC B wants to use this java class in WD Java DC A.

In this case, what is the correct steps?

Public Parts options, DC B properties(library reference) and so

on.

i found many forum threads about NoClassDefFoundExceptions but

i couldn't find exact match for this. And

Note 798872 - NWDI: Development Component Dependencies

was difficult to understand.

Best Regards.

Sejoon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ahn,

Here is the solution:

1. Create DC-A

- using External Library DC

- Add you JARs (add your classes to one Jar)

- Create Public Parts

- API (Compile/Build purpose)

- Assembly (Deployable purpose)

- Checkin/Activate the Activity for this DC-A

2. Create DC-B

- Depends on your purpose i.e, may be WD or Portal Application

- In the USED DCs add DC-A with public parts of API & Assemble (assembly depends on your case)

- Now Build and Check-in/Activate

This way you can put all your Classes in the External DC. Use this external DC in your required other DCs.

Yeah, NoClassDef problem comes if you use 2 DCs using the same External DC and trying to pass object between these 2 DCs where the classes are in External DC.

Thanks,

Raags

Former Member
0 Kudos

Hi, Raags.

Thank you very much for you answer.

But for DC-A, is it also possible to use WD DC instead of External

Library DC? If so, how? i tried to create WD DC which only has Java

classes but stuck with NoClassDefFoundExceptions.

Well, it's because we don't want to consider other DC types for our

development. We want to use only one DC type(WD Java DC) as far as

possible.

Best Regards.

Sejoon

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sejoon,

Plan A:

- Create a public part with purpose "compilation"/"API" in your DC A. Add a entity of type "Java Package" or "Java Package Tree" that exposes your API from that DC

- Define a build-time dependency from DC B to that public part

- Define a runtime dependency from DC B to DC A. You may also have to add a "Sharing reference" in the Webdynpro preferences to DC A.

Plan B: If DC B is the only user of DC A:

- manually edit the .dcdef file of DC A to turn DC A into a plain "Java" DC (edit the type and the build plugin reference). Recreate your project.

- create two public parts, one with purpose compilation, one with purpose assembly

- define build-time dependencies from DC B to both public parts. That way the Jar from DC a should be assembled into the WebDynpro application and you don't have to use runtime dependencies.

Having only one type of DCs is an interesting limitation, but maybe not a good one. If your DC really only contains Java code and is potentially reused from multiple Applications it makes more sense to put the Java code in a Java DC and wrap it into a J2EE Server Component/Library. The overhead for building a WebDynpro is rather high in comparison.

Regards,

Marc

Former Member
0 Kudos

Hi, Marc.

Thanks always.

i tried Plan A and it worked well with the Sharing reference option when

i deployed test app on the local J2EE.

But... i think you already know what i'm asking

But when i deployed test app to the dev machine via DTR and CBS,

NoClassDefFoundExceptions happens.

What do i have to do with NWDI for solving this problem? Do i have to

do something for sharing reference being effective on the dev machine?

Best Regards.

Sejoon

Former Member
0 Kudos

Hi Sejoon,

well, since you wrote that you deployed the test app via DTR and CBS I assume you checked in your changes and theoretically that should be all. So much for theory.

Was the referenced application really deployed on the dev runtime system? If you look at the application-j2ee-engine.xml of DC B (e.g. by downloading the deploy archive from CBS WebUI): Is there a reference that matches the sharing reference?

Regards,

Marc

Former Member
0 Kudos

Hi Sejoon,

You can go through the following excercise which talks about the usage of public parts from one WD Dc into another:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c8780... [original link is broken]

From the link Two Excercises you can get the PDF which describes the process and Steps. Hope it helps.

Regards,

Alka.