You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andreas Hartmann <an...@apache.org> on 2009/02/19 13:15:18 UTC

[2.2] Spring class loading issue: WebAppClassLoader vs. ResourceStoreClassLoader

Hi Cocooners,

in my C2.2 application, I have two modules "usecase" and "acusecases", 
with acusecases depending on usecase. usecase is a block, acusecases isn't.

A bean in acusecases shall get a reference to another bean defined in 
acusecases. The class of this bean is declared in usecase.

Now I get the following exception:

org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type [org.apache.lenya.cms.usecase.UsecaseView] to 
required type [org.apache.lenya.cms.usecase.UsecaseView] for property 'view'

Since the class is the same, the classloader is the source of the 
problem. Using the debugger I found out that the bean (from the 
acusecases module) is loaded using a WebAppClassLoader, but the class
(from the usecase module) is loaded using a ResourceStoreClassLoader.

Firing up Jetty with 
-Dorg.mortbay.jetty.webapp.parentLoaderPriority=true doesn't help.

Any hints how to solve this issue?

TIA!

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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


Re: [2.2] Spring class loading issue: WebAppClassLoader vs. ResourceStoreClassLoader

Posted by Reinhard Pötz <re...@apache.org>.
Andreas Hartmann wrote:
> Andreas Hartmann schrieb:
>> Hi Cocooners,
>>
>> in my C2.2 application, I have two modules "usecase" and "acusecases",
>> with acusecases depending on usecase. usecase is a block, acusecases
>> isn't.
>>
>> A bean in acusecases shall get a reference to another bean defined in
>> acusecases. The class of this bean is declared in usecase.
>>
>> Now I get the following exception:
>>
>> org.springframework.beans.TypeMismatchException: Failed to convert
>> property value of type [org.apache.lenya.cms.usecase.UsecaseView] to
>> required type [org.apache.lenya.cms.usecase.UsecaseView] for property
>> 'view'
>>
>> Since the class is the same, the classloader is the source of the
>> problem. Using the debugger I found out that the bean (from the
>> acusecases module) is loaded using a WebAppClassLoader, but the class
>> (from the usecase module) is loaded using a ResourceStoreClassLoader.
> 
> The issue could be resolved by removing the usecase block from
> rcl.properties. Apparently it's not possible to mix non-RCL projects
> with RCL-enabled blocks. Is this the case?

I suggest that you load "acusecases" by the reloading classloader too.
See
http://cocoon.apache.org/2.2/maven-plugins/maven-plugin/1.0/1298_1_1.html

%classes-dir=/path/to/acusecases/target/classes

Nonetheless I agree with Torsten that it should work the way you tried
and smells like a bug.

-- 
Reinhard Pötz                           Managing Director, {Indoqa} GmbH
                         http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member                  reinhard@apache.org
________________________________________________________________________

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


Re: [2.2] Spring class loading issue: WebAppClassLoader vs. ResourceStoreClassLoader

Posted by Torsten Curdt <tc...@apache.org>.
> Apparently it's not possible to mix non-RCL projects with
> RCL-enabled blocks. Is this the case?

At least this *should* not be the case. I'd consider that a bug.

cheers
--
Torsten

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


Re: [2.2] Spring class loading issue: WebAppClassLoader vs. ResourceStoreClassLoader

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
> Hi Cocooners,
> 
> in my C2.2 application, I have two modules "usecase" and "acusecases", 
> with acusecases depending on usecase. usecase is a block, acusecases isn't.
> 
> A bean in acusecases shall get a reference to another bean defined in 
> acusecases. The class of this bean is declared in usecase.
> 
> Now I get the following exception:
> 
> org.springframework.beans.TypeMismatchException: Failed to convert 
> property value of type [org.apache.lenya.cms.usecase.UsecaseView] to 
> required type [org.apache.lenya.cms.usecase.UsecaseView] for property 
> 'view'
> 
> Since the class is the same, the classloader is the source of the 
> problem. Using the debugger I found out that the bean (from the 
> acusecases module) is loaded using a WebAppClassLoader, but the class
> (from the usecase module) is loaded using a ResourceStoreClassLoader.

The issue could be resolved by removing the usecase block from 
rcl.properties. Apparently it's not possible to mix non-RCL projects 
with RCL-enabled blocks. Is this the case?

Thanks for any comments,

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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