You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Mark <de...@hotmail.com> on 2005/03/01 20:39:02 UTC

Deployment EJB with Mail Resource References

Hello,

I tried to deploy a simple ejb with a javax.mail.Session Resource-ref, 
but it fails with the error message below.  (Also see deployment 
descriptor below)

Are there any documents that describe how to configure (pre deployment, 
post deployment) a mail session so it can be wired to a resource ref?

Thanks.
Mark

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
 <display-name>Mail</display-name>
 <enterprise-beans>
  <session>
   <ejb-name>Mail</ejb-name>
   <home>examples.MailHome</home>
   <remote>examples.Mail</remote>
   <local-home>examples.MailLocalHome</local-home>
   <local>examples.MailLocal</local>
   <ejb-class>examples.MailBean</ejb-class>
   <session-type>Stateless</session-type>
   <transaction-type>Container</transaction-type>
   <resource-ref>
    <description>A description for ResourceRefName</description>
    <res-ref-name>mail/mymailserver</res-ref-name>
    <res-type>javax.mail.Session</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
  </session>
 </enterprise-beans>
</ejb-jar>


Deployment failed
  Server reports: org.apache.geronimo.common.DeploymentException: Unknown
or ambiguous resource name query: geronimo.ser
ver:j2eeType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name=mail/mymailserver,*
 match count: 0
org.apache.geronimo.kernel.InternalKernelException:
org.apache.geronimo.common.DeploymentException: Unknown or ambiguous
 resource name query:
geronimo.server:j2eeType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name=mail/mymai
lserver,* match count: 0
        at
org.apache.geronimo.kernel.jmx.KernelDelegate.invoke(KernelDelegate.java:232)
        at
org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:92)
        at
org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:71)
        at java.lang.Thread.run(Thread.java:534)
Caused by: org.apache.geronimo.common.DeploymentException: Unknown or
ambiguous resource name query: geronimo.server:j2e
eType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name=mail/mymailserver,*
 match count: 0
        at
org.apache.geronimo.j2ee.deployment.RefContext.locateUniqueName(RefContext.java:444)
        at
org.apache.geronimo.j2ee.deployment.RefContext.getConnectionFactoryContainerId(RefContext.java:280)
        at
org.apache.geronimo.naming.deployment.ENCConfigBuilder.getResourceContainerId(ENCConfigBuilder.java:219)
        at
org.apache.geronimo.naming.deployment.ENCConfigBuilder.addResourceRefs(ENCConfigBuilder.java:201)
        at
org.apache.geronimo.naming.deployment.ENCConfigBuilder.buildComponentContext(ENCConfigBuilder.java:677)
        at
org.openejb.deployment.SessionBuilder.processEnvironmentRefs(SessionBuilder.java:143)
        at
org.openejb.deployment.SessionBuilder.addEJBContainerGBean(SessionBuilder.java:227)
        at
org.openejb.deployment.SessionBuilder.buildBeans(SessionBuilder.java:158)
        at
org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuilder.java:489)
        at
org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:710)
        at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
        at
org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
        at
org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:92)
        at
org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$380f6faf.addGBeans(<generated>)
        at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:351)
        at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:710)
        at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
        at
org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
        at
org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:92)
        at
org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$661d6fa5.buildConfiguration(<generated>
)
        at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:172)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:85)
        at
org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:745)
        at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:299)
        at
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:121)
        at
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
        at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:745)
        at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:299)
        at
org.apache.geronimo.kernel.jmx.MBeanServerDelegate.invoke(MBeanServerDelegate.java:117)
        at
mx4j.remote.rmi.RMIConnectionInvoker.invoke(RMIConnectionInvoker.java:219)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
mx4j.remote.rmi.RMIConnectionProxy.invoke(RMIConnectionProxy.java:34)
        at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.chain(RMIConnectionSubjectInvoker.java:99)
        at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.access$000(RMIConnectionSubjectInvoker.java:31)
        at
mx4j.remote.rmi.RMIConnectionSubjectInvoker$1.run(RMIConnectionSubjectInvoker.java:90)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
        at
mx4j.remote.MX4JRemoteUtils.subjectInvoke(MX4JRemoteUtils.java:163)
        at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.subjectInvoke(RMIConnectionSubjectInvoker.java:86)
        at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.invoke(RMIConnectionSubjectInvoker.java:80)
        at $Proxy0.invoke(Unknown Source)
        at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:221)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
        ... 1 more

Here's the deployment descriptor for the bean.



Re: Deployment EJB with Mail Resource References

Posted by Jeremy Boynes <jb...@apache.org>.
Mark wrote:
> 
> 3. It appears that there are no transport implementations provided by 
> Geronimo.  Sending an SMTP messages does nothing.  I believe the 
> JavaMail Reference Implementation contains a reference transport 
> implementation that would probably work with Geronimo.  I assume that 
> for certification Geronimo only requries the implementation of the 
> JavaMail APIs and not the actual transports.
> 

There is a transport, it's just a null one that eats all messages.

Geir is working on a SMTP transport implementation that will be included 
in the certified version.

The one from the RI does work with Geronimo but we can't redistribute it 
under the terms of the Apache License.

--
Jeremy

Re: Deployment EJB with Mail Resource References

Posted by Mark <de...@hotmail.com>.
David,

I've got the resource ref to work - thanks.  However, I have a few 
observations:

1. During deployment resource references appear to be resolved by 
looking for a gbean with a matching "namePart" as the needed resource 
reference.

2. Instead of changing the j2ee-server-plan.xml , it would probably be 
better to have an example on the wiki of a plan with definitions for 
resource references and then the ejb's definition.  This way a user can 
deploy a single plan

3. It appears that there are no transport implementations provided by 
Geronimo.  Sending an SMTP messages does nothing.  I believe the 
JavaMail Reference Implementation contains a reference transport 
implementation that would probably work with Geronimo.  I assume that 
for certification Geronimo only requries the implementation of the 
JavaMail APIs and not the actual transports.

Thanks
Mark

> David Jencks wrote:
>
>> It looks like despite all the work on mail lately no one remembered 
>> to  put a mail gbean in the j2ee-server-plan.xml or anywhere else.
>>
>> Adding something like this to your app plan or j2ee-server-plan.xml  
>> should help:
>>
>>     <gbean namePart="mail/MailSession"  
>> class="org.apache.geronimo.mail.MailGBean">
>>         <attribute name="properties">
>>             mail.smtp.host=mail.apache.com
>>         </attribute>
>>     </gbean>
>>
>> thanks
>> david jencks
>>
>> On Mar 1, 2005, at 11:39 AM, Mark wrote:
>>

Re: Deployment EJB with Mail Resource References

Posted by Mark <de...@hotmail.com>.
I'll adjust the plan and then submit a patch.

Mark

David Jencks wrote:

> It looks like despite all the work on mail lately no one remembered 
> to  put a mail gbean in the j2ee-server-plan.xml or anywhere else.
>
> Adding something like this to your app plan or j2ee-server-plan.xml  
> should help:
>
>     <gbean namePart="mail/MailSession"  
> class="org.apache.geronimo.mail.MailGBean">
>         <attribute name="properties">
>             mail.smtp.host=mail.apache.com
>         </attribute>
>     </gbean>
>
> thanks
> david jencks
>
> On Mar 1, 2005, at 11:39 AM, Mark wrote:
>
>> Hello,
>>
>> I tried to deploy a simple ejb with a javax.mail.Session 
>> Resource-ref,  but it fails with the error message below.  (Also see 
>> deployment  descriptor below)
>>
>> Are there any documents that describe how to configure (pre  
>> deployment, post deployment) a mail session so it can be wired to a  
>> resource ref?
>>
>> Thanks.
>> Mark
>>
>> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
>> JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
>>
>> <ejb-jar>
>> <display-name>Mail</display-name>
>> <enterprise-beans>
>>  <session>
>>   <ejb-name>Mail</ejb-name>
>>   <home>examples.MailHome</home>
>>   <remote>examples.Mail</remote>
>>   <local-home>examples.MailLocalHome</local-home>
>>   <local>examples.MailLocal</local>
>>   <ejb-class>examples.MailBean</ejb-class>
>>   <session-type>Stateless</session-type>
>>   <transaction-type>Container</transaction-type>
>>   <resource-ref>
>>    <description>A description for ResourceRefName</description>
>>    <res-ref-name>mail/mymailserver</res-ref-name>
>>    <res-type>javax.mail.Session</res-type>
>>    <res-auth>Container</res-auth>
>>    <res-sharing-scope>Shareable</res-sharing-scope>
>>   </resource-ref>
>>  </session>
>> </enterprise-beans>
>> </ejb-jar>
>>
>>
>> Deployment failed
>>  Server reports: org.apache.geronimo.common.DeploymentException:  
>> Unknown
>> or ambiguous resource name query: geronimo.ser
>> ver: 
>> j2eeType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name 
>> =mail/mymailserver,*
>> match count: 0
>> org.apache.geronimo.kernel.InternalKernelException:
>> org.apache.geronimo.common.DeploymentException: Unknown or ambiguous
>> resource name query:
>> geronimo.server: 
>> j2eeType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name 
>> =mail/mymai
>> lserver,* match count: 0
>>        at
>> org.apache.geronimo.kernel.jmx.KernelDelegate.invoke(KernelDelegate.jav 
>> a:232)
>>        at
>> org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDep 
>> loy(AbstractDeployCommand.java:92)
>>        at
>> org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(Distr 
>> ibuteCommand.java:71)
>>        at java.lang.Thread.run(Thread.java:534)
>> Caused by: org.apache.geronimo.common.DeploymentException: Unknown or
>> ambiguous resource name query: geronimo.server:j2e
>> eType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name=ma 
>> il/mymailserver,*
>> match count: 0
>>        at
>> org.apache.geronimo.j2ee.deployment.RefContext.locateUniqueName(RefCont 
>> ext.java:444)
>>        at
>> org.apache.geronimo.j2ee.deployment.RefContext.getConnectionFactoryCont 
>> ainerId(RefContext.java:280)
>>        at
>> org.apache.geronimo.naming.deployment.ENCConfigBuilder.getResourceConta 
>> inerId(ENCConfigBuilder.java:219)
>>        at
>> org.apache.geronimo.naming.deployment.ENCConfigBuilder.addResourceRefs( 
>> ENCConfigBuilder.java:201)
>>        at
>> org.apache.geronimo.naming.deployment.ENCConfigBuilder.buildComponentCo 
>> ntext(ENCConfigBuilder.java:677)
>>        at
>> org.openejb.deployment.SessionBuilder.processEnvironmentRefs(SessionBui 
>> lder.java:143)
>>        at
>> org.openejb.deployment.SessionBuilder.addEJBContainerGBean(SessionBuild 
>> er.java:227)
>>        at
>> org.openejb.deployment.SessionBuilder.buildBeans(SessionBuilder.java: 
>> 158)
>>        at
>> org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuil 
>> der.java:489)
>>        at
>> org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20 
>> .invoke(<generated>)
>>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>        at
>> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
>> voker.java:38)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
>> java:118)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
>> va:710)
>>        at
>> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>>        at
>> org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(RawOperatio 
>> nInvoker.java:36)
>>        at
>> org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(Proxy 
>> MethodInterceptor.java:92)
>>        at
>> org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$380 
>> f6faf.addGBeans(<generated>)
>>        at
>> org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration 
>> (EARConfigBuilder.java:351)
>>        at
>> org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$ 
>> $38e56ec6.invoke(<generated>)
>>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>        at
>> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
>> voker.java:38)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
>> java:118)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
>> va:710)
>>        at
>> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>>        at
>> org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(RawOperatio 
>> nInvoker.java:36)
>>        at
>> org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(Proxy 
>> MethodInterceptor.java:92)
>>        at
>> org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$6 
>> 61d6fa5.buildConfiguration(<generated>
>> )
>>        at
>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:172)
>>        at  
>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:85)
>>        at
>> org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.inv 
>> oke(<generated>)
>>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>        at
>> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
>> voker.java:38)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
>> java:118)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
>> va:745)
>>        at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:299)
>>        at
>> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:121)
>>        at
>> org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invo 
>> ke(<generated>)
>>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>>        at
>> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
>> voker.java:38)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
>> java:118)
>>        at
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
>> va:745)
>>        at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:299)
>>        at
>> org.apache.geronimo.kernel.jmx.MBeanServerDelegate.invoke(MBeanServerDe 
>> legate.java:117)
>>        at
>> mx4j.remote.rmi.RMIConnectionInvoker.invoke(RMIConnectionInvoker.java: 
>> 219)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
>> va:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
>> rImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:324)
>>        at
>> mx4j.remote.rmi.RMIConnectionProxy.invoke(RMIConnectionProxy.java:34)
>>        at
>> mx4j.remote.rmi.RMIConnectionSubjectInvoker.chain(RMIConnectionSubjectI 
>> nvoker.java:99)
>>        at
>> mx4j.remote.rmi.RMIConnectionSubjectInvoker.access$000(RMIConnectionSub 
>> jectInvoker.java:31)
>>        at
>> mx4j.remote.rmi.RMIConnectionSubjectInvoker$1.run(RMIConnectionSubjectI 
>> nvoker.java:90)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
>>        at
>> mx4j.remote.MX4JRemoteUtils.subjectInvoke(MX4JRemoteUtils.java:163)
>>        at
>> mx4j.remote.rmi.RMIConnectionSubjectInvoker.subjectInvoke(RMIConnection 
>> SubjectInvoker.java:86)
>>        at
>> mx4j.remote.rmi.RMIConnectionSubjectInvoker.invoke(RMIConnectionSubject 
>> Invoker.java:80)
>>        at $Proxy0.invoke(Unknown Source)
>>        at
>> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl. 
>> java:221)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
>> va:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
>> rImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:324)
>>        at
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>>        at sun.rmi.transport.Transport$1.run(Transport.java:148)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>>        at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: 
>> 460)
>>        at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j 
>> ava:701)
>>        ... 1 more
>>
>> Here's the deployment descriptor for the bean.
>>
>>
>
>
> .
>


Re: Deployment EJB with Mail Resource References

Posted by David Jencks <da...@yahoo.com>.
It looks like despite all the work on mail lately no one remembered to  
put a mail gbean in the j2ee-server-plan.xml or anywhere else.

Adding something like this to your app plan or j2ee-server-plan.xml  
should help:

     <gbean namePart="mail/MailSession"  
class="org.apache.geronimo.mail.MailGBean">
         <attribute name="properties">
             mail.smtp.host=mail.apache.com
         </attribute>
     </gbean>

thanks
david jencks

On Mar 1, 2005, at 11:39 AM, Mark wrote:

> Hello,
>
> I tried to deploy a simple ejb with a javax.mail.Session Resource-ref,  
> but it fails with the error message below.  (Also see deployment  
> descriptor below)
>
> Are there any documents that describe how to configure (pre  
> deployment, post deployment) a mail session so it can be wired to a  
> resource ref?
>
> Thanks.
> Mark
>
> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
> JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
>
> <ejb-jar>
> <display-name>Mail</display-name>
> <enterprise-beans>
>  <session>
>   <ejb-name>Mail</ejb-name>
>   <home>examples.MailHome</home>
>   <remote>examples.Mail</remote>
>   <local-home>examples.MailLocalHome</local-home>
>   <local>examples.MailLocal</local>
>   <ejb-class>examples.MailBean</ejb-class>
>   <session-type>Stateless</session-type>
>   <transaction-type>Container</transaction-type>
>   <resource-ref>
>    <description>A description for ResourceRefName</description>
>    <res-ref-name>mail/mymailserver</res-ref-name>
>    <res-type>javax.mail.Session</res-type>
>    <res-auth>Container</res-auth>
>    <res-sharing-scope>Shareable</res-sharing-scope>
>   </resource-ref>
>  </session>
> </enterprise-beans>
> </ejb-jar>
>
>
> Deployment failed
>  Server reports: org.apache.geronimo.common.DeploymentException:  
> Unknown
> or ambiguous resource name query: geronimo.ser
> ver: 
> j2eeType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name 
> =mail/mymailserver,*
> match count: 0
> org.apache.geronimo.kernel.InternalKernelException:
> org.apache.geronimo.common.DeploymentException: Unknown or ambiguous
> resource name query:
> geronimo.server: 
> j2eeType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name 
> =mail/mymai
> lserver,* match count: 0
>        at
> org.apache.geronimo.kernel.jmx.KernelDelegate.invoke(KernelDelegate.jav 
> a:232)
>        at
> org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDep 
> loy(AbstractDeployCommand.java:92)
>        at
> org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(Distr 
> ibuteCommand.java:71)
>        at java.lang.Thread.run(Thread.java:534)
> Caused by: org.apache.geronimo.common.DeploymentException: Unknown or
> ambiguous resource name query: geronimo.server:j2e
> eType=JavaMailResource,J2EEServer=geronimo,J2EEApplication=null,name=ma 
> il/mymailserver,*
> match count: 0
>        at
> org.apache.geronimo.j2ee.deployment.RefContext.locateUniqueName(RefCont 
> ext.java:444)
>        at
> org.apache.geronimo.j2ee.deployment.RefContext.getConnectionFactoryCont 
> ainerId(RefContext.java:280)
>        at
> org.apache.geronimo.naming.deployment.ENCConfigBuilder.getResourceConta 
> inerId(ENCConfigBuilder.java:219)
>        at
> org.apache.geronimo.naming.deployment.ENCConfigBuilder.addResourceRefs( 
> ENCConfigBuilder.java:201)
>        at
> org.apache.geronimo.naming.deployment.ENCConfigBuilder.buildComponentCo 
> ntext(ENCConfigBuilder.java:677)
>        at
> org.openejb.deployment.SessionBuilder.processEnvironmentRefs(SessionBui 
> lder.java:143)
>        at
> org.openejb.deployment.SessionBuilder.addEJBContainerGBean(SessionBuild 
> er.java:227)
>        at
> org.openejb.deployment.SessionBuilder.buildBeans(SessionBuilder.java: 
> 158)
>        at
> org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuil 
> der.java:489)
>        at
> org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20 
> .invoke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
> voker.java:38)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
> java:118)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
> va:710)
>        at
> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>        at
> org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(RawOperatio 
> nInvoker.java:36)
>        at
> org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(Proxy 
> MethodInterceptor.java:92)
>        at
> org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$380 
> f6faf.addGBeans(<generated>)
>        at
> org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration 
> (EARConfigBuilder.java:351)
>        at
> org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$ 
> $38e56ec6.invoke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
> voker.java:38)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
> java:118)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
> va:710)
>        at
> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>        at
> org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(RawOperatio 
> nInvoker.java:36)
>        at
> org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(Proxy 
> MethodInterceptor.java:92)
>        at
> org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$6 
> 61d6fa5.buildConfiguration(<generated>
> )
>        at
> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:172)
>        at  
> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:85)
>        at
> org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.inv 
> oke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
> voker.java:38)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
> java:118)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
> va:745)
>        at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:299)
>        at
> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:121)
>        at
> org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invo 
> ke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodIn 
> voker.java:38)
>        at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation. 
> java:118)
>        at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.ja 
> va:745)
>        at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:299)
>        at
> org.apache.geronimo.kernel.jmx.MBeanServerDelegate.invoke(MBeanServerDe 
> legate.java:117)
>        at
> mx4j.remote.rmi.RMIConnectionInvoker.invoke(RMIConnectionInvoker.java: 
> 219)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
> va:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
> rImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:324)
>        at
> mx4j.remote.rmi.RMIConnectionProxy.invoke(RMIConnectionProxy.java:34)
>        at
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.chain(RMIConnectionSubjectI 
> nvoker.java:99)
>        at
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.access$000(RMIConnectionSub 
> jectInvoker.java:31)
>        at
> mx4j.remote.rmi.RMIConnectionSubjectInvoker$1.run(RMIConnectionSubjectI 
> nvoker.java:90)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
>        at
> mx4j.remote.MX4JRemoteUtils.subjectInvoke(MX4JRemoteUtils.java:163)
>        at
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.subjectInvoke(RMIConnection 
> SubjectInvoker.java:86)
>        at
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.invoke(RMIConnectionSubject 
> Invoker.java:80)
>        at $Proxy0.invoke(Unknown Source)
>        at
> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl. 
> java:221)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja 
> va:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso 
> rImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:324)
>        at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>        at sun.rmi.transport.Transport$1.run(Transport.java:148)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>        at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: 
> 460)
>        at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j 
> ava:701)
>        ... 1 more
>
> Here's the deployment descriptor for the bean.
>
>