Mailing List
Home
Forum Home
Maven - Project building tool
Axis - Java SOAP implementation
Lucene - Full-featured text search engine APIs
Cocoon - MVC web framework based on XML/XSL
Fop - Create PDF, PCL, PS, SVG, XML driven by XSL formatting objects.
Log4J - A log library
POI - Java Excel, Word and other Microsoft Office files manipulating library
Oracle database error code ...
Subjects
log4j warning: No appenders could be found
java security AccessControlException: access denied (java io FilePermission clie
java lang InstantiationException: org apache tools ant Main
Apache Axis Tutorial
Subject: Struts <logic iterate >
log4j properties How to parse outpu to multiple files
configuring log4j with BEA Weblogic 8 1
How to use XSL FOP Java together
JSP precompile
Proposal: Adding jar manifest classpath in jar and war plugins
Servlet File Download dialog problem (IE6,Adobe 6 0)
java security AccessControlException: access denied (java io FilePermission
Unsupported major minor version 48 0 problem while running the an
   telope task
Subject: axis wsdl2java Ant Task usage
net sf hibernate MappingException: Error reading resource: test/User hbm xml
Building EAR ANT Script for websphere 5 0
CREATING WAR Files
Classpath problem
jsp data into Excel
Jboss 3 2 3+ vs Tomcat Axis Question
RE: How to include jars and add them into the MANIFEST MF/Class Path
attribute
Printing problem
Subject: InstantiationException
Couldn 't find trusted certificate
Please : How can one install ant 1 6 0 under Eclipse 2 1 ?
Excel: Too many different cell formats
Subject: AXIS: tomcat timeout ?
1 3 final: now giving me java io FileNotFoundException (Too many
open files)
XDoclet, Struts and Maven: Where to start? SOLUTION
Subject: Running junit tests fails
 
flowscript error using sendPageandWait in loop.

flowscript error using sendPageandWait in loop.

2007-12-06       - By stevecam

 Back

Hello,

I am trying to use flowscript and jxtemplates from withing Apache Lenya.

I have an error that I'm hoping someone can explain.

I want to prompt a user with a list of options to select from. If there are
no selections made I want to present the same page again. The list of
options to select from is passed to the cocoon.sendPageAndWait routine and
the page renders (via JXTemplateTransformer) correctly. However if no
selections are made and the page is redisplayed a second time I get an error
as below:

.
.
.
Caused by: org.apache.cocoon.generation.JXTemplateGenerator$JXTException:
java.lang.NullPointerException
  at <jx:choose> -
file:/C:/Tomcat5.0/webapps/lenya/lenya/pubs/TLP/content/authoring/INDIVIDUAL
/IDV-DIAGNOSTICS/idv-select-occupation/idv-select-qualification/index_en.xml:1:1
  at <map:serialize type="xml"> -
file:/C:/Tomcat5.0/webapps/lenya/lenya/pubs/TLP/doctypes.xmap:62:36
  at <map:transform> -
file:/C:/Tomcat5.0/webapps/lenya/lenya/pubs/TLP/doctypes.xmap:57:49
  at <map:transform type="jx"> -
file:/C:/Tomcat5.0/webapps/lenya/lenya/pubs/TLP/doctypes.xmap:56:36
  at <map:generate> -
file:/C:/Tomcat5.0/webapps/lenya/lenya/pubs/TLP/doctypes.xmap:54:104
  at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator
.java:2795)
  at
org.apache.cocoon.generation.JXTemplateGenerator.performGeneration
(JXTemplateGenerator.java:2498)
  at
org.apache.cocoon.generation.JXTemplateGenerator.access$1200
(JXTemplateGenerator.java:119)
  at
org.apache.cocoon.generation.JXTemplateGenerator$TransformerAdapter
$TemplateConsumer.endDocument(JXTemplateGenerator.java:2267)
  at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
  at
org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:71)
  at
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse
(XMLByteStreamInterpreter.java:83)
  at
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize
(XMLByteStreamInterpreter.java:73)
  at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
.processXMLPipeline(AbstractCachingProcessingPipeline.java:331)
  at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process
(AbstractProcessingPipeline.java:780)
  at
org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.java
:413)
  ... 118 more
Caused by: java.lang.NullPointerException
  at
org.apache.commons.jexl.parser.ASTSizeFunction.sizeOf(ASTSizeFunction.java:77)
  at
org.apache.commons.jexl.parser.ASTSizeMethod.execute(ASTSizeMethod.java:51)
  at
org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:68)
  at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:50)
  at org.apache.commons.jexl.parser.ASTEQNode.value(ASTEQNode.java:48)
  at
org.apache.commons.jexl.parser.ASTExpression.value(ASTExpression.java:47)
  at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:86)
  at
org.apache.cocoon.generation.JXTemplateGenerator.getValue(JXTemplateGenerator
.java:793)
  at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator
.java:2793)
  ... 128 more

This is strange as my pipeline is as follows:

51     <!-- parametrized doctype matcher -->
52    <!-- pattern="{rendertype}/{area}/{doctype}/{document-path}" -->
53     <map:match pattern="*/*/*/**.xml">
54       <map:generate
src="{content-dir:{page-envelope:publication-id},{2}}/{4}.xml"
label="content"/>
55 <!-- ASC added jxtemplate transform -->
56        <map:transform type="jx" />
57        <map:transform src="xslt/{3}2xhtml.xsl">
58          <map:parameter name="rendertype" value="{1}"/>
59          <map:parameter name="nodeid"
value="{page-envelope:document-node-id}"/>
60          <map:parameter name="language"
value="{page-envelope:document-language}"/>
61        </map:transform>
62        <map:serialize type="xml"/>
63      </map:match>

The error seems to indicate a problem in the serialization at line 62 and in
a jxtemplate generation rather than a transformation step.

The generation step is reading the following page (ie index_en.xml):

<?xml version="1.0" encoding="UTF-8 (See http://UTF-8.ora-code.com)"?>

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
     xmlns:xhtml="http://www.w3.org/1999/xhtml"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
>

<xhtml:html>
<lenya:meta>
       <dc:title>dctitle</dc:title>
       <dc:creator>Brett Walker</dc:creator>
       <dc:subject>Choose an occupation</dc:subject>
       <dc:description>Abstract that can be used on an overview
page</dc:description>
       <dc:publisher>Geometry</dc:publisher>
       <dc:contributor/>
       <dc:date>Wed Nov 28 16:42:57 EST 2007</dc:date>
       <dc:type/>
       <dc:format/>
       <dc:identifier/>
       <dc:source/>
       <dc:language>en</dc:language>
       <dc:relation/>
       <dc:coverage/>
       <dc:rights>dcrights</dc:rights>
</lenya:meta>

<xhtml:head>
<xhtml:title>Default Publication</xhtml:title>
<xhtml:meta content="text/html;charset=utf-8 (See http://utf-8.ora-code.com)" http-equiv="Content-Type"/>
</xhtml:head>
<xhtml:body>
<xhtml:h1>Choose Occupations</xhtml:h1>

  <form action="idv-select-occupation/idv-select-qualification.html"
method="POST">
   <input type="hidden" name="continuation-id"
value="${cocoon.continuation.id}"/>
   <jx:choose>
     <jx:when test="${occupations.size() == 0}">
       <xhtml:p>There are no occupations.</xhtml:p>
     </jx:when>
     <jx:otherwise>
        <xhtml:div class="page_explanation">Select occupations for which
you would like to discover skills, training and job
opportunities</xhtml:div>
         <jx:forEach var="occupation" items="${occupations}">
           <xhtml:div class="title_row">
               <xhtml:div class="select_check"><xhtml:input type="checkbox"
name="${occupation.OCCUPATION_ID}"/></xhtml:div>
               <xhtml:div class="descr_fold">
                 <xhtml:a
onclick="hideContent('descr_${occupation.OCCUPATION_ID}','descr_${occupation
.OCCUPATION_ID}_FoldImage');">
                   <xhtml:img
id='descr_${occupation.OCCUPATION_ID}_FoldImage'
src="/lenya/tlp/live/images/minus.jpg" />
                 </xhtml:a>
               </xhtml:div>                
               <xhtml:div class="title">${occupation.TITLE}</xhtml:div>      
   
           </xhtml:div>
           <xhtml:div class="descr_row"
id="descr_${occupation.OCCUPATION_ID}">
              <xhtml:div
class="descr">${occupation.JOB_DESCRIPTION}</xhtml:div>            
           </xhtml:div>
         </jx:forEach>
     </jx:otherwise>
   </jx:choose>
   <input type="submit"/>
   </form>  

</xhtml:body>
</xhtml:html>
</jx:template>

There is a jx:choose tag in this file which made me think for a while that
the occupations List object that is being tested for size was the problem as
this is being generated in the flowscript from a database query using the
JDBi database interface library as per the simple database access demo.
However, this object is not 'undefined' after the call of sendPageAndWait
the second time and removing the database dependancy doesn't fix the
problem.

My flowscript is as follows:

function do_occupation_diagnostic()
{
   //get the user selected occupations
   var selected_occs = new java.util.ArrayList();
   //var occ_list = dao.occupation.getAll();
   var occ_list = new java.util.ArrayList();
   occ_list.add({OCCUPATION_ID: 1, JOB_DESCRIPTION: 'value 1'});
   occ_list.add({OCCUPATION_ID: 2, JOB_DESCRIPTION: 'value 2'});
   while(true){
      // Call the view to allow user to select occupations of interest
     
cocoon.sendPageAndWait("INDIVIDUAL/IDV-DIAGNOSTICS/idv-select-occupation.jx",{
occupations: occ_list });    
      for(var params = cocoon.request.getParameterNames();
params.hasNext();){
         var occ_id = params.next();
         if(cocoon.request.getParameterValues(occ_id)[0] == "on"){
            selected_occs.add(dao.occupation.get(occ_id));
         }
      }
      if(selected_occs.size()>0) break;
   }
}

So, I think my initial diagnosis is incorrect and the jx:choose tag is
getting through the transformation step and into the serialization step in
the pipeline.

Thanks for any insights.

Steve Cameron
Developer
Geometry (www.geometryit.com)
--
View this message in context: http://www.nabble.com/flowscript-error-using
-sendPageandWait-in-loop.-tf4954237.html#a14186912
Sent from the Cocoon - Users mailing list archive at Nabble.com.


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)