cancel
Showing results for 
Search instead for 
Did you mean: 

How to lookup PersistenceManagerFactory for JDO in WebDynpro?

Former Member
0 Kudos

Hi,

I tried the following scenario to use JDO :

Servlet -> Session Bean -> JDO. (i.e., A servlet calls JDO using Session bean).

I have used the following JNDI lookup to call the JDO's default PMF.

(PersistenceManagerFactory) ctx.lookup("java:comp/env/jdo/defaultPMF");

It works fine.

Now I am trying to use the JDO in my Web Dynpro Project:

The following is my current scenario

WebDynpro ->Command Bean -> Session Bean -> JDO.

I am using the same JNDI lookup.[i.e., (PersistenceManagerFactory) ctx.lookup("java:comp/env/jdo/defaultPMF");]

But,I can't resolve the JNDI lookup when using webdynpro as presentation layer.

Can anybody pls help me?

Thanks in advance,

Krishna Kumar

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi all,

have anyone idea how it can work? I have the same problem.

Thx

Stefan

Former Member
0 Kudos

Stefan,

Did you try

(PersistenceManagerFactory) ctx.lookup("jdo/defaultPMF");

i.e. relative path?

At least, it works this way with JDBC connections...

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

yes, but i get a message:

Path to object does not exist at jdo, the whole lookup name is jdo/defaultPMF.

Former Member
0 Kudos

Stefan,

Run Visual Administrator, open "Connector Container" and check that Connector 1.0 > sap.com/com.sap.jdo connector is running.

VS

J_B
Explorer
0 Kudos

Hello,

i have the same problem with jndi lookup.

sap.com/com.sap.jdo connector is running !!

i tried several combinations, but i always get the same error.

How can I solve this problem ?

Regards

Jürgen

Former Member
0 Kudos

Valery,

it is running. The Sample-Servlet works with the whole String: java:comp/env/jdo/defaultPMF.

Have u some other idea?

thx

Stefan

J_B
Explorer
0 Kudos

Hi all,

i have debugged the application and two questions (or notes) to that problem.

I created a new InitialContext-Object and made the lookup with this code.

ctx = new InitialContext();

pmf = (PersistenceManagerFactory) ctx.lookup( "java:com/env/jdo/defaultPMF" );

The result of the debug of the InitialContext is that:

A DefaultInitialContext with the Key-Value-Pair of this attributtes.

defaultInitCtx= DefaultInitialContext (id=10257)

defaultInitContext= OffsetClientContext (id=10258)

additionalLoader= null

applicationName= "sap.com/tcwddispwda:"

cacheEnabled= true

classLoader= ApplicationLoader (id=10261)

commonLoader= null

fullNameInSpace= CompositeName (id=10262)

lastobj= true

localEnvironment= Hashtable (id=10263)

loginContext= LoginHelper (id=10264)

prefix= "webContainer/applications/sap.com/tcwddispwda/webdynpro/dispatcher"

referenceFactory= null

remoteContext= ServerContextImpl (id=10266)

remoteReferenceHash= null

root= "webContainer/applications/sap.com/tcwddispwda/webdynpro/dispatcher"

runOnServer= true

runOnServer= true

usePrefix= true

defaultInitCtx= null

gotDefault= false

myProps= Hashtable (id=10259)

Now i had a look to the J2EE Engine with the Visual-Admin and found the following info's.

Deployment:

The JDO-Project (as a EAR-Project) is deployed to the servlet_jsp-container.

The WebDynpro-Project is deployed to the webdynpro-container (This is so far clear and ok)

JNDI-Registry:

The following structure (Context) i see:

1. webContainer

2. applications

3. vendor name (sap.com)

4. project name

5. context node

6. java:com

7. env

8. jdo

9. defaultPMF

if had a look to the Context webContainer/applications/sap.com/tcwddispwda/webdynpro/dispatcher i can see, that there is no naming reference under java:com/env.

How can i cange the DefaultInitialContext to the application-context (Project-Context) or what is the correct lookup-string?

I have tested several combinations to the InitialContext to setup the environment and the lookup, but i always fault.

Thanks for help.

Regards

Jürgen