You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2004/07/17 12:59:59 UTC

Problems trying to implement a SourceFactory

I have written a Source and a SourceFactory for Berkeley DB XML.

My source factory implements org.apache.excalibur.source.SourceFactory
(just like PartSourceFactory does, so I assumed it would be OK).
And I added the following line to cocoon.xconf:

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

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

Initialization Problem

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

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

Sender: org.apache.cocoon.servlet.CocoonServlet

Source: Cocoon Servlet

cause

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

request-uri

/

full exception chain stacktrace

Original Exception: org.apache.avalon.framework.service.ServiceException: Could not access the Component (key [org.apache.excalibur.source.SourceFactorySelector]) (Key='org.apache.excalibur.source.SourceFactorySelector')
	at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:119)

What step have I missed out?
-- 
Colin Paul Adams
Preston Lancashire

Re: Problems trying to implement a SourceFactory

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:

    Ralph> Does it make a difference if you declare your SourceFactory
    Ralph> as implementing ThreadSafe?  It should be since it is.

No. I originally did, but then I took it off, in case that was the
problem.
Just to make sure, I've just put it back on. No change that I can see.
-- 
Colin Paul Adams
Preston Lancashire

Re: Bug in Cocoon Source Resolver (was Problems trying to implement a SourceFactory)

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Joerg" == Joerg Heinicke <jo...@gmx.de> writes:

    >> cocoon-2.0.0-dev sub-directory.

    Joerg> This is cocoon-2.2.0-dev, isn't it?

Sorry, yes.
OK - I shall report it against Current CVS 2.1
-- 
Colin Paul Adams
Preston Lancashire

Re: Bug in Cocoon Source Resolver (was Problems trying to implement a SourceFactory)

Posted by Joerg Heinicke <jo...@gmx.de>.
On 18.07.2004 09:06, Colin Paul Adams wrote:

>>>>>>"Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:
> 
> 
>     Colin> So, shall I raise a bug then?
>     Ralph> I certainly would.
> 
> OK.
> 
> But before I do, I'd better be certain which version from CVS I'm
> running.
> 
> I checked out anonymously a few weeks ago. I thought it was cocoon 2.1
> then (but I'm not certain).
> 
> But these days, when I do a build, the build directory has a
> cocoon-2.0.0-dev sub-directory.

This is cocoon-2.2.0-dev, isn't it?

> Yet CVS/Repository says cocoon-2.1

Yes, that's an irritating naming. We will fix it when moving to SVN.

> And Bugzilla offers me both Current CVS 2.1 and Current CVS 2.2
> 
> So I think it must be 2.2, but I'm not sure.

Please use 2.1.

> Maybe I should check out afresh from scratch. Will that guarentee 2.2?

Don't use cocoon-2.2 repository as it contains "something completely 
different": it was thought as 2.2, but we decided later to continue 
development in cocoon-2.1 repository. The 2.2 repository had some 
refactoring that were hopefully all backported to 2.1 repository and 
additional a new container. cocoon-2.2 will be only a branch in SVN.

Joerg

Re: Bug in Cocoon Source Resolver (was Problems trying to implement a SourceFactory)

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:

    Colin> So, shall I raise a bug then?
    Ralph> I certainly would.

OK.

But before I do, I'd better be certain which version from CVS I'm
running.

I checked out anonymously a few weeks ago. I thought it was cocoon 2.1
then (but I'm not certain).

But these days, when I do a build, the build directory has a
cocoon-2.0.0-dev sub-directory.
Yet CVS/Repository says cocoon-2.1

And Bugzilla offers me both Current CVS 2.1 and Current CVS 2.2

So I think it must be 2.2, but I'm not sure.
Maybe I should check out afresh from scratch. Will that guarentee 2.2?
-- 
Colin Paul Adams
Preston Lancashire

Bug in Cocoon Source Resolver (was Problems trying to implement a SourceFactory)

Posted by Ralph Goers <Ra...@dslextreme.com>.
I certainly would.

Ralph

At 7/17/2004  10:51 PM, you wrote:
> >>>>> "Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:
>
>     Ralph>  From your comments it sounds like you are running against
>     Ralph> the latest in CVS. Have you tried this with 2.1.5?
>     Ralph> CocoonSourceResolver doesn't even exist in that version so
>     Ralph> perhaps you have just found a bug.
>
>Jetty starts up without problems on 2.1.5.
>What is more, my BerkeleyDBXMLSource gets invoked! (so, it has errors
>- but at least I can try and debug it now!).
>
>So, shall I raise a bug then?
>--
>Colin Paul Adams
>Preston Lancashire


Re: Problems trying to implement a SourceFactory

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:

    Ralph>  From your comments it sounds like you are running against
    Ralph> the latest in CVS. Have you tried this with 2.1.5?
    Ralph> CocoonSourceResolver doesn't even exist in that version so
    Ralph> perhaps you have just found a bug.

Jetty starts up without problems on 2.1.5.
What is more, my BerkeleyDBXMLSource gets invoked! (so, it has errors
- but at least I can try and debug it now!).

So, shall I raise a bug then?
-- 
Colin Paul Adams
Preston Lancashire

Re: Problems trying to implement a SourceFactory

Posted by Ralph Goers <Ra...@dslextreme.com>.
 From your comments it sounds like you are running against the latest in 
CVS. Have you tried this with 2.1.5? CocoonSourceResolver doesn't even 
exist in that version so perhaps you have just found a bug.

Ralph

At 7/17/2004  09:43 PM, you wrote:
> >>>>> "Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:
>
>     Ralph> I did some searching. CloningInheritableThreadLocal does
>     Ralph> exist as a private class in CocoonComponentManager.  What
>     Ralph> this has to do with what you are doing, I have no idea.
>
>Hm. Maybe there's more than one. Anyway, it doesn't appear to be that
>one.
>
>Looking carefully at the stack trace again:
>
>Caused by: java.lang.NoClassDefFoundError: 
>org/apache/cocoon/environment/internal/CloningInheritableThreadLocal
>         at 
> org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:53)
>
>Line 53 reads: (this is from CVS head, last updated here a few days ago)
>
>             final Processor processor 
> =  EnvironmentHelper.getCurrentProcessor();
>
>There is no call to getCurrentProcessor() in the stack trace.
>This, I think is because EnvironmentHelper contains:
>
>     /** The environment information */
>     static protected final InheritableThreadLocal environmentStack 
> =   new CloningInheritableThreadLocal();
>
>which gets called first.
>
>Now CloningInheritableThreadLocal is indeed a local class within
>EnvironmentHelper. No constructors are defined.
>
>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)
>
>Why the Loader can't find this class, I don't know (I know very little
>about Java, and nothing about reflection).
>--
>Colin Paul Adams
>Preston Lancashire


Re: Problems trying to implement a SourceFactory

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Ralph" == Ralph Goers <Ra...@dslextreme.com> writes:

    Ralph> I did some searching. CloningInheritableThreadLocal does
    Ralph> exist as a private class in CocoonComponentManager.  What
    Ralph> this has to do with what you are doing, I have no idea.

Hm. Maybe there's more than one. Anyway, it doesn't appear to be that
one.

Looking carefully at the stack trace again:

Caused by: java.lang.NoClassDefFoundError: org/apache/cocoon/environment/internal/CloningInheritableThreadLocal
        at org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:53)

Line 53 reads: (this is from CVS head, last updated here a few days ago)

            final Processor processor =  EnvironmentHelper.getCurrentProcessor();

There is no call to getCurrentProcessor() in the stack trace.
This, I think is because EnvironmentHelper contains:

    /** The environment information */
    static protected final InheritableThreadLocal environmentStack =   new CloningInheritableThreadLocal();

which gets called first.

Now CloningInheritableThreadLocal is indeed a local class within
EnvironmentHelper. No constructors are defined.

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)

Why the Loader can't find this class, I don't know (I know very little
about Java, and nothing about reflection).
-- 
Colin Paul Adams
Preston Lancashire

Re: Problems trying to implement a SourceFactory

Posted by Ralph Goers <Ra...@dslextreme.com>.
I did some searching. CloningInheritableThreadLocal does exist as a private 
class in CocoonComponentManager.  What this has to do with what you are 
doing, I have no idea.

Ralph

At 7/17/2004  02:29 PM, you wrote:
>Does it make a difference if you declare your SourceFactory as 
>implementing ThreadSafe?  It should be since it is.
>
>Ralph
>
>At 7/17/2004  10:26 AM, you wrote:
>> >>>>> "Colin" == Colin Paul Adams <co...@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
>


Re: Problems trying to implement a SourceFactory

Posted by Ralph Goers <Ra...@dslextreme.com>.
Does it make a difference if you declare your SourceFactory as implementing 
ThreadSafe?  It should be since it is.

Ralph

At 7/17/2004  10:26 AM, you wrote:
> >>>>> "Colin" == Colin Paul Adams <co...@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


Re: Problems trying to implement a SourceFactory

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Colin" == Colin Paul Adams <co...@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