cancel
Showing results for 
Search instead for 
Did you mean: 

Portal Runtime - NoClassDefFoundError

Former Member
0 Kudos

Hi all,

I am trying to develop webdynpro application for reading user-mapping data. I have set user mapping for few testing users, but I have problem with Portal Runtime service in WebDynpro (I think).

I have imported all required JAR files (as external JARs)

My code is:

-



import java.util.HashMap; 
import java.util.Map;

import com.sap.security.api.IUser;
import com.sap.security.api.umap.IUserMappingData;
import com.sap.security.api.umap.IUserMappingData;
import com.sap.security.api.umap.NoLogonDataAvailableException;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;

import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.portal.prt.service.usermapping.IUserMappingService;

...

// get user
IUser iuser = WDClientUser.getClientUser("MY_USER_NAME").getSAPUser();
		
// get umapping service
IUserMappingService iums = (IUserMappingService)
	PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);
	
// retreive mapping data 	
IUserMappingData iumd = iums.getMappingData("SYSTEM", iuser);
			
Map map = new HashMap();
		
try {
	iumd.enrich(map);
} catch (NoLogonDataAvailableException nldae){
	nldae.printStackTrace();
}
String userid = (String)map.get("user");

Problem is, that when I'm trying to get mapping service (line with comment // get umapping service), program ends with error below:



java.lang.NoClassDefFoundError: com/sapportals/portal/prt/runtime/PortalRuntime 

at com.deloitte.MainView.wdDoInit(MainView.java:122)
at com.deloitte.wdp.InternalMainView.wdDoInit(InternalMainView.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
... 30 more

I tried to solve this problem by adding ServiceReference it returned another error



Application error occurred during request processing. 
 Details:   com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to start the deployable object 'local/PortalUserMapping'.  The ID of this error is 
Exception id: [000423C3F96D0066000000A5000015C800041BAFDA989CFF].

We have installed Portal and WebDynpro systems on two different servers, would this be the problem?

Does anybody know how to solve this problem, or is there any other way how to get mapped user name of Portal user?

I would appreciate any help,

many thanks

Pavel

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

if the wedynpro container and EP system runs on different machine, UME APIs will not work. You can access the user mapping data through EP user management Web Service. So import the webservice model into your webdynpro and use UMWebService to get the user mapping data.

You can get the WSDL file from following link from your EP server.

http://<portal_host>:<portal_port>/irj/servlet/prt/soap/UMWebService?Wsdl

Please reward me if this answer is helpful.

Regards

Srinivasan

Former Member
0 Kudos

Hi Srinivasan,

I did have no idea that Portal Services can be used as WebService.

Now I have developed my application as Portal Component and uploaded in Portal. But I think that solution with WebServices is better and I will test it.

Thank you very much.

Pavel

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

This may be version problem.

try to deploy the jar file

com/sapportals/portal/prt/runtime/PortalRuntime/

as library project and make it as reference in the current project ant try it

Kind Regards

Mukesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

PortalRuntime and other jars used in portal will be private to portal applications only. To use it in webdynpro applications, u have to include prtapi.jar

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Thanks Mukesh and Vijayakhanna,

I tried to rebuild whole WebDynpro project, but I don't know how to rebiuld only one JAR file, could you please tell me how to do it in DevStudio? I am new with WebD

Vijayakhanna,

can you please advise me how can I include prtapi.jar? I've added this file as External JAR library (WebDynpro project properties > Java Build Path > Libraries Tab), is it correct, or should I do something else?

Thank you,

Pavel

Former Member
0 Kudos

Hi

See the Thread for create a library project

Kind Regards

Mukesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Ya.. prtapi.jar should be included as external jars to ur project. But <b>the code u have mentioned will not work</b> since IPortalComponentRequest, IPortalComponentResponse will all work only in portal applications. If u have some portal applications as sharing reference to the webdynpro application, then adding prtapi.jar will help ur webdynpro application understand the portal application. But I am not sure if portal application specific classes (if directy used) will work in webdynpro. So try to do some other code to get the users.

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi,

thank you for explanation..

I need to create a simple webdynpro, or JSP (if it is possible) to report mapped users in Portal (this application should be run-able in Portal, for example via iView).

Can you please advise me, if it is possible to create this program/report using another Portal development technology than WebDynpro? I mean for example simple JSP page.

Otherwise I found another way hot to get UserMapping (in WebDynpro), but I have another problem with retrieving SystemLandscapes.

My code is:


try {	
	final List wrappers = UMFactory.getSystemLandscapeWrappers();	
	
	wdComponentAPI.getMessageManager().reportSuccess(""+wrappers.size());
	
	for (int i = 0;i < wrappers.size(); i++) {		
		ISystemLandscapeWrapper e = (ISystemLandscapeWrapper) wrappers.get(i);		
		system = e.getSystemByUniqueKey("CN");		
		if(null==system) {			
			system = e.getSystemByAlias("SAP_WebDynpro_XSS");			
			if(null!=system) {				
				break;			
			}		
		} else {			
			break;		
		}	
	}
} catch (ExceptionInImplementationException e) {	
}

Problem is on first line - I get no system in List variable (wrappers.size > 0). But in Portal we have specified landscapes and I used them for setting user-mapping in Portal.

Can you please help me?

Many Thanks

Pavel

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

To get iums, instead of PortalRuntime, use WDPortalUtils like this to get instance of service.

IUserMappingService iums = (IUserMappingService)WDPortalUtils.getServiceReference(IUserMappingService.KEY);

Don't forget to add the user mapping service in services reference.

Right click ur webdynpro project -> Properties -> Webdynpro references ->service reference -> Add -> PORTAL:sap.com/com.sap.portal.usermapping

When I searched regarding this, I got this thread.Also check it.

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi Vijayakhanna,

Thanks, but I tried it and I also added Service Reference,

but Deployment finished with warning:

---

Finished with warnings: development component 'PortalUserMapping'/'local'/'LOKAL'/'0.2006.08.24.15.17.22':

Caught exception during application startup from SAP J2EE

Engine's deploy service: java.rmi.RemoteException: Error occurred while starting application local/PortalUserMapping and wait. Reason: Clusterwide exception: server ID 4106850:com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to prepare application ''local/PortalUserMapping'' for startup. Reason=Clusterwide exception: Failed to start dependent service ''PORTAL:sap.com/com.sap.portal.usermapping'' of application ''local/PortalUserMapping''. Status of dependent component: STATUS_MISSING. Hint: Is the component deployed correctly on the engine?

I read something about activating (or starting service in Portal), but I cannot find service like usermapping or something like that. Do you have any idea what this message means?

Thank you very much,

Pavel

Former Member
0 Kudos

Hi,

unfortunately I found, that using of service/shared reference needs to have Portal and WebDynpro system on same machine. But we have them on different computers.

Please, can anybody tell me if exists some another way how to get user mapping? I'm new with Portal Development and my idea is to create simple JSP page(s) to get mapping data. Is it possible? Is it possible to add my JSP page into Portal (i.e. as iView source) and use Portal objects in it(for example current logged user - IUser)? If yes, would you please give me very short description or some useful link? If not, can you please advise me if there is another way how to create application I need (without WebDynpro)?

I would appreciate any help,

thanks,

Pavel

Former Member
0 Kudos

Hi

to get the current user try this

IWDClientUser wdUser = WDClientUser .getCurrentUser();

IUser user = wdUser.getSAPUser();

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mukesh,

thanks for advice.

If I changed it, but it is same. I need to get user mapping for more users, not only for current user, that is the reason why I used WDClientUser.getClientUser.

Do you know what is problem?

Thanks, Pavel