You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Tuomo L <tl...@cc.hut.fi> on 2003/10/21 11:47:16 UTC

Class loading problems with custom components

Hi,

I used to have all my custom components in WEB-INF/classes which worked
fine, but now that my project grows, I packed them up in a jar and dropped
the whole thing in WEB-INF/lib. It just doesn't work anymore. I tried using
ParanoidServlet and that init-classloader parameter too.

Here's what appears in cocoon error.log:

ERROR   (2003-10-21) 12:23.02:465   [core.manager] (Unknown-URI)
Unknown-thread/ExcaliburComponentSelector: The component instance for hint
[my-component] has an invalid class name
(bar.foo.components.modules.input.CustomInputModule).

I have in this component's java file:

package bar.foo.components.modules.input;

And by extracting the jar the class file is there, under a right dir.
(bar/foo/components/modules/input/CustomInputModule.class)

Tomcat seems to deploy the jar just fine, by looking at its log.

Any ideas there?

-Tuomo


Cocoon-2.1
Tomcat 4.1.24

Re: Class loading problems with custom components

Posted by Geoff Howard <co...@leverageweb.com>.
Tuomo L wrote:
> Answering to my own question: I had an error in the build file, and the
> jar file was constructed with a wrong directory sctructure. It's ok now.
> Sorry for this! :|

Also don't forget that classes/ is loaded before lib/ so be sure to 
remove your old versions from WEB-INF/classes or your old versions will 
be loaded and used by mistake.

Geoff


>>Hi,
>>
>>I used to have all my custom components in WEB-INF/classes which worked
>>fine, but now that my project grows, I packed them up in a jar and dropped
>>the whole thing in WEB-INF/lib. It just doesn't work anymore. I tried using
>>ParanoidServlet and that init-classloader parameter too.
>>
>>Here's what appears in cocoon error.log:
>>
>>ERROR   (2003-10-21) 12:23.02:465   [core.manager] (Unknown-URI)
>>Unknown-thread/ExcaliburComponentSelector: The component instance for hint
>>[my-component] has an invalid class name
>>(bar.foo.components.modules.input.CustomInputModule).
>>
>>I have in this component's java file:
>>
>>package bar.foo.components.modules.input;
>>
>>And by extracting the jar the class file is there, under a right dir.
>>(bar/foo/components/modules/input/CustomInputModule.class)
>>
>>Tomcat seems to deploy the jar just fine, by looking at its log.
>>
>>Any ideas there?
>>
>>-Tuomo
>>
>>
>>Cocoon-2.1
>>Tomcat 4.1.24
>>
> 
> 
> 
> 



Re: Class loading problems with custom components

Posted by Tuomo L <tl...@cc.hut.fi>.
Answering to my own question: I had an error in the build file, and the
jar file was constructed with a wrong directory sctructure. It's ok now.
Sorry for this! :|

-Tuomo

On Tue, 21 Oct 2003, Tuomo L wrote:

> Hi,
>
> I used to have all my custom components in WEB-INF/classes which worked
> fine, but now that my project grows, I packed them up in a jar and dropped
> the whole thing in WEB-INF/lib. It just doesn't work anymore. I tried using
> ParanoidServlet and that init-classloader parameter too.
>
> Here's what appears in cocoon error.log:
>
> ERROR   (2003-10-21) 12:23.02:465   [core.manager] (Unknown-URI)
> Unknown-thread/ExcaliburComponentSelector: The component instance for hint
> [my-component] has an invalid class name
> (bar.foo.components.modules.input.CustomInputModule).
>
> I have in this component's java file:
>
> package bar.foo.components.modules.input;
>
> And by extracting the jar the class file is there, under a right dir.
> (bar/foo/components/modules/input/CustomInputModule.class)
>
> Tomcat seems to deploy the jar just fine, by looking at its log.
>
> Any ideas there?
>
> -Tuomo
>
>
> Cocoon-2.1
> Tomcat 4.1.24
>

Re: Class loading problems with custom components

Posted by Berin Loritsch <bl...@apache.org>.
Tuomo L wrote:

> Hi,
> 
> I used to have all my custom components in WEB-INF/classes which worked
> fine, but now that my project grows, I packed them up in a jar and dropped
> the whole thing in WEB-INF/lib. It just doesn't work anymore. I tried using
> ParanoidServlet and that init-classloader parameter too.
> 
> Here's what appears in cocoon error.log:
> 
> ERROR   (2003-10-21) 12:23.02:465   [core.manager] (Unknown-URI)
> Unknown-thread/ExcaliburComponentSelector: The component instance for hint
> [my-component] has an invalid class name
> (bar.foo.components.modules.input.CustomInputModule).
> 
> I have in this component's java file:
> 
> package bar.foo.components.modules.input;
> 
> And by extracting the jar the class file is there, under a right dir.
> (bar/foo/components/modules/input/CustomInputModule.class)
> 
> Tomcat seems to deploy the jar just fine, by looking at its log.
> 
> Any ideas there?

The INTERFACES must be in the WEB-INF/classes or WEB-INF/libs direrctories.
The implementations can be anywhere, but the interfaces are what the ECM
needs to share.  Otherwise it is impossible to share those components.
That is one of the reasons the Avalon components are starting to split up
interface JARs from implementation JARs.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin