cancel
Showing results for 
Search instead for 
Did you mean: 

Stateful EJB Model in WebDynpro seems to be Stateless

0 Kudos

Hello,

in need a Example how to use a @Stateful-EJB in WebDynpro(CE 7.1), wich was imported via Model.

I have a EJB, that works Stateful in a normal Java Application Client .

When i call some Methods of this EJB in a WebDynpro-Applikation, than i have always the initial state of the EJB (like stateless). The fist call (Login) works fine. All subsequent calls of Methods of the same EJB acts as when they use a new Instance of my Bean.

What can make wrong ?.

What are the importent things to use the Stateful-EJB correct in a java WebDynpro ?

Are Stateful EJB supported in WebDynpro (CE 7.1) ?.

Thanks for help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member190457
Contributor
0 Kudos

Hi Klemens,

Stateful EJB can be used but not as model.

To use Stateful EJBs in WDJ you must perform explicit lookup of the EJB you need.

Add the following dependency to the WDJ: engine.jee5.facade

add also the dependency to the EAR public part containing the EJB class reference to the EJB DC.

In you component controller do as follows


InitialContext ctx = new InitialContext();
MyBeanLocal consumer = (MyBeanLocal) ctx.lookup(lookupString);
//use the bean

where lookupString is the JNDI name of the EJ bean/interface you need.

This can be found in NWA -> JNDI browser -> find your ejb interface in the tree and then use the Object Name string.

Please remember that stateful ejbs must be killed after usage or the engine will run out of memory.

Award points if this was useful

Thanks, regards

Vincenzo

Former Member
0 Kudos

Thank you Vincenzo, this was very helpful. Could you give another example where the ejb is killed. I'm not exactly sure how to do that. Thank you. Anthony K.

0 Kudos

Hi Vincento,

thank you for the answer !.

I solved my problem with your help.

Best Regards

Answers (2)

Answers (2)

0 Kudos

Hi Satish,

im sorry, but the 4 links has more questions than answers.

Link 3. describes may the same problem, but has still no answers !?.

Is there no complete example for using a Stateful EJB over model import in a WebDynpro (CE 7.1) ??.

Thanks

Best Regards

Klemens Heilemann

former_member190457
Contributor
0 Kudos

Hi all,

I would be interested in the same topic.

Can anyone please share their experience?

Is Stateful EJB Model supported?

Thanks, regards

Vincenzo

former_member185086
Active Contributor
0 Kudos

Hi

Have a look on these threads

1.[User session access in WebDynpro |;

2.[ stateful webapplication |]

3.[Stateful EJB in Web Dynpro|]

4.[EJB in WD|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502f70a8-33a4-2b10-3dbe-bdcb5e25c6da]

Best Regards

Satish Kumar