On 20.11.2007, at 07:23, <[EMAIL PROTECTED]> wrote:
If your Tomcat instance is dedicated to alfresco and your tapestry
app,
I would try to go with the shared/lib approach.
Logging in Tomcat is a bit complicated to get right due to the funny
classloading hierarchy and commons-logging's log-method detection.
I put
commons-logging into each web-app's lib *and* common/lib. Then, I need
commons-logging.properties in common/classes to point to log4j as
backend-impl.
Again, many thanks, Marcus! Your tip helped me and I have the Tomcat
logging fixed. I followed your instructions and the ones from the
Spring user manual,
http://static.springframework.org/spring/docs/2.0.x/reference/
webintegration.html#view-tapestry-40-style-di
and everything works beautifully up to the load order of the webapps:
As my module starts before Alfresco, I cannot reference the (yet non-
existing) bean of Alfresco that represents the Alfresco Node Service!
Here's the situation in more detail: I have an application context like
this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="alfrescoContext"
class="org.icarbasel.tapestry.knowledgecenter.alfresco.AlfrescoApplicati
onContext">
<property name="nodeService">
<value>Foo</value> <!-- works! -->
<!-- <ref bean="nodeService" /> -->
</property>
</bean>
</beans>
with a bean class AlfrescoApplicationContext.java that simply receives
the value ("Foo" in this case). My web.xml contains
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-
class>org.springframework.web.context.ContextLoaderListener</listener-
class>
</listener>
and my page class is this:
public abstract class NodePage extends BasePage {
@InjectObject("spring:alfrescoContext")
public abstract AlfrescoApplicationContext getAlfrescoContext();
// ..
}
Everything works fine up to the point when I change '<value>Foo</value>'
to '<ref bean="nodeService" />' in my bean (and of course change the
type in the bean class from String to Alfresco's NodeService).
At this point I get at startup
ERROR main org.springframework.web.context.ContextLoader - Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'alfrescoContext' defined in
ServletContext resource
[/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean
'nodeService' while setting bean property 'nodeService'; nested
exception
is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'nodeService' is defined
And I sort of understand it: At this point, Alfresco is started by
Tomcat after my Tapestry webapp and it seems that due to its multi-
threaded nature, one cannot require a particular order in which the
webapps are deployed.
Any suggestion as to what I could do?
I though about calling Spring's getBean() not at startup but at a later
point but do not have any idea which application context to use, i.e.,
how to obtain an application context at all!?
Thanks in advance for any pointer!
Best,
Kaspar
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]