Showing results for 
Search instead for 
Did you mean: 

Must WebDynpro and EJB be on the same server?

Former Member
0 Kudos

I've been writing about when JSPDynPage and WebDynpro are better for WebApplications in /thread/33637 [original link is broken]

The point that I'm not sure of is, if WebDynpro and EJB must be on the same server or if WebDynpro could access EJB on other servers?

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Manuel,

I suppose you have doubts about this scenario: You have a WebDynpro app that will be deployed to Web AS instance A and that has to access an EJB that will be deployed to Web AS instance B, whereas A and B don't form a cluster.

Well, in general you can do it - lookup the EJB and call its methods remotely. In this case you may want to have a look at <a href="">this document</a> - there is a special property "force_remote" which must be specified when constructing the JNDI InitialContext.

However, for performance reasons I'd suggest you to deploy both apps on the same Web AS instance and make use of EJB local interfaces. Thus you benefit from local method invocation (i.e. in the same JVM), no need of routing to another Web AS dispatcher, no need of method parameters serialization and deserialization, and so on and so on.

Hope that was of help!


Former Member
0 Kudos


I have accessed the EJB deployed on a different server with a web dynpro application.

It is quite possible.



Active Participant
0 Kudos


I am using the following code for accessing an ejb from a portal component(JSPDynPage)::

IPortalComponentRequest newRequest =(IPortalComponentRequest) this.getRequest();

IPortalComponentSession newSession = newRequest.getComponentSession();try {

Sender sender = (Sender)newSession.getValue("sender");

if ( sender == null )


Context ctx = new InitialContext();

Object ref = ctx.lookup("MessageSender");

System.out.println("After lookup: " + ref.getClass().getName() );

SenderHome senderHome =(SenderHome)P4ObjectBroker.init().narrow(ref,SenderHome.class);


sender = senderHome.createSender();



Message Sender is the JNDI name of the session bean

This code is givivng an error of

When I am using SenderLocalHome instead of SenderHome it does not give exception but does not fetch the create() function in the bean.

Moreover the ref that it fetches is :HomeRMI_P4:Dynamic

why is it that it fetches a reference of Senderhome instead of SenderLocalhome?