Skip to Content
avatar image
Former Member

Error when calling an EJB from a web sevice

Hi all,

I am getting the following error while trying to the lookup for my session bean

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/ejb/MyProcessorBean

here's a part of my code:

String WebserviceFunction()

{

//

Context ctx = new InitialContext();

BiasProcessorLocalHome orderHome =(BiasProcessorLocalHome)ctx.lookup("java:comp/env/ejb/MyProcessorBean");

//

}

I am using NWDS Version: 7.0.09

SAP NetWeaver 2004s.

I did find some threads related to it but none has been answered or weren't

that helpful in solving my problem.

Thanks

null

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 02, 2007 at 04:06 PM

    Hi,

    What is the implementation of your Web service? If it's another EJB then you have to define an ejb-local-ref in the deployment descriptor for that other EJB, like this:

    <ejb-local-ref>
        <ejb-ref-name>ejb/MyProcessorBean</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>your.package.BiasProcessorLocalHome</local-home>
        <local>your.package.BiasProcessorLocal</local>
    </ejb-local-ref>
    

    If it's not a J2EE component, there is no java:comp environment naming context (ENC) available. In this case you can look up the EJB local home from the "localejbs/" context, e.g. "localejbs/provider.name/YourAppName/YourEjbName". By default the provider name is "sap.com".

    For more information please refer to this" target="_blank">www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/accessing%20ejb%20applications%20using%20jndi.pdf">this article.

    HTH!

    -- Vladimir

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Baris Buyuktanir and Vladimir Pavlov for replying.

      @Baris Buyuktanir:

      Am trying to use and call the session bean from one of my Web service function(my ejb and web service are two separate projects)

      Well.... I tried out that option too and it gave me another error saying:

      java.lang.ClassCastException: com.sap.bias.session.MyProcessorLocalHome

      @ Vladimir Pavlov:

      Actually I created the project as a Java project and converted it into a web service

      by creating the VI and WS definitions.

      And there is not deployment descriptor (web.xml) in my project.

      I tried including it (web.xml with the ejb local ref ) in my project manually but I guess it's not reading from it. Any way of including the reference in the ws-deployment-descriptor.xml. Coz I tried and and it gave an error while deploying my project(web service).

      =======================================

      Ok!! I Solved it with the help of the link that Vladimir provided.

      Initially I was trying to reference the ejb in my ws-deployment-descriptor.xml but it was giving an error while deploying so I tried it in my application-j2ee-engine.xml and it worked.

      Thanks to Vladimir and Baris too. 😊

      Regards,

      Tali

      Message was edited by:

      talimeren Lkr

  • avatar image
    Former Member
    Aug 02, 2007 at 03:27 PM

    Hi,

    From where are you tying to reach your ejb?

    For local references try

    ctx.lookup("localejbs/sap.com/yourEARname/yourEJB");

    Add comment
    10|10000 characters needed characters exceeded