2 Replies Latest reply on Feb 23, 2007 11:43 AM by yararaca

    @RemoteBinding doesn't work?

    yararaca

      Hi,
      I am using JBoss 4.0.4.GA. I deploy my JAR containing EJBs in EAR archive. The JNDI name of my beans gets prefixed by the EAR name by default. I want to override this behaviour to have the JNDI name independent from the EAR name.
      I thought that the @RemoteBinding(jndiBinding="someJNIDIName") is just what i need, but it doesn't seem to take any effect at all?

      This is my code:

      @Stateless
      @RemoteBinding(jndiBinding="someJNIDIName")
      public class DemoBean implements DemoRemote {
      // some methods
      }
      


      result in JNDI view in jmx console:
       +- myear (class: org.jnp.interfaces.NamingContext)
       | +- DemoBean (class: org.jnp.interfaces.NamingContext)
       | | +- remote (proxy: $Proxy77 implements interface uk.co.rubicon.test.DemoRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
      


      The jndi name stays the same (default) no matter what I do. Anybody has a clue what am i doing wrong?

        • 1. Re: @RemoteBinding doesn't work?
          alrubinger

          Is DemoRemote annotated w/ @Remote?

          (Stab in the dark)

          This has always worked for me...

          S,
          ALR

          • 2. Re: @RemoteBinding doesn't work?
            yararaca

            Yup, it was annotated with @Remote

            I finally found the problem by everybody's favourite trial and error approach. I'll state the solution here to save troubles to people with similar problems.

            What I had was the following file structure:

            ear file:
            +-myear.ear
            | +-META-INF
            | +-Demo.jar
            
            standalon war file:
            +-DemoWeb.war
            | +-WEB-INF
            | +-lib
            | +-Demo.jar
            
            


            Note Demo.jar is deployed twice, once in the ear and again in the war. This was making the @RemoteBinding annotation being ignored. I don't know why, because i thought jars in WEB-INF/lib aren't being deployed even if they contain ejbs, but perhaps I am wrong.

            when I repacked it all to one EAR (and removed the redundand Demo.jar from WEB-INF/lib) it started working

            +-myear.ear
            | +-META-INF
            | +-Demo.jar
            | +-DemoWeb.war