cancel
Showing results for 
Search instead for 
Did you mean: 

EJB3 JNDI Lookup

Former Member
0 Kudos

Hi,

I managed to install the new Web AS successfully and to connect to the JNDI Server.

Now I want to lookup my Bean on the server. I tried all possibilities to lookup the remote interface.

From the SAP Documentation it is written, that for non J2EE Applications the JNDI Lookuppath should be

sap.com/EARName/BeanClassName

Unfortunatly this does not work. I receive the following Error below.

Anybody able to help me? What I can do is a lookup of

sap.com/EARName

There I can do a list() oder listBinding() Operation which lists me my Beans available. Any Ideas?

Thanks in Advance Martin

[code]com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of Test.

at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:650)

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImpl.lookup(ServerContextRedirectableImpl.java:80)

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImplp4_Skel.dispatch(ServerContextRedirectableImplp4_Skel.java:872)

at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:253)

at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:109)

at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:841)

at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:125)

at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:59)

at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)

at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:168)

-


predecessor system -


[/code]

Accepted Solutions (0)

Answers (2)

Answers (2)

sid-desh
Advisor
Advisor
0 Kudos

Hello Martin,

Please refer to thread. Vladimir has given some tips on how to access an EJB.

Regards

Sidharth Deshpande

Former Member
0 Kudos

Unfortunatly is the information provided not totally correct. The refered PDF contains usefull information, but is too old to reflect the current status for the Java EE 5 Server.

To lookup the EJB using JNDI you need the following context:

sap.com/EARName/REMOTE/BeanName/full.package.and.class.for.RemoteInterface

Using this context a lookup was possible.

Regards,

Martin

sid-desh
Advisor
Advisor
0 Kudos

Hi Martin,

Or as Vladimir has pointed out you could use EJB 2.x home and remote interfaces with EJB 3.0 session beans.

That way i feel we could use the JNDI name sap.com/<EAR Name>/Bean Name

Regards

Sidharth

Former Member
0 Kudos

Hi,

as I already stated. The EJB 2.x way of accessing the home and remote interfaces does not work correctly.

I ran through all the elements in the JNDI Tree for my EAR Package But I was not able to connect other than stated above.

Regards,

Martin

ps: If you want, I can supply you with some test code.

sid-desh
Advisor
Advisor
0 Kudos

Hi Martin,

I think what i am trying to convey is not clear. let me try to list down the points which may help.

1. Create an EJB 3.0 project.

2. Create an interface (RemoteHome) which extends EJBHome

3. Create an interface (Remote) which extends EJBObject

4. Create an EJB 3.0 Session Bean without Local and Remote interface (de-select the checkbox in the wizard).

5. In the "RemoteHome" declare a create method which returns "Remote" interface.

public Remote create();

6. In the remote interface declare the business methods which will be implemented in Bean Class.

7. On the Bean Class other than @Stateless annotation place one more annotation: @RemoteHome(value=RemoteHome.class)

Now deploy the application. I feel you will now be able to call the EJB 3.0 Session bean using the JNDI name sap.com/<EAR Name>/<Bean Name>.

You can check this in the JNDI tree also. For EJB 3.0 session beans without 2.x style interfaces you can access the EJB using the JNDI name as has been suggested by you. I agree with you on that point and as Vladimir has pointed out JNDI lookup's will be available in the next release.

Please do let me know your suggestions.

Regards

Sidharth Deshpande

Vlado
Advisor
Advisor
0 Kudos

What has been said in this thread so far are all valid points. However, I'd like to shed some light on this question as it seems to be of interest to many people here and, in the same time, it's a bit confusing.

- Technically it's possible to lookup EJB 3.0 business interfaces just like Martin mentioned above. This is, however, the scheme implemented only in this preview release, and it's currently under discussion how to be supported in the upcoming official releases of SAP NetWeaver. Just keep in mind that it may be possible to change. That's what I meant by saying <i>"The lookup from standalone clients will be available and accordingly documented in the next release of SAP NetWeaver Application Server"</i> in the above referenced thread.

- EJB 2.x style Home interfaces for EJB 3.0 session beans can still be looked up in the way described in the attached document <a href="http://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/0736159e-0301-0010-9ea4-c63d83d0797b">"Accessing EJB Applications Using JNDI"</a>. Although being targetted at SAP NetWeaver 04, it's still applicable to this Java EE 5 edition. The steps to create a 2.x style Home interface have been described by Sidharth above.

Finally, I'd like to mention that you can always use the LSN command from the NAMING group in the Telnet Console Administrator to check the JNDI tree of your server. Another option would be to use the JNDI browser in the SAP NetWeaver Administrator. For more information please refer to the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/806e75a0-0e01-0010-2587-fc518de8ac1a">Administration Guide</a>.

Best regards,

Vladimir

Former Member
0 Kudos

Hi Martin,

Can you connect telnet to the server and to try to test this lookup direct from the telnet.

execute:

add naming

lsn

this will list all objects/contexts in the naming

and you can try to execute lookup command from the telnet

best regards,

mladen