[jboss-user] [JBoss Web Services] - [JBoss 6.0.0M3] Cannot use @EJB on jax-ws handler and webservice port

Olaf Bergner do-not-reply at jboss.com
Wed Aug 11 15:11:49 EDT 2010


Olaf Bergner [http://community.jboss.org/people/O.Bergner] replied to the discussion

"[JBoss 6.0.0M3] Cannot use @EJB on jax-ws handler and webservice port"

To view the discussion, visit: http://community.jboss.org/message/556964#556964

--------------------------------------------------------------
I tried to debug the issue, alas without much luck. What puzzles me though when looking at the method

protected String findWithin(DeploymentUnit du, DeploymentUnit excludeChild, EjbReference reference)
   {
      String jndiName = find(du, reference);
      if(jndiName != null)
         return jndiName;
      
      List<DeploymentUnit> children = du.getChildren();
      if(children != null)
      {
         for(DeploymentUnit child : children)
         {
            // already searched that one
            if(child == excludeChild)
               continue;
            
            jndiName = findWithin(child, null, reference);
            if(jndiName != null)
               return jndiName;
         }
      }
      
      DeploymentUnit parent = du.getParent();
      if(parent != null)
         return findWithin(parent, du, reference);
      return null;
   }

is the question how it is supposed to work. Let's say we have

app.ear
   |
   -- ejb1.jar
   |
   -- ejb2.jar
   |
   -- ejb3.jar

ejb1.jar contains an artifact referencing a session bean that resides in ejb3.jar. If I understand the code above correctly - and this is a BIG if - what will happen is what follows:

1. We start searching in ejb1.jar.
2. We try to find the referenced session bean in ejb1.jar itself. This fails.
3. We try to find the referenced session bean in one of ejb1.jar's children. There are no such children, so this fails, too.
4. We try to find the referenced session bean in ejb1.jar's parent, i.e. app.ear, telling this parent to exclude the current deployment unit, i.e. ejb1.jar.
5. We try to find - since app.ear itself does not contain any session beans - the referenced session bean in the list of app.ear's children minus ejb1.jar, i.e. [ejb2.jar, ejb3.jar].
6. Since ejb2.jar does not contain the referenced session bean either, we end up repeating steps 2 - 4, with ejb1.jar replaced by ejb2.jar.
7. We try to find the referenced session bean in the list of app.ear's children minus ejb2.jar, i.e. [ejb1.jar,ejb3.jar]. And now we are in trouble, since ...
8. We repeat steps 1 - 7 until we run out of stack space.

Could it be that the above algorithm only succeeds if

1. the number of children to app.ear is not greater than two OR
2. the referenced session bean resides in the same deployment unit as the referencing artifact OR
3. the referenced session bean resides in the deployment unit immediately following - from app.ear's perspective - the deployment unit containing the referencing artifact (ejb2.jar in our example)?

At least this seems to be implied by a casual analysis of the code above. But then again, I may be wrong and it's rather a problem in my code.

Cheers,
Olaf

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/556964#556964]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100811/bdc0bdb2/attachment.html 


More information about the jboss-user mailing list