Skip to Content
author's profile photo Former Member
Former Member

How can I persist a Java object to the PCD via JNDI ?

Hi,

I'm trying to persist XML data on the PCD via JNDI. I'm using

portal version 6.2.0.4.200408172051.

I followed the instructions in the "Portal Runtime Technology 640"

document.

The example they showed was:

import javax.naming.Context;

...

Context context = PortalRegistry.getCentralConfigurationContext();

Context applicationContext = context.lookup("MyAppName");

It was possible to obtain 'applicationContext' in the above example by

using:-

Context context = PortalRegistry.getCentralConfigurationContext();

String appName = request.getComponentContext().getApplicationName();

Context applicationContext = (Context) context.lookup(appName);

However, any attempt to bind, rebind an object (implementing IStreamSource)

resulted in NamingExcptions. As did 'listBindings' and 'list' (see below).

BeanWrapper d = new BeanWrapper("test input");

applicationContext.rebind("PCD_LOOKUP_KEY", d);

// where 'd' implements IStreamSource

class BeanWrapper implements IStreamSource {

String content = "balh";

BeanWrapper(String s) {

content = s;

}

public InputStream getInputStream() throws IOException {

ByteArrayInputStream bis = new ByteArrayInputStream(content.getBytes());

return bis;

} // getInputStream

} // BeanWrapper

I don't know what I've done wrong. I couldn't find any more documentation

on this topic...

Any help would be appreciated.

cheers,

Michael

javax.naming.NameNotFoundException: [Xfs] Object not found. Root exception is javax.naming.NamingException: [Xfs] Object not found

at com.sapportals.portal.pcd.gl.xfs.BasicContext.lookup(BasicContext.java:840)

at com.sapportals.portal.pcd.gl.PcdPersContext.lookup(PcdPersContext.java:422)

at com.sapportals.portal.pcd.gl.PcdFilterContext.filterLookup(PcdFilterContext.java:387)

at com.sapportals.portal.pcd.gl.PcdProxyContext.basicContextLookup(PcdProxyContext.java:1083)

at com.sapportals.portal.pcd.gl.PcdProxyContext.proxyLookupLink(PcdProxyContext.java:1170)

at com.sapportals.portal.pcd.gl.PcdProxyContext.proxyLookup(PcdProxyContext.java:1132)

at com.sapportals.portal.pcd.gl.PcdProxyContext.getBasicObject(PcdProxyContext.java:1330)

at com.sapportals.portal.pcd.gl.PcdProxyContext.getBasicContext(PcdProxyContext.java:1306)

at com.sapportals.portal.pcd.gl.PcdProxyContext.rebind(PcdProxyContext.java:473)

at com.sapportals.portal.pcd.gl.PcdGlContext.rebind(PcdGlContext.java:1185)

at com.sapportals.portal.pcd.gl.PcdProxyContext.rebind(PcdProxyContext.java:515)

at com.sapportals.portal.pcd.gl.PcdProxyContext.rebind(PcdProxyContext.java:683)

at com.sapportals.portal.pcd.gl.PcdProxyContext.rebind(PcdProxyContext.java:688)

at com.sapportals.portal.prt.jndisupport.util.AbstractContextWrapper.rebind(AbstractContextWrapper.java:46)

at com.siemens.pct.employee.cu_selector.CUSelector.saveCuBeanToPCD(CUSelector.java:305)

at com.siemens.pct.employee.cu_selector.CUSelectorUpload.doUpload(CUSelectorUpload.java:70)

at java.lang.reflect.Method.invoke(Native Method)

at com.sapportals.portal.prt.component.AbstractPortalComponent.handleRequestEvent(AbstractPortalComponent.java:700)

at com.sapportals.portal.prt.component.AbstractPortalComponent.handleEvent(AbstractPortalComponent.java:412)

at com.sapportals.portal.prt.pom.ComponentNode.handleEvent(ComponentNode.java:250)

at com.sapportals.portal.prt.pom.PortalNode.fireEventOnNode(PortalNode.java:333)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:627)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:208)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:532)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:832)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:666)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:313)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)

at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)

at java.security.AccessController.doPrivileged(Native Method)

at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 10, 2005 at 05:35 PM

    Hi Michael,

    the problem is shortly speaking:

    "There is no object provider defined for the class 'BeanWrapper' that you want to rebind to a Context":

    BeanWrapper d = new BeanWrapper("test input");

    applicationContext.rebind("PCD_LOOKUP_KEY", d);

    -> throws a NamingException with detail message:

    'No schema definition found for BeanWrapper'

    The Pcd always needs this object provider that exposes a corresponding class in the schema definitions.

    Now you want of course to know how to write an object provider (for the class you want to rebind).

    Before I start to help with this I have to say that the PCD API is not public for SP2 release, which explains why only few information can be found for real technical issues for the PCD (e.g. how to write an object provider).

    The first time the PCD API will be public is SP10!! And for this release there are PCD javadocs that will also contain a section "how to write an object provider".

    Most of the things that are described in SP10 PCD javadocs will be valid also for SP2 (but not all - and the PCD API for SP2 is not supported[==NON public] whereas for SP10 it is fully supported). So you can try to use the information you will get from SP10 PCD javadocs and test it for SP2 [but don't complain if tiny things will not work ;-)]

    I will try to publish the SP10 PCD javadocs on SDN which might take a few days. When I finished this I contact you again so that you have a chance to study the javadocs so that you might solve the problem you mentioned above.

    A last thing I have to mention here is that Writing an object provider is not something you are doing in 5 minutes! It's more a job for a couple of days if you are an experienced java developer including knowledge of writing PRT services!

    So, I can't do more for the moment. As soon as I have managed to publish the SP10 PCD javadocs you will hear again something from me.

    So far,

    Regards,

    Jens

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Michael,

      I just figured out that the Pcd javadocs for SP9/10 are already available on SDN:

      Here you can find it:

      Navigate to

      Home -> Enterprise Portal -> (scroll down the SAP Enterprise Portal page)

      find on this page at the bottom the Section "Library" -> Development -> Javadocs (click on this link)

      Click on the SP9 link

      On the page that opens find under Enterprise Portal APIs the PCD GL link which opens the PCD Generic Layer

      API.

      On the opened window click in the right frame the "com.sapportals.portal.pcd.gl" link (don't click the same link in one of the left side iFrames!

      Regards,

      Jens

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.