Benjamin Boksa wrote:
Hi List,
attached is a reproducible error I get when using the Cocoon Spring
Configurator 2.0 in "stand-alone" mode. The idea is to use the
configurator to implement a kind of ServiceLocator which internally uses
Spring and hides away the implementation details from the user (let me
know if this is completely bullshit…). It uses its own configuration
directories (META-INF/foo-service/{spring,properties}) to not get any
conflicts with "standard" cocoon locations.
Nevertheless here is the procedure to reproduce the error that drives me
mad:
1. Expand the attached file and change to the "configurator-test"-directory
2. run "mvn test" (you will see that two Strings ("Hello" and "Har Har")
are printed, where "Har Har" is configured using a PropertyPlaceholder -
this is the expected behaviour)
3. run "mvn install" to install the configurator-test artifact to you
local repository (don't forget to delete it later)
4. change to the test directory (cd ../test)
5. run mvn jetty:run
6. Open you browser and go to http://localhost:8888/test/spring-bean
7. BOOOM! You will see a "BeanDefinitionStoreException: Could not
resolve placeholder 'test.text'" - which works fine in step 2
This leads me to the assumption that
/META-INF/foo-service/spring/foo.xml from configurator-test is read
correctly but the Spring Configurator somehow fails to read
/META-INF/foo-service/properties/foo.properties…
If you need further information let me know about it - if I did
something wrong please let me know. I would be glad if you could
actually help me to fix this error as I can't imagine another solution
for my problem.
Please help me and let me know if I should file a bug report. Thanks in
advance
I have run your test scenario. Please use the following statement:
<configurator:settings>
<configurator:include-beans
dir="classpath*:/META-INF/foo-service/spring"/>
<configurator:include-properties
dir="classpath*:/META-INF/foo-service/properties"/>
</configurator:settings>
using classpath*: ensures that spring will scan all available jars for
that path and aggregate the results.
Your custom spring context gets properly initialized now but there is
another error that shows your block is somehow invalid:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'foo.test.service': Invocation of init
method failed; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'org.apache.excalibur.source.SourceResolver' is defined
I can't help you with that: I am still not using blocks in my project.
Hope that helps.
--
Leszek Gawron http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.