Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25

Thread: Spring2 + EJB3 + JBoss405

  1. #11
    Join Date
    Dec 2006
    Location
    Normal, Illinois
    Posts
    277

    Default

    So in your web application can you do the following?

    Code:
    
    SecurityService securityService = (SecurityService)ctx.lookup("java:comp/env/schlange-security/SecurityServiceEjb/local"); 
    
    Caleb Washburn

  2. #12
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    Quote Originally Posted by tiago182 View Post
    This is getting funny. I've put a break point before calling the login() method, and I'm playing with the JNDI bound object:

    securityManager instanceof org.schlange.security.server.service.SecurityServi ceEjb
    (boolean) false

    securityManager instanceof org.schlange.security.server.SecurityService
    (boolean) true

    So, how can it be instance of SecurityService and not instance of SecurityServiceEjb? There is something really weird in this implementation...
    It's a proxy instance. Ejb class is only server side, it can't be accessed client side.

    Your problem is, most probably, classloading.

  3. #13

    Default

    Quote Originally Posted by cwash5 View Post
    So in your web application can you do the following?

    Code:
    
    SecurityService securityService = (SecurityService)ctx.lookup("java:comp/env/schlange-security/SecurityServiceEjb/local"); 
    
    I have the same problem and for me the above line works.
    Maybe you have a solution?

  4. #14
    Join Date
    Dec 2005
    Location
    U-241
    Posts
    237

    Default

    It might work, but certainly looks ugly.
    Spring, it's a wonderful thing...

  5. #15
    Join Date
    Jul 2005
    Location
    Nice, France
    Posts
    24

    Default

    Quote Originally Posted by dejanp View Post
    It's a proxy instance. Ejb class is only server side, it can't be accessed client side.
    Your problem is, most probably, classloading.
    If the problem is classloading, how would I solve it? Any idea? Tks

  6. #16
    Join Date
    Jul 2005
    Location
    Nice, France
    Posts
    24

    Unhappy

    Quote Originally Posted by cwash5 View Post
    So in your web application can you do the following?

    Code:
    
    SecurityService securityService = (SecurityService)ctx.lookup("java:comp/env/schlange-security/SecurityServiceEjb/local"); 
    
    This doesn't work either, I can get another proxy instance looking up for "schlange-security/SecurityServiceEjb/local", which can be casted only to EJBLocalObject.

    The global JNDI namespace in my JMX console looks like this:

    Code:
      +- schlange-security (class: org.jnp.interfaces.NamingContext)
      |   +- SecurityServiceEjb (class: org.jnp.interfaces.NamingContext)
      |   |   +- local (proxy: $Proxy99 implements interface org.schlange.security.server.SecurityService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
      |   |   +- remote (proxy: $Proxy97 implements interface org.schlange.security.server.SecurityService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    Last edited by tiago182; Dec 22nd, 2006 at 06:29 PM. Reason: Missing part

  7. #17
    Join Date
    Jan 2008
    Posts
    4

    Default

    Did you end-up figuring out anything to fix this problem? I'm basically having the exact same issue. I guess I might have to start looking at the JBoss Spring deployment thing, though I'd rather not since this seems like a programming problem which can be fixed somehow.

  8. #18
    Join Date
    Jul 2005
    Location
    Nice, France
    Posts
    24

    Default

    Sorry, but at the end I left this aside because I've realised I didn't *really* need such EJB... Just in case, I've just tried it now within JBoss 4.2.2.GA and it still doesn't work: javax.naming.NameNotFoundException. Next time I shall try another application server (if I really need to use EJB3).

  9. #19
    Join Date
    Jan 2008
    Posts
    4

    Default

    Thanks for the quick reply. I guess I'll keep messing with this... argh...

  10. #20
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    Classloading issues with local ejbs are an old, long and sad story. What it boils down to is that you have 2 classloaders for your local interface and you cannot assign instance created in one classloader to a variable in other classloader. (Classes in different classloaders can never be the same class, no matter if they have the same qname or not - that's exactly why we have different classloaders)

    Usually there is an option in your app server to turn off the local interface pass-by-ref optimization and use pass-by-value. (Let's ignore the fact that app server is fully aware of all the classloaders it created and could do this on it's own, if needed)

Posting Permissions

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