Results 1 to 6 of 6

Thread: lookup local slsb failes on glassfish

  1. #1
    Join Date
    Apr 2009
    Posts
    5

    Default lookup local slsb failes on glassfish

    hi there,

    i try to to use a Local EJB3 StatelessBean within my Spring-POJO.



    Code:
    @Local(MyLocal.class)
    @Stateless(name="MyBean", mappedName="MyBean")
    public class MyBean implements MyLocal{...}
    i know that glassfish does not map local ejbs to global jndi-tree.
    but anyway, the bean needs a name where it could be found under java:comp/env

    applicationContext.xml:

    Code:
    <jee:local-slsb id="myBean" jndi-name="MyBean"
    		business-interface="org.test.MyLocal" resource-ref="true" />

    resulting in an:
    javax.naming.NameNotFoundException: MyBean not found

    when i try to inject the 'myBean' into a Spring-Bean.

    Code:
    <jee:local-slsb id="myBean" jndi-name="java:comp/env/MyBean"
    		business-interface="org.test.MyLocal" resource-ref="true" />
    works neither.

    the whole project contains only an EJB-Module, which contains the EJB3-Beans and the Spring-Pojos together with all configuration-files.

    the ejb-module is packaged into an EAR(only containing the EJB-module) and deployed on glassfish v2.1

    I read th glassfish-faqs about how to lookup a local-ejb from a pojo.
    but these examples assume that i call the Pojo itself from an EJB, which i dont do.


    anyway, isnt there a way to lookup a local EJB?


    thanks in advance.
    tim

  2. #2
    Join Date
    Apr 2009
    Posts
    5

    Default

    nobody ever solved this problem?

  3. #3
    Join Date
    May 2007
    Posts
    5

    Default

    Hi,
    try to replace - just for test - @Local annotation with @Remote.
    Regards,
    Milan

  4. #4
    Join Date
    Apr 2009
    Posts
    5

    Default

    yes, this works as expected. using @Remote and <jee:remote-slsb ...> and mapped-jndi-nbame of the remote-slsb. i knew it work fine with glassfish.


    but this is not want i want. i need to local-slsb lookedup in glassfish.

  5. #5
    Join Date
    May 2007
    Posts
    5

    Default

    Hi,
    where do you initialize your spring context ? Is it in a web module ?
    If yes, than you have to make a local slsb visible through configuration entry in web.xml:

    <ejb-local-ref>
    <ejb-ref-name>MyBean</ejb-ref-name>
    <local>org.test.MyLocal</local>
    <ejb-link>MyBean</ejb-link>
    </ejb-local-ref>

    It makes SLSB lookupable also in spring context:
    <jee:local-slsb id="myBean" jndi-name="java:comp/env/MyBean" business-interface="org.test.MyLocal"></jee:local-slsb>

    regards,
    Milan
    Last edited by xminoxde; May 19th, 2009 at 03:49 AM.

  6. #6
    Join Date
    Apr 2009
    Posts
    5

    Default

    no web-module. only an ejb-module. if i use a "dummy"-webmodule and deploy as an ear together with the ejb-module, is the local-ejb specified in the dummy-web.xml visible(through jndi?) in my ejb-module and spring-pojos??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •