users@glassfish.java.net

Re: _at_WebService / _at_Stateless and EJB deployment issue

From: Mark Hansen <mark_at_javector.com>
Date: Tue, 14 Mar 2006 17:23:25 -0500

Please ignore the commends below about the sun-ejb-jar.xml. I simply
forgot to include the port-component-name. My appologies.

The first issue, however, relating to the seening need to have
@WebService.name = @Stateless.name, I can't figure out.



mark_at_javector.com wrote:

> I am replying to myself here with some further clarification on this
> issue.
>
> It seems that the Glassfish deployment process is, at some point
> expecting a
> bean with a name equal to the @WebService.name value. As far as I
> know, the
> bean name should be taken from the @Stateless.name - right?
>
> So, I tried this:
>
> @WebService(serviceName="ServiceNameXXX", name="NameXXX")
> @Stateless(name="NameXXX")
> public class Hello {
>
> and it deploys. So, it seems that a requirement for successful
> deployment is
> @WebService.name = @Stateless.name. I think this is bug. I've read
> through
> JSR-109 and don't see anything that would imply a relationship like that.
>
> Another bug seems to be that when I use the @WebService.name
> annotation, then
> the endpoint-address-uri that I set in my sun-ejb-jar.xml is ignored.
>
> Here is my sun-ejb-jar.xml:
>
> <sun-ejb-jar>
> <enterprise-beans>
> <ejb>
> <ejb-name>NameXXX</ejb-name>
> <webservice-endpoint>
> <endpoint-address-uri>/deployssb/Hello</endpoint-address-uri>
> </webservice-endpoint>
> </ejb>
> </enterprise-beans>
> </sun-ejb-jar>
>
> And here is the sun-ejb-jar.xml that is generated in
> $GLASSFISH_HOME/generated/xml. Notice that Glassfish has overwritten
> the value that I provided for <endpoint-address-uri> and replaced it
> with a
> value derived from the annotations. So, I have lost the capability of
> specifying the <endpoint-address-uri>.
>
> <sun-ejb-jar>
> <enterprise-beans>
> <unique-id>74865883275526144</unique-id>
> <ejb>
> <ejb-name>NameXXX</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>NameXXX</port-component-name>
>
> <endpoint-address-uri>/ServiceNameXXX/NameXXX</endpoint-address-uri>
> <service-qname>
> <namespaceURI>http://samples/</namespaceURI>
> <localpart>ServiceNameXXX</localpart>
> </service-qname>
> <debugging-enabled>true</debugging-enabled>
> </webservice-endpoint>
> </ejb>
> </enterprise-beans>
> </sun-ejb-jar>
>
> Quoting mark_at_javector.com:
>
>> I'm having trouble deploying the following (but without the
>> @WebService.name
>> attribute it deploys OK). It seems that when I use the @WebService.name
>> attribute, I am required to include an ejb-jar.xml in my EJB-JAR. As
>> far as I
>> can tell, the problem is that when I do not include the ejb-jar.xml,
>> Glassfish
>> generates one, but instead of picking up the @WebService.name for the
>> ejb-name,
>> it generates an ejb-jar.xml with the default value of "Hello" for the
>> ejb-name.
>> Then, during deployment, there is a mismatch between the annotation
>> and the
>> descriptor, causing the server.log error shown below. This is my
>> best guess
>> about what is going on - I'm still a little confused about how
>> @Stateless
>> deployment works.
>>
>> Is this a bug - or is the ejb-jar.xml only optional when I do not use
>> the
>> @WebService.name?
>>
>>
>> @WebService(serviceName="ServiceNameXXX", name="NameXXX")
>> @Stateless
>> public class Hello {
>>
>> public String sayHello(String s) {
>> return "Hello: " + s;
>>
>> }
>>
>> }
>>
>> Here is the ejb-jar.xml that I need to use when deploying the above:
>>
>> <enterprise-beans>
>> <session>
>> <display-name>MyDisplayName</display-name>
>> <ejb-name>NameXXX</ejb-name>
>> <ejb-class>samples.Hello</ejb-class>
>> <session-type>Stateless</session-type>
>> <transaction-type>Container</transaction-type>
>> <security-identity>
>> <use-caller-identity/>
>> </security-identity>
>> </session>
>> </enterprise-beans>
>> </ejb-jar>
>>
>> The server log gives this:
>>
>> [#|2006-03-14T07:05:38.564-0500|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=80;_ThreadName=Thread-108;_RequestID=e6e89578-8a37-4428-8291-82413ee7cd7c;|Exception
>>
>> occured in J2EEC Phase
>> com.sun.enterprise.deployment.backend.IASDeploymentException: Error
>> loading
>> deployment descriptors for module [deploy-ssb-hello-1.0] --
>> Referencing error:
>> This bundle has no bean of name [NameXXX]at
>> com.sun.enterprise.deployment.annotation.AnnotationInfo_at_ce69fc
>> at
>> com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:362)
>>
>> at
>> com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:394)
>>
>> at
>> com.sun.enterprise.deployment.backend.EjbModuleDeployer.deploy(EjbModuleDeployer.java:134)
>>
>> at
>> com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:160)
>>
>> at
>> com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
>>
>> at
>> com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
>>
>> at
>> com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:848)
>>
>> at
>> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:260)
>>
>> at
>> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:716)
>>
>> at
>> com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:165)
>>
>> at
>> com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:194)
>>
>> Caused by: java.lang.IllegalStateException: Referencing error: This
>> bundle has
>> no bean of name [NameXXX]at
>> com.sun.enterprise.deployment.annotation.AnnotationInfo_at_ce69fc
>> at
>> com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:340)
>>
>> at
>> com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:200)
>>
>> at
>> com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:746)
>>
>> at
>> com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:727)
>>
>> at
>> com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:327)
>>
>> ... 10 more
>> Caused by: Referencing error: This bundle has no bean of name
>> [NameXXX]at
>> com.sun.enterprise.deployment.annotation.AnnotationInfo_at_ce69fc
>> at
>> com.sun.enterprise.deployment.annotation.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:334)
>>
>> at
>> com.sun.enterprise.deployment.annotation.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:342)
>>
>> at
>> com.sun.enterprise.deployment.annotation.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:256)
>>
>> at
>> com.sun.enterprise.deployment.annotation.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:162)
>>
>> at
>> com.sun.enterprise.deployment.annotation.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:116)
>>
>> at
>> com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:429)
>>
>> at
>> com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:322)
>>
>> ... 14 more
>> Caused by: java.lang.IllegalArgumentException: Referencing error:
>> This bundle
>> has no bean of name [NameXXX]
>> at
>> com.sun.enterprise.deployment.EjbBundleDescriptor.getEjbByName(EjbBundleDescriptor.java:258)
>>
>> at
>> com.sun.enterprise.deployment.annotation.handlers.WebServiceHandler.processAnnotation(WebServiceHandler.java:347)
>>
>> at
>> com.sun.enterprise.deployment.annotation.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:311)
>>
>> ... 20 more
>> |#]
>>
>>
>>
>