My understanding is that deployment descriptor values should overide
annotations. However, I am experiencing the opposite behavoir in the
following deployment.
I create an EJB-WAR to deploy a web service (EJB endpoint) for the
following class:
@WebService(serviceName="MyHelloService", name="MyHelloPortType",
portName="MyHelloServicePort")
@Stateless(name="MyHelloEJB")
public class Hello {
public String sayHello(String s) {
return "Hello: " + s;
}
}
Here is the sun-ejb-jar.xml that I package with this class in the EJB-JAR:
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>MyHelloEJB</ejb-name>
<webservice-endpoint>
<port-component-name>MyHelloEJB</port-component-name>
<endpoint-address-uri>/deployssb/Hello</endpoint-address-uri>
</webservice-endpoint>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
However, when I deploy the EJB-JAR, the web service endpoint is at the
the following URI: /MyHelloService/MyHelloPortType and, furthermore the
following sun-ejb-jar has been generated (in the
$GLASSFISH_HOME/glassfish/domains/domain1/generated/xml directory):
<sun-ejb-jar>
<enterprise-beans>
<unique-id>75030031306981376</unique-id>
<ejb>
<ejb-name>MyHelloEJB</ejb-name>
<pass-by-reference>false</pass-by-reference>
<is-read-only-bean>false</is-read-only-bean>
<refresh-period-in-seconds>-1</refresh-period-in-seconds>
<cmt-timeout-in-seconds>0</cmt-timeout-in-seconds>
<gen-classes/>
<webservice-endpoint>
<port-component-name>MyHelloPortType</port-component-name>
<endpoint-address-uri>/MyHelloService/MyHelloPortType</endpoint-address-uri>
<service-qname>
<namespaceURI>
http://samples/</namespaceURI>
<localpart>MyHelloService</localpart>
</service-qname>
<debugging-enabled>true</debugging-enabled>
</webservice-endpoint>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
As you can see here, the endpoint-address-uri value that I provided in
my sun-ejb-jar.xml has been overidden by a URI derived from the
annotations. I believe that this behavior is incorrect, and that the
endpoint-addrees-uri value provided in the original sun-ejb-jar.xml
should overide the annotations. Otherwise, how can you specify an
endpoint address when deploying an EJB endpoint? The only GlassFish
mechanism for that is to use the sun-ejb-jar.xml deployment descriptor.
Please let me know if I am mistaken.
Thanks,
Mark