Sorry David, I must be extra dense today...

Here's what I understand of the way this works so far:

I have to start a GBean, and I have to make a resource-ref in my Session bean to use it. But I think I'm missing a step. How does Geronimo know which GBean represents a certain resource? Do I also have to make a gbean-ref in my open-ejb.xml deployment plan to make the 'link' somehow? I'm quite confused about this whole area right now, I'm afraid. Is there anyone on the list who's used JavaMail who can point me to example source, or docs? Even a similar situation where a GBean is linked to an SLSB resource-ref would be excellent.

Thanks.

-Neal

David Jencks wrote:

I'm not the expert on javamail, but...

I think you need a MailGBean to be the resource-ref target:

<gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean"/>

I'm not exactly sure what you need to configure so the mail gbean hooks up to the smtp protocol bean you already have.

Hope this points you a useful direction :-)

thanks
david jencks

On Sep 30, 2005, at 6:24 PM, Neal Sanche wrote:

Hi Guys,

A long while ago, I asked about getting JavaMail working in Geronimo. Here's what I have done, and the current result:

My geronimo-application.xml:

<DEFANGED_application
      xmlns="http://geronimo.apache.org/xml/ns/j2ee/application";
      configId="org/acme/mailverifier">
      <gbean name="mail/MailSession"
   class="org.apache.geronimo.mail.SMTPTransportGBean">
     <attribute name="host">mail.example.com</attribute>
 </gbean>

</application>

A resource-ref in a session bean that looks like:

        <resource-ref >
           <description><![CDATA[JavaMail Resource]]></description>
           <res-ref-name>mail/MailSession</res-ref-name>
           <res-type>javax.mail.Session</res-type>
           <res-auth>Container</res-auth>
           <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>

I've edited the j2ee-server-plan.xml to add:

   <dependency>
     <uri>javamail/jars/activation.jar</uri>
   </dependency>
   <dependency>
     <uri>javamail/jars/mail.jar</uri>
   </dependency>

   <dependency>
     <uri>geronimo/jars/geronimo-mail-1.0-SNAPSHOT.jar</uri>
   </dependency>

But I get the following error:

18:08:16,044 ERROR [Deployer] Deployment failed due to
org.apache.geronimo.gbean.InvalidConfigurationException: Could not load class or
g.apache.geronimo.mail.SMTPTransportGBean
at org.apache.geronimo.gbean.GBeanInfo.getGBeanInfo(GBeanInfo.java:56) at org.apache.geronimo.deployment.service.ServiceConfigBuilder.addGBeanD
ata(ServiceConfigBuilder.java:293)
at org.apache.geronimo.deployment.service.ServiceConfigBuilder.addGBeans
(ServiceConfigBuilder.java:288)
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfigurati
on(EARConfigBuilder.java:339)
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLI
B$$38e56ec6.invoke(<generated>)
       at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethod
Invoker.java:38)

If I change my geronimo-application.xml to:

<DEFANGED_application
      xmlns="http://geronimo.apache.org/xml/ns/j2ee/application";
      configId="org/acme/PhoneBook">

   <dependency>
       <uri>geronimo/jars/geronimo-mail-1.0-SNAPSHOT.jar</uri>
   </dependency>        <module>
       <connector>tranql-connector-1.0-SNAPSHOT.rar</connector>
       <alt-dd>mysql-plan.xml</alt-dd>
   </module>
     <gbean name="mail/MailSession"
     class="org.apache.geronimo.mail.SMTPTransportGBean">
       <attribute name="host">10.0.0.1</attribute>
       <attribute name="port">25</attribute>
   </gbean>
</application>

That error goes away, but I'm left with:

Deployer operation failed: Unable to resolve resource reference 'mail/MailSession' (no matching resources found) org.apache.geronimo.common.DeploymentException: Unable to resolve resource reference 'mail/MailSession' (no matching resources found) at org.apache.geronimo.naming.deployment.ENCConfigBuilder.addResourceRefs( ENCConfigBuilder.java:231) at org.apache.geronimo.naming.deployment.ENCConfigBuilder.buildComponentCo ntext(ENCConfigBuilder.java:764) at org.openejb.deployment.SessionBuilder.processEnvironmentRefs(SessionBui lder.java:167) at org.openejb.deployment.SessionBuilder.addEJBContainerGBean(SessionBuild er.java:296) at org.openejb.deployment.SessionBuilder.buildBeans(SessionBuilder.java: 182) at org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuil der.java:514) at org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20 .invoke(<generated>)
   at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)

Any ideas of what I'm doing wrong?

Thanks.

-Neal



Reply via email to