cancel
Showing results for 
Search instead for 
Did you mean: 

External Library DC:

Former Member
0 Kudos

Hi,

we are trying to use classes from external jars in a webdynpro-dc. We created an "External Library" DC, put the desired jar files in the folder "libraries", created public parts for the libraries and the added these public parts in the used-dc section of the webdynpro-dc. We followed the instructions given here:

http://help.sap.com/saphelp_nw04s/helpdata/en/5a/2e2f4234135433e10000000a155106/content.htm

Problem: From inside the webdynpro-dc we can't use the classes contained in the jars (included in the external-jar-dc). For example import-statements give errors ("import can not be resolved").

Does anyone has an idea what might be the reason for this problem?

Thanks in advance, regards

Jan Hempel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Go to the Used DC definition, right-click, Edit Used DC... and make sure that the Design time checkbox is selected. (Web Dynpro requires this to be selected).

Former Member
0 Kudos

Hi,

we have selected all checkboxes (build-, design-, deploy- and runtime). Unfortunately this does not solve the problem.

Any more ideas?

Thanks and regards,

jan Hempel

Former Member
0 Kudos

Try (re)building the External Library DC and then click Sync Used DCs in the context menu of the Web Dynpro DC.

Former Member
0 Kudos

Hi,

this also did not change the described situation.

I'm wondering: right now we are using the public parts of the inactive external-library-dc. Does this maybe only work when using the active version of external-library-dc? Unfortunately we can not try this, due to activation problems...

Another thing im curios about: When navigating to properties->java buildpath->projects I find some of the projects in my workspace, but not all of them. Which projects are listed here? And do I maybe need to reference the external-library-dc from here as well (unfortunately it is not listetd here though)?

Thanks for Your advice, regards

Jan

sid-desh
Advisor
Advisor
0 Kudos

Hi Jan,

I have used External Library DC. However as of now i am referencing from Active DC's only. I will try the scenario of referencing from Inactive DC's and let you know.

I feel only the local projects are listed here in my opinion. You dont need to reference the DC projects in this way. You are following the correct procedure as far as Used DC's is concerned.

Regards

Sidharth

Former Member
0 Kudos

What activation problems are you facing? Maybe there's a problem building the External Library DC. In that case the Used DC definition will not work.

Former Member
0 Kudos

Hi Guys,

first of all, thanks for Your support!

Second: We managed to resolve our activation-issues (we had build-erros on the cbs). So we were able to activate the development components.

We then referenced the public parts of the now activated external-library-dc, but we still can not use the classes contained in the jar-files of the external-library-dc.

By the way: We are using dependencies between different dc's all the time, and it always works fine. So this must be a problem which is specific to the dc-type "External Library".

Now I'm wondering: Maybe the external-library-dc is somehow not in a state it should be. For example:

When im switching to the Development-Configuration-Perspective in NDS, and look at the DC inside the view "Local DCs" the symbol for the external-library-dc is a little question-mark. Does this correspond to Your experiences?

Or do I maybe have to unpack the jar-files?

Any ideas are appreciated! Regards,

Jan

Former Member
0 Kudos

1. No, you don't need to unpack the jar files.

2. That question mark is the display icon for an External Library DC. Don't worry about it.

3. You only need a Design Time and Build time dependency. If you select Deploy time, you will never be able to deploy, since the External Library DC doesn't result in a deployable archive and will thus never be deployed.

Do you get any errors when you build the External Library DC? If not, you can try to delete and recreate the Used DC definition, this sometimes helps.

Also, please check the public parts by opening the DC tree and making sure that your jars are displayed as entities within the public parts.

Former Member
0 Kudos

Hi Pascal,

problem solved! I changed the way I added the public-parts! before I did it by navigating to "DC -> DC Meta-Data -> Public Parts -> New Public Part..." inside the Development Configurations Perspective.

Now I switched to the Navigator View and navigated to libraries, right cklicked on the jars and the "Development Component -> Add to public part". This did the trick!

The difference seems to be, that the entity of the jar-file in the public part is of type "Archive" instead of "File".

Thanks for Your support, You helped me a lot with Your suggestions!

Regards Jan

Former Member
0 Kudos

Nice to read that you got it to work. If you think our answers were of help... the SDN forums provide a nice reward system...

Former Member
0 Kudos

Hi Pascal,

I know about the points, but right after posting my final answer the sdn was down and not recovering until the evening.

If I could, I would reward You with 100 points

Regards

Jan Hempel

Former Member
0 Kudos

Thanks Jan,

You put me on the right track because I was really fooled by the whole process of using external librairies... For the benefit of other developers, here are a few more pointers:

To make sure you have done things right, check the content of *.pp files generated by NW in the "def" folder.

You should have something like this:

<public-part

xmlns=".....omitted for breivity">

<name>activation-assemb</name>

<purpose>compilation</purpose>

<entities>

<entity>

<name>activation.jar</name>

<package></package>

<caption>activation.jar</caption>

<description></description>

<entity-type>Archive</entity-type>

<entity-sub-type>Java Library</entity-sub-type>

</entity>

</entities>

</public-part>

In particular, the <entity-type> must be "Archive" and <entity-sub-type> must be "Java Library"... You can actually edit this file directly but you should try to get NW to generate it (only way I found is using Jan's method).

The <purpose> element is also important. For other DCs to see the jar at compile-time you need to have a *.pp file with <purpose> "compilation". To force NW to include the jars in a WAR (for example) you must define a second, identical *.pp file except that this time, the purpose must be "assembly" (the <name> must also be different). Suggestion: Shouldn't we be allowed to specify more than one purpose in the same *.pp file?

To add a jar to a deployable component such as a WAR, you need to add the external lib to the Used DCs of the WAR project...

REMAINING PROBLEM:

I have one caveat still unsolved: the jar files end up in the root of the WAR file but they should be in WEB-INF/lib...

Anyone know how to obtain the right WAR packaging ?

Final suggestion: To validate the result of a build for a deployable component, open the WAR or EAR with a tool such as WinRAR. Very useful for understanding what is actually happening.

Answers (0)