You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Torsten Curdt <tc...@dff.st> on 2001/09/12 14:10:45 UTC

ClassUtil

I have a component that has it's own ExcaliburComponentManager
with the CocoonComponentManager as parent.
I'm trying now to set it up with it's own config file. For the
roles I was trying:

 URL resource = ClassUtils.getResource("st/dff/desire/desire.roles");

but the resource is just null. (it's definitly in the jar and in the
classpath) This is strange because I use the same ClassLoader (from the context)
as Cocoon does.

 manager = new ExcaliburComponentManager(cocoonManager,(ClassLoader)context.get(org.apache.cocoon.Constans.CONTEXT_CLASS_LOADER));

Any hints?
Thanks
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: ClassUtil

Posted by Michael McKibben <mm...@ncube.com>.
Hello, check you path and make sure it is relative to the jar file's root
path and *not* relative to the path of your class package name. The reason
for this is that ClassUtils uses java.lang.ClassLoader.getResource(...)
*not* java.lang.Class.getResource(...).  With Class.getResource(...)
relative paths get the current Class's package name prepended to the
resource path before delgating to ClassLoader.getResource(...).
ClassLoader.getResource(...) on the otherhand does not do this kind of
name resolving.

Regards,

--mike

On Wed, 12 Sep 2001, Torsten Curdt wrote:

> I have a component that has it's own ExcaliburComponentManager
> with the CocoonComponentManager as parent.
> I'm trying now to set it up with it's own config file. For the
> roles I was trying:
>
>  URL resource = ClassUtils.getResource("st/dff/desire/desire.roles");
>
> but the resource is just null. (it's definitly in the jar and in the
> classpath) This is strange because I use the same ClassLoader (from the context)
> as Cocoon does.
>
>  manager = new ExcaliburComponentManager(cocoonManager,(ClassLoader)context.get(org.apache.cocoon.Constans.CONTEXT_CLASS_LOADER));
>
> Any hints?
> Thanks
> --
> Torsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org