You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robby Pelssers <ro...@ciber.com> on 2009/12/04 16:06:56 UTC

problem with zip serializer Cocoon 2.2: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector

Hi guys,

 

I defined a custom serializer to add a specific doctype declaration:

 

      <map:serializer 

        logger="sitemap.serializer.xml" mime-type="text/xml" name="map"

        src="org.apache.cocoon.serialization.XMLSerializer">

        <doctype-system>http://nww.qa.spider.nxp.com:8310/xmetal/schemas/map.dtd</doctype-system>

      </map:serializer>

 

 

I dynamically generate the zip archive using inline xml content.

 

Ziparchive xml snippet (1)

<?xml version="1.0" encoding="UTF-8"?>

<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

            <zip:entry name="PH3330L.xml" serializer="map">

                        <map id="emptymap" rev="000.000" title="PH3330L">

                                    <topicmeta>

                                                <critdates>

                                                            <revised modified="20091204"/>

                                                </critdates>

                                                <releasestate content="released"/>

                                                <owner content="NXP"/>

                                    </topicmeta>

                                    <topicgroup>

                                                <topichead navtitle="PH3330L"/>

                                                <topicref href="product_profile" navtitle="product_profile"/>

                                                <topicref href="pinning_information" navtitle="pinning_information"/>

                                                <topicref href="ordering_information" navtitle="ordering_information"/>

                                                <topicref href="marking" navtitle="marking"/>

                                    </topicgroup>

                        </map>

            </zip:entry>

</zip:archive>

 

 

My sitemap snippet looks like this:

 

      <map:match pattern="zip">

        <map:generate src="cocoon:/datasheet_mockup"/>

        <map:transform src="xslt/datasheet2zip.xslt" type="saxon" label="zip"/>  àresults in (1) 

        <map:serialize type="zip"/>

      </map:match>

 

I can process this pipeline up until transformation.  But the zip serializer gives me following exception:

 

Caused by: org.apache.avalon.framework.service.ServiceException: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector. (Key='AvalonServiceSelector')

      at org.apache.cocoon.serialization.ZipArchiveSerializer.addEntry(ZipArchiveSerializer.java:333)

      at org.apache.cocoon.serialization.ZipArchiveSerializer.startElement(ZipArchiveSerializer.java:211)

      at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:71)

      at $Proxy12.startElement(Unknown Source)

      at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:253)

 

 

I would expect that the name of the serializer is used as key... or is my assumption wrong and do I need to add some extra configuration to the custom serializer?

 

May thx in advance,

Robby Pelssers


RE: [SOLVED]: problem with zip serializer Cocoon 2.2: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector

Posted by Robby Pelssers <ro...@ciber.com>.
Ok.... The mistake I made was copying configuration from a previous cocoon 2.1.11 application.  Since I'm using Cocoon2.2 now I needed to configure the 2 serializers as beans.  

 

So here follows the solution:

 

applicationContext.xml:

  <bean name="org.apache.cocoon.serialization.Serializer/map" 

    class="org.apache.cocoon.serialization.XMLSerializer"

    scope="prototype" 

    parent="org.apache.cocoon.serialization.AbstractTextSerializer">

    <pipeline:component mime-type="text/xml;charset=utf-8"/>

    <property name="format">

      <props>

        <prop key="encoding">UTF-8</prop>

        <prop key="doctype-system">datasheet.map-dtd</prop>

      </props>

    </property>

  </bean> 

  

  <bean name="org.apache.cocoon.serialization.Serializer/p-topic" 

    class="org.apache.cocoon.serialization.XMLSerializer"

    scope="prototype" 

    parent="org.apache.cocoon.serialization.AbstractTextSerializer">

    <pipeline:component mime-type="text/xml;charset=utf-8"/>

    <property name="format">

      <props>

        <prop key="encoding">UTF-8</prop>

        <prop key="doctype-system">${datasheet.p-topic-dtd}</prop>

      </props>

    </property>

  </bean>

 

 

Sitemap.xmap:

      <map:match pattern="test.zip">

        <map:generate src="cocoon:/datasheet_mockup"/>

        <map:transform src="xslt/datasheet2zip.xslt" type="saxon" label="zip"/> - - > results in (1)

        <map:serialize type="zip"/>

      </map:match>

 

 

(1): Dynamically generated ziparchive xml

 

<?xml version="1.0" encoding="UTF-8"?>

<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

            <zip:entry name="PH3330L.xml" serializer="map">

                        <map id="emptymap" rev="000.000" title="PH3330L">

                                    <topicmeta>

                                                <critdates>

                                                            <revised modified="20091204"/>

                                                </critdates>

                                                <releasestate content="released"/>

                                                <owner content="NXP"/>

                                    </topicmeta>

                                    <topicgroup>

                                                <topichead navtitle="PH3330L"/>

                                                <topicref href="product_profile" navtitle="product_profile"/>

                                                <topicref href="pinning_information" navtitle="pinning_information"/>

                                                <topicref href="ordering_information" navtitle="ordering_information"/>

                                                <topicref href="marking" navtitle="marking"/>

                                    </topicgroup>

                        </map>

            </zip:entry>

</zip:archive>

 

In the snippet above I reference the serializers by name.

 

Kind regards,

Robby Pelssers

 

 

 

 

From: Robby Pelssers [mailto:robby.pelssers@ciber.com] 
Sent: Friday, December 04, 2009 4:24 PM
To: users@cocoon.apache.org
Subject: RE: problem with zip serializer Cocoon 2.2: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector

 

One thing which I'm wondering about is that it searches for the ROLE  'org.apache.cocoon.serialization.Serializer/' . Should the ROLE be equal to the @src attribute of the serializer?  In that case my custom serializer might get the ROLE 'org.apache.cocoon.serialization.XMLSerializer/' with key='map' which might explain why the service selector can't find this serializer.

 

But that's just guessing on my part.

 

Robby

 

From: Robby Pelssers [mailto:robby.pelssers@ciber.com] 
Sent: Friday, December 04, 2009 4:07 PM
To: users@cocoon.apache.org
Subject: problem with zip serializer Cocoon 2.2: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector

 

Hi guys,

 

I defined a custom serializer to add a specific doctype declaration:

 

      <map:serializer 

        logger="sitemap.serializer.xml" mime-type="text/xml" name="map"

        src="org.apache.cocoon.serialization.XMLSerializer">

        <doctype-system>http://nww.qa.spider.nxp.com:8310/xmetal/schemas/map.dtd</doctype-system>

      </map:serializer>

 

 

I dynamically generate the zip archive using inline xml content.

 

Ziparchive xml snippet (1)

<?xml version="1.0" encoding="UTF-8"?>

<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

            <zip:entry name="PH3330L.xml" serializer="map">

                        <map id="emptymap" rev="000.000" title="PH3330L">

                                    <topicmeta>

                                                <critdates>

                                                            <revised modified="20091204"/>

                                                </critdates>

                                                <releasestate content="released"/>

                                                <owner content="NXP"/>

                                    </topicmeta>

                                    <topicgroup>

                                                <topichead navtitle="PH3330L"/>

                                                <topicref href="product_profile" navtitle="product_profile"/>

                                                <topicref href="pinning_information" navtitle="pinning_information"/>

                                                <topicref href="ordering_information" navtitle="ordering_information"/>

                                                <topicref href="marking" navtitle="marking"/>

                                    </topicgroup>

                        </map>

            </zip:entry>

</zip:archive>

 

 

My sitemap snippet looks like this:

 

      <map:match pattern="zip">

        <map:generate src="cocoon:/datasheet_mockup"/>

        <map:transform src="xslt/datasheet2zip.xslt" type="saxon" label="zip"/>  àresults in (1) 

        <map:serialize type="zip"/>

      </map:match>

 

I can process this pipeline up until transformation.  But the zip serializer gives me following exception:

 

Caused by: org.apache.avalon.framework.service.ServiceException: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector. (Key='AvalonServiceSelector')

      at org.apache.cocoon.serialization.ZipArchiveSerializer.addEntry(ZipArchiveSerializer.java:333)

      at org.apache.cocoon.serialization.ZipArchiveSerializer.startElement(ZipArchiveSerializer.java:211)

      at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:71)

      at $Proxy12.startElement(Unknown Source)

      at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:253)

 

 

I would expect that the name of the serializer is used as key... or is my assumption wrong and do I need to add some extra configuration to the custom serializer?

 

May thx in advance,

Robby Pelssers


RE: problem with zip serializer Cocoon 2.2: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector

Posted by Robby Pelssers <ro...@ciber.com>.
One thing which I'm wondering about is that it searches for the ROLE  'org.apache.cocoon.serialization.Serializer/' . Should the ROLE be equal to the @src attribute of the serializer?  In that case my custom serializer might get the ROLE 'org.apache.cocoon.serialization.XMLSerializer/' with key='map' which might explain why the service selector can't find this serializer.

 

But that's just guessing on my part.

 

Robby

 

From: Robby Pelssers [mailto:robby.pelssers@ciber.com] 
Sent: Friday, December 04, 2009 4:07 PM
To: users@cocoon.apache.org
Subject: problem with zip serializer Cocoon 2.2: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector

 

Hi guys,

 

I defined a custom serializer to add a specific doctype declaration:

 

      <map:serializer 

        logger="sitemap.serializer.xml" mime-type="text/xml" name="map"

        src="org.apache.cocoon.serialization.XMLSerializer">

        <doctype-system>http://nww.qa.spider.nxp.com:8310/xmetal/schemas/map.dtd</doctype-system>

      </map:serializer>

 

 

I dynamically generate the zip archive using inline xml content.

 

Ziparchive xml snippet (1)

<?xml version="1.0" encoding="UTF-8"?>

<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

            <zip:entry name="PH3330L.xml" serializer="map">

                        <map id="emptymap" rev="000.000" title="PH3330L">

                                    <topicmeta>

                                                <critdates>

                                                            <revised modified="20091204"/>

                                                </critdates>

                                                <releasestate content="released"/>

                                                <owner content="NXP"/>

                                    </topicmeta>

                                    <topicgroup>

                                                <topichead navtitle="PH3330L"/>

                                                <topicref href="product_profile" navtitle="product_profile"/>

                                                <topicref href="pinning_information" navtitle="pinning_information"/>

                                                <topicref href="ordering_information" navtitle="ordering_information"/>

                                                <topicref href="marking" navtitle="marking"/>

                                    </topicgroup>

                        </map>

            </zip:entry>

</zip:archive>

 

 

My sitemap snippet looks like this:

 

      <map:match pattern="zip">

        <map:generate src="cocoon:/datasheet_mockup"/>

        <map:transform src="xslt/datasheet2zip.xslt" type="saxon" label="zip"/>  àresults in (1) 

        <map:serialize type="zip"/>

      </map:match>

 

I can process this pipeline up until transformation.  But the zip serializer gives me following exception:

 

Caused by: org.apache.avalon.framework.service.ServiceException: Component with role 'org.apache.cocoon.serialization.Serializer/' and key 'map' is not defined in this service selector. (Key='AvalonServiceSelector')

      at org.apache.cocoon.serialization.ZipArchiveSerializer.addEntry(ZipArchiveSerializer.java:333)

      at org.apache.cocoon.serialization.ZipArchiveSerializer.startElement(ZipArchiveSerializer.java:211)

      at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:71)

      at $Proxy12.startElement(Unknown Source)

      at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:253)

 

 

I would expect that the name of the serializer is used as key... or is my assumption wrong and do I need to add some extra configuration to the custom serializer?

 

May thx in advance,

Robby Pelssers