Hi all,

I've found an answer to this from Howard (
http://article.gmane.org/gmane.comp.java.tapestry.user/53987 ). He
says: "*Basically,
you shouldn't mix component classes with services classes. When you do so,
you need to define an interface for your components to implement.*"

Here's what I did:
1) I set up a service called AdminDataSource which is a simple DAO with a
DB4O implementation to store management objects for components.

2) Defined a ComponentConfiguration interface which is a marker interface
for classes to be used as component configuration

3) in my base class for components (AbstractComponent) I introduced methods
to save and load the configuration (they delegate to the injected service,
AdminDataSource to get the work done).

I think this is a rather common scenario, that a component uses a service.
How could I have avoided this? By instantiating an AdminDataSource for the
component (no service involved)?

thx in advance,
janos

2008/5/5 János Jarecsni <[EMAIL PROTECTED]>:

> Hi guys,
>
> I get this:
>
> loader constraint violation: when resolving interface method
> "com.foo.services.AdminDataSource.getConfiguration(Lcom/foo/base/Component;)Lcom/foo/services/ComponentConfiguration;"
> the class loader (instance of
> org/apache/tapestry/internal/services/ComponentInstantiatorSourceImpl$PackageAwareLoader)
> of the current class, com/foo/base/AbstractComponent, and the class loader
> (instance of org/apache/catalina/loader/WebappClassLoader) for resolved
> class, com/foo/services/AdminDataSource, have different Class objects for
> the type com/foo/base/Component used in the signature
>
> What I can see from this, is two different class loaders load some
> classes. What I have is a component class trying to use a service of mine.
> What am I doing wrong? :)
>
> Thx in advance!
> Cheers
> janos
>

Reply via email to