0 Replies Latest reply on Nov 16, 2012 11:23 AM by pedrokowalski

    Remote EJB 3.1 in JBoss 6.1 - ejb-jar.xml changes remote to local

    pedrokowalski

      Howdy Guys.

       

      Just bumped into some really nasty problem.

       

      I have my EJB 3.1 beans defined using annotations like:

       

          @Remote

          @Stateless

          public class MyBean implements MyBeanIf

          {

          }

       

      This is a part of the ejb-jar (myEJB.jar) which is then packaged into EAR (myEAR.ear) and deployed into the server.

       

      Because I would like to be able to lookup the MyBean using something different than myEJB in JNDI coordinates, I've added the ejb-jar.xml to the META-INF of ejb-jar.

       

      It looks like this:

       

          <?xml version="1.0" encoding="UTF-8"?>

          <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"

             version="3.1">

             <module-name>my-service</module-name>

          </ejb-jar>

       

      So, no surprise here - it's rather simple.

       

      Now if I deploy it on JBoss AS 7.1 - everything works fine, the JNDI coordinates are correct and I can access the component using configured JNDI name.

      However, ifI deploy it on JBoss 6.1 it somehow magically changes my remote interface to local. In other words, if I don't specify the ejb-jar.xml in my ejb-jar it correctly registers the bean as:

       

          myear/MyBean/remote - EJB3.x Default Remote Business Interface

       

      When I add the ejb-jar.xml (in the exact form as you can se above), I can see:

       

         myear/MyBean/local - EJB3.x Default Local Business Interface

       

      And, as expected, I cannot lookup my EJB.

       

      Is there some problem with mixing annotations and declarative EJB configuration? Why did my bean became local just by adding ejb-jar.xml with element not related with the configuration of enterprise beans?

       

      I have a workaround to change the names of artifacts (ejb-jar's) directly in EAR using Maven plugin, but... uh... would rather know what am I doing wrong.

       

      What kind of sorcery is this?

       

      Regards.