cancel
Showing results for 
Search instead for 
Did you mean: 

Creating iviews programatically - getting OperationFailedException

Former Member
0 Kudos

Hi,

While creating a iViews programatically I am getting

OperationFailedException exception.

This is the piece of code which is throwing the exception

NewObjectDescriptor IVtoCreate = null ;

try

{

IVtoCreate = (NewObjectDescriptor) iViewSrv.instantiateDescriptor(CreateMethod.NEW,

"pcd:portal_content/com.sap.pct/every_user/general/iViews/com.sap.km.iviews/com.sap.km.NewsBrowser" ,

request.getUser()); }

catch( ObjectNotFoundException ex)

{

ex.getMessage() ;

}

catch( OperationFailedException ex)

{

ex.getMessage();

}

I am using EP SP9. and

I want to create a iview from NewsBrowser.

I tried with NEW as well as DELTA_LINK way , still I am getting the same error.

can anyone please help on this

thanks

pk

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Check the code snippet below.

/**************************************************/

Object user = request.getUser();

Hashtable env = new Hashtable();

env.put("java.naming.factory.initial", "com.sapportals.portal.pcd.gl.PcdInitialContextFactory");

env.put("java.naming.security.principal", user);

INewObjectDescriptor iDesc = null;

IiViews iSrv = (IiViews) PortalRuntime.getRuntimeResources().getService("com.sap.portal.ivs.iviewservice.iViewsSrv");

try {

Context iCtx = new InitialContext(env);

Context iviewCtx = (Context) iCtx.lookup("portal_content/sample/iViews);

iDesc = (INewObjectDescriptor) iSrv.instantiateDescriptor(

CreateMethod.DELTA_LINK, sampleiViewName ,

(IPrincipal) user);

}

catch (NamingException ne) {

//logger component statements

}

/*********************************************/

Regards,

S.Divakar

Former Member
0 Kudos

Hi Divakar,

thanks for the reply.

I am still getting the same error( operation failed exception)

thanks

pk

Former Member
0 Kudos

Hi,

check if you are able to create iview manually.. and if yes try creating programmatically with the same user.

Regards,

S.Divakar

Former Member
0 Kudos

Hi,

I am trying to create with content Admin role.

In studio I am able to create the content , role evrything

, only programatically I am getting this error.

thanks

pk

Former Member
0 Kudos

Hi,

get the complete error log (do not trap the exception), may be we can have a better pictur then.

Divakar

Former Member
0 Kudos

hi ,

w/o capturing the error , I can not compile .

can please send your par file ?

I am using EP 6 SP9

and

SAP NetWeaver Developer Studio

Version: 2.0.7

Build id: 200407270250

which is your Netweaver studio version

thanks

pk

Former Member
0 Kudos

my mail id is epkiran@gmail.com

Former Member
0 Kudos

Hi,

am using NWDS 2.0.9 which comes along with the installation of SP9.

aslong as you are having the right jars you should be able to get it working.

Divakar