cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to access external jars in DC during run time!!

Former Member
0 Kudos

Hi,

I tried to access KM APIs in DC. However, I fould the way DC imports external libraries is

quite different from web dynpro project. In web dynpro project, I just need to follow the

tutorial "Using Knowledge Management Functions in Web Dynpro" to add the class path and the

corresponding variables. Then I can access KM APIs smoothly.

But in DC, I do the same thing but unfortunately, I get the compilation error "package not found".

I searched the sdn and got some userful help. I have created an external library DC ,

J2EE server component DC and deploy to a server where my EP and J2EE engine resides.

I am able to see my deployed library which includes 6 jar files

in visual administrator. "libfile" is the name shown on my visual administrator.

I have added "libfile" to the web dynpro library references. But now I face a problem

that I can not reference to KM API in my DC during run time. For example,

WPUMFactory.getUserFactory() returns null which should not be this way

because I am able to get non-null value in my web dynpro project. It returns NullPointerException in this line:<b>IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);</b> Can someone share your experence with me about solving this problem?

thanks alot,

Zita

Accepted Solutions (1)

Accepted Solutions (1)

brahmanandam_ausali
Participant
0 Kudos

hi Zita

go through the following link.

which shows how to use external jars in the DC.

/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro

while reading the blog,

when you create the public parts, Create 2 public parts

one for API and the other for sda.

use these public parts in the webdynpro dc.

while selecting the options use following.

for API public part.

buid time = true.

for sda public part

build time = true.

runtime = true.

dependency = strong.

if u have any issues please reply

regards

Brahmanandam Ausali

Former Member
0 Kudos

Hi Brahmanandam,

I did follow the blog to create a DC library (libjar) including the jars ( two public parts : api and sda). I also created a J2EE server component/library (api-jar)to add used DC "libjar". And then, I created a web dynpro DC add these public parts in libjar. I also added "api-jar" in web dynpro preference/library references. Actually, now I get the following error when deploying my web dynpro DC <b>"java.lang.LinkageError: loader constraints violated when linking com/sap/security/api/IUser class"</b>

Please kindly let me know where the problem may occur?

thanks,

Zita

Former Member
0 Kudos

Zita,

Because you do not need extrenl library here. You packaged existing SAP library as external and attempt to load it second time (first time it is loaded by SAP WebAS itself).

What you need is just 2 references to existing SAP libraries: one to some portal library and second to com.sap.security.api.sda

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery,

Although my problem has not been solved, I still want to give you 10 points since ur blog "A bit of (impractical) scripting for Web Dynpro" has helped me alot and guided me to the direction.

As your said I need just 2 references to existing SAP libraries: one to some portal library and second to com.sap.security.api.sda. I did add used DC "com.sap.security.api.sda" but what do you mean by referencing one to some portal library? I have one library DC (libfile) with two public parts (API and SDA) which includes 6-7 portal jar files. I have another J2EE server component (api-jar) which adds the libfile as used DC. I also have a web dynpro DC which configures the "api-jar" in web dynpro preference/library references. Other than this, what else should I do?

I do not need external library? Then, how can I reference these portal libraries?

I keep getting "java.lang.NullPointerException" in line <b>IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);</b> after deploying the web dynpro DC to IE. Do you know what this may result from?

Funny thing is that I can excute <b>RID pathRID = RID.getRID(path);</b> RID is supposed to be an API in portal jar file though. Therefore, it makes me think that I may be able to reference some portal jar files???

Hope you can help me clear this out. I have been got stuck on this since last Friday.

Greatly appreciate for your time and answer.

Zita

Former Member
0 Kudos

Zita,

<b>DO NOT DEPLOY PORTAL JARS YOURSELF</b>

You do not need external library at all here.

Please read this blog: /people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis

It describes necessary references. In fact, you need only one <b>Sharing reference</b>: PORTAL:sap.com/com.sap.km.application

VS

Former Member
0 Kudos

Hi Valery,

I did follow this blog in the beginning when implementing the KM functions in "web dynpro project", but unfortunately, it does not work for developement component. That's why I searched the SDN web site and followed your solution. All the jar files added to PORTAL_HOME will disappear automatically during build time and "PORTAL:sap.com/com.sap.km.application" will cause the compilation error ( something "hard-reference"??)

Please help...what else can I do?

thanks,

Zita

Former Member
0 Kudos

Hi Valery,

Thank you so much for giving me this hint. My problem has been solved.

This is how I do:

1. Added used DC of two public parts (API & SDA) created in library DC for the reference of build time.

2. Added PORTAL:sap.com/com.sap.km.application in sharing reference for the reference of run time.

Zita

Former Member
0 Kudos

Hi Zita

How you solve the problem the the jar files added to PORTAL_HOME disappear automatically .I have faced that problem.

And what dc library you are using , j2ee server component or the externel lib.

Thanks a lot ,I have stuck on it a long time .

Regards

jian

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Have you set the external library DC you created as a used DC in your main project? Its in the DC metadata part of your project structure.

Hope this helps,

Gareth.

Former Member
0 Kudos

Hi Gareth,

Yes, I have done this step.

Zita