mercredi 22 juillet 2015

glassfish-ejb-jar.xml / ejb-jar.xml RMI configuration exception

I have succesfully configured two Java EE 6 applications to communicate with one another over RMI-IIOP by following the simple notes in this documentation. One application calls a remote EJB in the other application to get the current time, and vice versa.

Everything seems to be working, but I am confused by one of the elements of glassfish-ejb-jar.xml. Give me a minute to explain. I have two applications, Alpha and Beta. Here is the deployment descriptor of the Beta:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://ift.tt/HS6Bqg">
<glassfish-ejb-jar>
 <enterprise-beans>
   <ejb>
     <ejb-name>BetaLocalSessionBean</ejb-name>
     <ejb-ref>
        <ejb-ref-name>ejb/alphaSessionBean</ejb-ref-name>
        <jndi-name>corbaname:iiop:alphaServerUrl:11637#java:global/AlphaApplication/AlphaApplication-ejb/AlphaSessionBean</jndi-name>
       </ejb-ref>
   </ejb>
 </enterprise-beans>
</glassfish-ejb-jar>

BetaLocalSessionBean is a local Stateless Session Bean that I inject the remote AlphaSessionBean to get the time. My confusion is this: why do I get the following exception if I delete the <ejb-name> element?

Warning: DPL8007: Unsupported deployment descriptors element jndi-name value corbaname:iiop:localhost:3700#java:global/CinnamonApplication/CinnamonApplication-ejb/CinnamonSessionBean
Severe: Exception while deploying the app [OssoryApplication]
Severe: java.lang.NullPointerException
    at com.sun.enterprise.deployment.node.runtime.EjbNode.endElement(EjbNode.java:202)
    at com.sun.enterprise.deployment.node.SaxParserHandler.endElement(SaxParserHandler.java:481)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
...

Severe: Exception while deploying the app [BetaApplication]

Why is the <ejb-name> element mandatory? It's not mentioned in the documentation I linked to above. Does it matter which bean name I put there? I have already confirmed that I can inject AlphaSessionBean into other beans than BetaLocalSessionBean, so what is the significance of this element?

Versions:

  • Glassfish 3.1.2.2, Java EE 6.
  • Java 1.8.0_45-b15
  • NetBeans IDE 8.0.2

Documentation:

Aucun commentaire:

Enregistrer un commentaire