inflexions.com: homeHello,

When I run the sendmail logicsheet I seem to get a problem with the
transformation of sendmail.xsl.

Somewhere in the process the values of <sendmail:subject>, <sendmail:body>
and <sendmail:smtphost> are not added to the generated java code.

e.g. (from .java file in tomcat\work)

if (!"null".equals(String.valueOf())) {
        _sendmail_properties.put("mail.smtp.host",String.valueOf());
      }

instead of:

if (!"null".equals(String.valueOf("my.mail.host"))) {

_sendmail_properties.put("mail.smtp.host",String.valueOf("my.mail.host"));
      }

I got this by running sendmail.xsl against may XSP with Saxon from the
commandline, so not problem with the XSL.

Below are all the details:

environment: Win2K, Tomcat 4, Cocoon-2.0.2, JDK1.3.1

The XSP:

<?xml version="1.0" encoding="UTF-8"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp";
xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0";>
 <page>
  <sendmail:send-mail>
   <sendmail:from>[EMAIL PROTECTED]</sendmail:from>
   <sendmail:to>[EMAIL PROTECTED]</sendmail:to>
   <sendmail:subject>a</sendmail:subject>
   <sendmail:body>a</sendmail:body>
   <sendmail:smtphost>mail.m.iinet.net.au</sendmail:smtphost>
  </sendmail:send-mail>
 </page>
</xsp:page>

"original message"

org.apache.cocoon.components.language.LanguageException: Error compiling
mail_xsp:
Line 128, column 32: method valueOf() not found in class java.lang.String
Line 129, column 57: method valueOf() not found in class java.lang.String
Line 146, column 42: method valueOf() not found in class java.lang.String
Line 147, column 39: method valueOf() not found in class java.lang.String
Line 0, column 0:
4 errors

"Full Exception Chain Stacktrace"

Original exception :
org.apache.cocoon.components.language.LanguageException: Error compiling
mail_xsp:
Line 128, column 32: method valueOf() not found in class java.lang.String
Line 129, column 57: method valueOf() not found in class java.lang.String
Line 146, column 42: method valueOf() not found in class java.lang.String
Line 147, column 39: method valueOf() not found in class java.lang.String
Line 0, column 0:
4 errors

at
org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(
JavaLanguage.java:243)
at
org.apache.cocoon.components.language.programming.CompiledProgrammingLanguag
e.load(CompiledProgrammingLanguage.java:197)
at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generat
eResource(ProgramGeneratorImpl.java:383)
at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.createR
esource(ProgramGeneratorImpl.java:328)
at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(Pr
ogramGeneratorImpl.java:291)
at
org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator
.java:203)
at
org.apache.cocoon.components.pipeline.AbstractEventPipeline.setupPipeline(Ab
stractEventPipeline.java:202)
at
org.apache.cocoon.components.pipeline.CachingEventPipeline.setup(CachingEven
tPipeline.java:279)
at
org.apache.cocoon.components.pipeline.CachingEventPipeline.generateKey(Cachi
ngEventPipeline.java:142)
at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:320)
at
org.apache.cocoon.www.sitemap_xmap.matchN10585(C:\tomcat\work\localhost\coco
on\cocoon-files\org/apache/cocoon/www\sitemap_xmap.java:7214)
at
org.apache.cocoon.www.sitemap_xmap.process(C:\tomcat\work\localhost\cocoon\c
ocoon-files\org/apache/cocoon/www\sitemap_xmap.java:3102)
at
org.apache.cocoon.www.sitemap_xmap.process(C:\tomcat\work\localhost\cocoon\c
ocoon-files\org/apache/cocoon/www\sitemap_xmap.java:2571)
at org.apache.cocoon.sitemap.Handler.process(Handler.java:222)
at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179)
at org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154)
at org.apache.cocoon.Cocoon.process(Cocoon.java:575)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:998)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:201)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1011)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106
)
at java.lang.Thread.run(Thread.java:484)

Generated Java Class from
\tomcat\work\localhost\cocoon\cocoon-files\org\apache\cocoon\www\docs\sample
s\xsp



    package org.apache.cocoon.www.docs.samples.xsp;

    import java.io.File;
    import java.io.IOException;
    import java.io.StringReader;
    //import java.net.*;
    import java.util.Date;
    import java.util.List;
    import java.util.Stack;

    //import org.w3c.dom.*;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.AttributesImpl;

    //import org.apache.avalon.framework.*;
    import org.apache.avalon.framework.component.Component;
    import org.apache.avalon.framework.component.ComponentException;
    import org.apache.avalon.framework.component.ComponentManager;
    import org.apache.avalon.framework.component.ComponentSelector;
    import org.apache.avalon.framework.context.Context;
    import org.apache.avalon.excalibur.datasource.DataSourceComponent;
    //import org.apache.avalon.framework.util.*;

    import org.apache.cocoon.Constants;
    import org.apache.cocoon.ProcessingException;
    import org.apache.cocoon.components.parser.Parser;
    import org.apache.cocoon.generation.Generator;
    //import org.apache.cocoon.util.*;

    import org.apache.cocoon.components.language.markup.xsp.XSPGenerator;
    import org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper;
    import
org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper;
    import
org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper;
    import
org.apache.cocoon.components.language.markup.xsp.XSPSessionHelper;

    /* User Imports */

      import javax.mail.Message;

      import javax.mail.Transport;

      import javax.mail.Session;

      import javax.mail.MessagingException;

      import javax.mail.internet.InternetAddress;

      import javax.mail.internet.MimeMessage;

      import javax.mail.internet.AddressException;

      import java.util.Date;

      import java.util.Properties;


    /**
     * Generated by XSP. Edit at your own risk, :-)
     */
    public class mail_xsp extends XSPGenerator {

        static {
            dateCreated = 1018713459625L;
            dependencies = new File[] {

            };
        }

        /* Built-in parameters available for use */
        // context    - ServletContext
        // request    - org.apache.cocoon.environment.Request
        // response   - org.apache.cocoon.environment.Response
        // parameters - parameters defined in the sitemap

        /* User Class Declarations */

      static Properties _sendmail_properties;
      static {
        _sendmail_properties = new Properties();
        _sendmail_properties.put("mail.smtp.host","127.0.0.1");
      }


      /**
       * Generate XML data.
       */
      public void generate() throws SAXException, IOException,
ProcessingException {



            this.contentHandler.startDocument();
            AttributesImpl xspAttr = new AttributesImpl();



          this.contentHandler.startPrefixMapping(
            "xml",
            "http://www.w3.org/XML/1998/namespace";
          );

          this.contentHandler.startPrefixMapping(
            "xsp",
            "http://apache.org/xsp";
          );

          this.contentHandler.startPrefixMapping(
            "sendmail",
            "http://apache.org/cocoon/sendmail/1.0";
          );


    this.contentHandler.startElement(
      "",
      "page",
      "page",
      xspAttr
    );
    xspAttr.clear();


        this.characters("\n\t\t");

    try {
      Properties _sendmail_properties = new
Properties(this._sendmail_properties);
      if (!"null".equals(String.valueOf())) {
        _sendmail_properties.put("mail.smtp.host",String.valueOf());
      }
      Session _sendmail_session =
Session.getDefaultInstance(_sendmail_properties,null);
      Message _sendmail_message = new MimeMessage(_sendmail_session);
      InternetAddress _sendmail_from = new InternetAddress(String.valueOf(
          ""

                    + "[EMAIL PROTECTED]"
                  ));
      _sendmail_message.setFrom(_sendmail_from);
      InternetAddress _sendmail_to = new InternetAddress(String.valueOf(
          ""

                    + "[EMAIL PROTECTED]"
                  ));
      _sendmail_message.setRecipient(Message.RecipientType.TO,_sendmail_to);
      _sendmail_message.setSentDate(new Date());
      _sendmail_message.setSubject(String.valueOf());
      _sendmail_message.setText(String.valueOf());
      Transport.send(_sendmail_message);
    } catch (AddressException _sendmail_exception) {

    xspAttr.addAttribute(
      "",
      "type",
      "type",
      "CDATA",
      "user"
    );


    this.contentHandler.startElement(
      "",
      "error",
      "error",
      xspAttr
    );
    xspAttr.clear();


        this.characters("Your email address is invalid.");


    this.contentHandler.endElement(
      "",
      "error",
      "error"
    );


    } catch (MessagingException _sendmail_exception) {

    xspAttr.addAttribute(
      "",
      "type",
      "type",
      "CDATA",
      "server"
    );


    this.contentHandler.startElement(
      "",
      "error",
      "error",
      xspAttr
    );
    xspAttr.clear();


        this.characters("An error occured while sending email.");


    this.contentHandler.endElement(
      "",
      "error",
      "error"
    );


    }

        this.characters("\n\t");


    this.contentHandler.endElement(
      "",
      "page",
      "page"
    );


      this.contentHandler.endPrefixMapping(
        "xml"
      );

      this.contentHandler.endPrefixMapping(
        "xsp"
      );

      this.contentHandler.endPrefixMapping(
        "sendmail"
      );


            this.contentHandler.endDocument();
        }
    }




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to