You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jean-Christophe Kermagoret <jc...@openbluelab.org> on 2007/08/16 12:48:33 UTC
Circular references with servlet service in C22
Hi,
is it possible to make circular references with servlet services ?
In other words, does a servlet need to be available to be referenced ?
For example :
action-master contains :
<bean id="org.openbluelab.actionmaster.block"
class="org.apache.cocoon.sitemap.SitemapServlet">
<servlet:context mount-path="/action-master"
context-path="blockcontext:/action-master/">
<servlet:connections>
<entry key="cms" value-ref="org.openbluelab.cms.block"/>
...
cms contains :
<bean id="org.openbluelab.cms.block"
class="org.apache.cocoon.sitemap.SitemapServlet">
<servlet:context mount-path="/content"
context-path="blockcontext:/cms/">
<servlet:connections>
<entry key="action-master"
value-ref="org.openbluelab.actionmaster.block"/>
...
With this configuration, I get the following error :
[ERROR] ContextLoader - Context initialization failed
<org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'org.openbluelab.cms.block': Cannot resolve reference to
bean 'org.openbluelab.actionmaster.block' while setting bean property
'connections' with key [TypedStringValue: value [action-master], target
type [null]]; ...
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.openbluelab.actionmaster.block':
Cannot resolve reference to bean 'org.openbluelab.cms.block' while
setting bean property 'connections' with key [TypedStringValue: value
[cms], target type [null]]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'org.openbluelab.cms.block': FactoryBean threw exception
on object creation; nested exception is
java.lang.IllegalArgumentException: Target object must not be null
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.openbluelab.cms.block': FactoryBean
threw exception on object creation; nested exception is
java.lang.IllegalArgumentException: Target object must not be null
Caused by: java.lang.IllegalArgumentException: Target object must not be
null
Thanks for your help
JC
--
Jean-Christophe Kermagoret,
OpenBlueLab Technological Leader
http://www.openbluelab.org
http://forge.openbluelab.org
http://wiki.openbluelab.org
http://demo.openbluelab.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Circular references with servlet service in C22
Posted by Jean-Christophe Kermagoret <jc...@openbluelab.org>.
I'm ok with you about circular dependencies. They are bad practice and
must be avoided. But if I could save my time and concentrate on bugs
which are important for my work, I would prefer. Then, I could come back
later on this new architecture constraints.
I'm just realizing that moving from C21 to C22 will take more time, even
if it's for a better world ;-)
JC
Grzegorz Kossakowski a écrit :
> Jean-Christophe Kermagoret pisze:
>> Hi,
>>
>> I'm not talking about inheritance, only usage relationships.
>
> I pointed you to that discussion to give you how good design can
> eliminate a need for circular dependencies.
>
>> For example, I have 2 services :
>> * locator, which locates resources
>> * common, which provides common stylesheets
>>
>> Each service is using the other one, not in a fallback mechanism. I'm
>> surprised this behavior is not allowed.
>
> Could you show some flow between locator and common so I can get
> better of idea of each block's role?
>
>> With C21, I could use mount table to describe where my services were
>> located. How may I design this in C22 ? Is servlet: the right choice
>> in my case ?
>
> To give you exact advice I need more details about your use case.
>
> As general note, block is not only about sitemap in C2.2, it's also a
> reusable unit packaged with Maven.
> With regard to circular dependencies:
> a) Maven does not allow artifacts in circular dependencies (and you
> always get the answer that your design is probably flawed when you
> need them)
> b) Spring does not allow beans to depend on themselves in circle (with
> exceptions, though). You get more or less the same answer as from
> Maven folks if you question this behaviour.
>
> Don't you think that common wisdom of these communities can't be wrong?
>
> Even though it was possible with Cocoon 2.1, in Cocoon 2.2 we are
> trying to live in better harmony with rest of the world. That's one of
> consequences.
>
--
Jean-Christophe Kermagoret,
OpenBlueLab Technological Leader
http://www.openbluelab.org
http://forge.openbluelab.org
http://wiki.openbluelab.org
http://demo.openbluelab.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Circular references with servlet service in C22
Posted by Grzegorz Kossakowski <gk...@apache.org>.
Jean-Christophe Kermagoret pisze:
> Hi,
>
> I'm not talking about inheritance, only usage relationships.
I pointed you to that discussion to give you how good design can eliminate a need for circular
dependencies.
> For
> example, I have 2 services :
> * locator, which locates resources
> * common, which provides common stylesheets
>
> Each service is using the other one, not in a fallback mechanism. I'm
> surprised this behavior is not allowed.
Could you show some flow between locator and common so I can get better of idea of each block's role?
> With C21, I could use mount table to describe where my services were
> located. How may I design this in C22 ? Is servlet: the right choice in
> my case ?
To give you exact advice I need more details about your use case.
As general note, block is not only about sitemap in C2.2, it's also a reusable unit packaged with Maven.
With regard to circular dependencies:
a) Maven does not allow artifacts in circular dependencies (and you always get the answer that your
design is probably flawed when you need them)
b) Spring does not allow beans to depend on themselves in circle (with exceptions, though). You get
more or less the same answer as from Maven folks if you question this behaviour.
Don't you think that common wisdom of these communities can't be wrong?
Even though it was possible with Cocoon 2.1, in Cocoon 2.2 we are trying to live in better harmony
with rest of the world. That's one of consequences.
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/
*** My Internet Service Provider breaks my internet connection ***
*** incessantly so I'll not be able to respond to e-mails ***
*** regularly and my work will be somehow irregular. ***
*** I'm already trying to switch ISP but it will take handful amount of time. ***
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Circular references with servlet service in C22
Posted by Jean-Christophe Kermagoret <jc...@openbluelab.org>.
Hi,
I'm not talking about inheritance, only usage relationships. For
example, I have 2 services :
* locator, which locates resources
* common, which provides common stylesheets
Each service is using the other one, not in a fallback mechanism. I'm
surprised this behavior is not allowed.
With C21, I could use mount table to describe where my services were
located. How may I design this in C22 ? Is servlet: the right choice in
my case ?
JC
Grzegorz Kossakowski a écrit :
> Jean-Christophe Kermagoret pisze:
>> Hi,
>> is it possible to make circular references with servlet services ?
>
> No and if you need circular references you can be pretty sure that
> there is a flaw in your design and you must go back to the whiteboard.
> Also take a look at COCOON-2036[1] and COCOON-2038[2] and this
> discussion[3] that give you an idea why circular dependencies are
> wrong and how to avoid them. Especially this[4] and this[5] messages
> are the most interesting.
>
>>
>> Thanks for your help
>
> I hope that helps a little.
>
> [1] https://issues.apache.org/jira/browse/COCOON-2036
> [2] https://issues.apache.org/jira/browse/COCOON-2038
> [3] http://thread.gmane.org/gmane.text.xml.cocoon.devel/72317
> [4] http://article.gmane.org/gmane.text.xml.cocoon.devel/72335
> [5] http://article.gmane.org/gmane.text.xml.cocoon.devel/72358
>
--
Jean-Christophe Kermagoret,
OpenBlueLab Technological Leader
http://www.openbluelab.org
http://forge.openbluelab.org
http://wiki.openbluelab.org
http://demo.openbluelab.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Circular references with servlet service in C22
Posted by Grzegorz Kossakowski <gk...@apache.org>.
Jean-Christophe Kermagoret pisze:
> Hi,
> is it possible to make circular references with servlet services ?
No and if you need circular references you can be pretty sure that there is a flaw in your design
and you must go back to the whiteboard.
Also take a look at COCOON-2036[1] and COCOON-2038[2] and this discussion[3] that give you an idea
why circular dependencies are wrong and how to avoid them. Especially this[4] and this[5] messages
are the most interesting.
>
> Thanks for your help
I hope that helps a little.
[1] https://issues.apache.org/jira/browse/COCOON-2036
[2] https://issues.apache.org/jira/browse/COCOON-2038
[3] http://thread.gmane.org/gmane.text.xml.cocoon.devel/72317
[4] http://article.gmane.org/gmane.text.xml.cocoon.devel/72335
[5] http://article.gmane.org/gmane.text.xml.cocoon.devel/72358
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/
*** My Internet Service Provider breaks my internet connection ***
*** incessantly so I'll not be able to respond to e-mails ***
*** regularly and my work will be somehow irregular. ***
*** I'm already trying to switch ISP but it will take handful amount of time. ***
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org