cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot import com.sapportals.portal.security.usermanagement.IUserFactory in NWDS 7.0

Former Member
0 Kudos

Hello Experts,

I have developed a Web Dynpro Java application in NWDS 7.0.1 to connect KM repository.

For importing external jars I have created External Library DC and added the below jars to the public part (Assembly and Compilation)

bc.rf.framework_api.jar

bc.rf.global.service.urlgenerator_api.jar

bc.sf.framework_api.jar

bc.util.public_api.jar

com.sap.security.api.ep5.jar

com.sap.security.api.ep.jar

prtapi.jar

After adding assembly public part to the deployable unit of the External Library DC, the deployable unit has been added successfully to the WD application as a used dc. Library and sharing references have been added. WD dc built successfully but for implementation I cannot import the following:

import com.sapportals.portal.security.usermanagement.IUserFactory;

import com.sapportals.wcm.repository.ICollection;

import com.sapportals.wcm.repository.IResource;

import com.sapportals.wcm.repository.IResourceContext;

import com.sapportals.wcm.repository.IResourceFactory;

import com.sapportals.wcm.repository.IResourceList;

import com.sapportals.wcm.repository.IResourceListIterator;

import com.sapportals.wcm.repository.ResourceContext;

import com.sapportals.wcm.util.uri.RID;

import com.sapportals.wcm.util.usermanagement.WPUMFactory;

I am using the below code for my application:

          IWDClientUser currentWDUser = null;

          currentWDUser = WDClientUser.getCurrentUser();

          com.sapportals.portal.security.usermanagement.IUser ep5User = null;

          com.sap.security.api.IUser user = currentWDUser.getSAPUser();

                    IUserFactory portalUserFactory = WPUMFactory.getUserFactory();

                    ep5User = portalUserFactory.getEP5User(user);

                    IResourceContext context = new ResourceContext(ep5User);

                    String resourceID = wdContext.currentContextElement().getConditionOfSupplyFolder();

                    IResourceFactory resourceFactory = com.sapportals.wcm.repository.ResourceFactory.getInstance();

                    RID rid = RID.getRID(resourceID);

                    ICollection collection = (ICollection)resourceFactory.getResource(rid,context);

                    IResourceList resourceList = collection.getChildren();

                    IResourceListIterator resourceListIterator = resourceList.listIterator();

                    wdContext.nodeKMContent().invalidate();

                    while (resourceListIterator.hasNext()) {

                              IPublicPspclDocsComp.IKMContentElement contentElem = null;

                              contentElem = wdContext.nodeKMContent().createKMContentElement();

                              com.sapportals.wcm.repository.IResource tempResource = resourceListIterator.next();

                              contentElem.setConditionOfSupply(tempResource.getName());

                              wdContext.nodeKMContent().addElement(contentElem);

                    }

                    if(wdContext.nodeKMContent().size()<6){

                              wdContext.currentContextElement().setLineItem(wdContext.nodeKMContent().size());

                    }else{

                              wdContext.currentContextElement().setLineItem(5);

                    }

Any help you can provide on this problem is very much appreciated.

Thanks in advance

Ghanshyam.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

After creating the "AssemblyPP" as you've mentioned in your problem

statement, did you update its purpose to “Assembly” in properties window?

If not, please do it and try once as I feel that the Jars are not properly refer

enced due to which you are not able to use them in your WD Java comp.

Moreover, as Sandip has suggested you can also add the following SCA's

to your existing custom SC as build time dependencies. Once added, the

SCA's will be visible in the track. This way you do not need to create any

external library DC to reference the JARs in your WD DC.

KMC BASE COMPONENTS 7.01

KMC COLLABORATION 7.01

KMC CONTENT MANAGEMENT 7.01

Please let me know if you face any further issues on this.

Former Member
0 Kudos

Thanks Anurag for your reply.

The issue has been resolved after adding the compilation pp to the deployable unit as a used DC. Previously I have added the assembly part only.

But now I am getting a new error while trying to run my application.

java.lang.NullPointerException

It comes because of the IResourceList resourceList = collection.getChildren(); line of the code.

Please help me out.

Thanks and Regards,

Ghanshyam

junwu
Active Contributor
0 Kudos

debug code and check authorization

Former Member
0 Kudos

Solved. Thanks Jun.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ghansyam,

go to  DC MetaData->UsedDCs and right click you will get Add used dc ..now  select

Local Devlopments->SAP-JEE and choose com.sap.security.api.sda .

then try to orgenise Import shift+ctrl+o.

Regards,

Trilochan

junwu
Active Contributor
0 Kudos

have you add dependency to the compilation pp?

Former Member
0 Kudos

After creating the "AssemblyPP" as you've mentioned in your problem

statement, did you update its purpose to “Assembly” in properties window?

If not, please do it and try once as I feel that the Jars are not properly refer

enced due to which you are not able to use them in your WD Java comp.

Moreover, as Sandip has suggested you can also add the following SCA's

to your existing custom SC as build time dependencies. Once added, the

SCA's will be visible in the track. This way you do not need to create any

external library DC to reference the JARs in your WD DC.

KMC BASE COMPONENTS 7.01

KMC COLLABORATION 7.01

KMC CONTENT MANAGEMENT 7.01

Please let me know if you face any further issues on this.

Former Member
0 Kudos

After creating the "AssemblyPP" as you've mentioned in your problem

statement, did you update its purpose to “Assembly” in properties window?

If not, please do it and try once as I feel that the Jars are not properly refer

enced due to which you are not able to use them in your WD Java comp.

Moreover, as Sandip has suggested you can also add the following SCA's

to your existing custom SC as build time dependencies. Once added, the

SCA's will be visible in the track. This way you do not need to create any

external library DC to reference the JARs in your WD DC.

KMC BASE COMPONENTS 7.01

KMC COLLABORATION 7.01

KMC CONTENT MANAGEMENT 7.01

Please let me know if you face any further issues on this.

Former Member
0 Kudos

The above reply is not intended for John...

Apologies for replying accidentally...

Please let me know how could I remove the above posts.

Regards,

Anurag

SandipAgarwalla
Active Contributor
0 Kudos

Are you not able to import only the following class

com.sapportals.portal.security.usermanagement.IUserFactory or all the classes?

Moreover, all these are already available as part of SAP's standard DCs..I dnt think you need to add them explicitly..

Moreover I dnt think so there is any jar with name - com.sap.security.api.ep.jar, rather its com.sap.security.api.jar

Former Member
0 Kudos

Yes it is com.sap.security.api.jar.

I am not able to import com.sapportals.portal.security.usermanagement.IUserFactory or all the classes only.

If these are the SAP's standard DCs then kindly suggest me the same so that I can import all the required classes in my DC.

SandipAgarwalla
Active Contributor
0 Kudos

If you are not able to import all classes, looks like some issue with the public part compilation or reference..did you add the external DC as used DC and assign the references (design time, build time, run time) correctly???

On the standard DCs, if I can remember the names (hard ..) - those are

1) com.sap.security.api.sda - under the SCA ENGINEAPI

Similarly find out the name for other JARs..Most of the time it would be the same with .sda..

All these are available under the following SAP SCAs

1)ENGINEAPI

2) EP-RUNTIME

3) EP-BUILDT

4) WD-RUNTIME

Add these SCAs/SDAs for your WD JaVA DC..

Just do some ground work, you can get it easily...Have the passion of Exploring...

Former Member
0 Kudos

Thanks Sandip for your reply.

The problem has been resolved after adding the compilation pp to the deployable unit as a used DC. Previously I have added the assembly part only.

But now I am getting a new error while trying to run my application.

java.lang.NullPointerException

It comes because of the IResourceList resourceList = collection.getChildren(); line of the code.

Please help me out.

Thanks and Regards,

Ghanshyam


SandipAgarwalla
Active Contributor
0 Kudos

Just see if the resource/folder has any documents inside???

can oyu post the previous line of codes (4-5)???

Check if you have the data to read it..Else put an if condition

if(collection.hasChilderen())

Then only IResourceList resourceList = collection.getChildren()

Else{

do soemthing else

}

Former Member
0 Kudos

Solved. Thanks Sandip.

SandipAgarwalla
Active Contributor
0 Kudos

thats good to hear.....award points for others; effort and close this thread as answered..

So what line of code from the ones I gave worked for you????