cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Paul Adams <co...@colina.demon.co.uk>
Subject Re: Problems trying to implement a SourceFactory
Date Sat, 17 Jul 2004 17:26:08 GMT
>>>>> "Colin" == Colin Paul Adams <colin@colina.demon.co.uk> writes:

    Colin> I have written a Source and a SourceFactory for Berkeley DB
    Colin> XML.  My source factory implements
    Colin> org.apache.excalibur.source.SourceFactory (just like
    Colin> PartSourceFactory does, so I assumed it would be OK).  And
    Colin> I added the following line to cocoon.xconf:

    Colin>     <component-instance
    Colin> class="org.apache.cocoon.source.impl.BerkeleyDBXMLSourceFactory"
    Colin> name="bdbxml"/>

    Colin> However, as soon as I try to access Cocoon, I get:

    Colin> Initialization Problem

    Colin> Message: Could not find component (key
    Colin> [org.apache.excalibur.source.SourceResolver])

    Colin> Description:
    Colin> org.apache.avalon.framework.component.ComponentException:
    Colin> Could not find component (key
    Colin> [org.apache.excalibur.source.SourceResolver])

    Colin> Sender: org.apache.cocoon.servlet.CocoonServlet

    Colin> Source: Cocoon Servlet

    Colin> cause

    Colin> java.lang.ClassNotFoundException:
    Colin> org.apache.cocoon.source.impl.BerkeleyDBXMLSourceFactory

OK - I worked that one out - it was a typo on my part, in cocoon.xconf.

But having corrected it, jetty now won't start. I get:

Main Class: org.mortbay.jetty.Server
18:17:20.168 EVENT  Checking Resource aliases
18:17:20.610 EVENT  Starting Jetty/4.2.19
18:17:21.050 EVENT  Started WebApplicationContext[/,./build/webapp]
18:17:21.123 WARN!! Delete existing temp dir /tmp/Jetty__8888__ for WebApplicationContext[/,./build/webapp]
trying to register database
trying to register database
Exception in thread "main" java.lang.reflect.InvocationTargetException
        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 Loader.invokeMain(Unknown Source)
        at Loader.run(Unknown Source)
        at Loader.main(Unknown Source)
Caused by: java.lang.NoClassDefFoundError:org/apache/cocoon/environment/internal/CloningInheritableThreadLocal

Well, certainly such a class does not exist. 
But I have no idea why it should or shouldn't. Any pointers please:

rest of stack trace:
        at org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:53)
        at org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:70)
        at org.apache.cocoon.components.treeprocessor.TreeProcessor.configure(TreeProcessor.java:229)
        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.initialize(ExcaliburComponentManager.java:522)
        at org.apache.cocoon.components.container.CocoonComponentManager.initialize(CocoonComponentManager.java:132)
        at org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:283)
        at org.apache.cocoon.Cocoon.initialize(Cocoon.java:304)
        at org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:283)
        at org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet.java:1385)
        at org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:484)
        at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:220)
        at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:445)
        at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:150)
        at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:458)
        at org.mortbay.http.HttpServer.start(HttpServer.java:663)
        at org.mortbay.jetty.Server.main(Server.java:429)
        ... 7 more

My source factory just looks like this:

package org.apache.cocoon.components.source.impl;

import java.util.Map;
import java.net.MalformedURLException;

import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceFactory;

/**
 * A factory for Berkeley DB XML sources (see {@link BerkeleyDBXMLSource}).
 * 
 * @avalon.component
 * @avalon.service type=SourceFactory
 * @x-avalon.info name=berkeleyDBXML-source
 * @x-avalon.lifestyle type=singleton
 * 
 * @author <a href="mailto:colin@colina.demon.co.uk">Colin Adams</a>
 */
public class BerkeleyDBXMLSourceFactory
    implements SourceFactory {


    /**
     * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
     */
    public Source getSource(String location, Map parameters) throws MalformedURLException
    {
        return new BerkeleyDBXMLSource(location);
    }

    /**
     * Does nothing, since {@link BerkeleyDBXMLSource}s don't need to be released (at present).
     * 
     * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
     */
    public void release(Source source)
    {
        // Nothing to do here
    }

}

-- 
Colin Paul Adams
Preston Lancashire

Mime
View raw message