[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: Using Alfresco from within Tapestry
From:       adasal <adam.saltiel () gmail ! com>
Date:       2007-11-27 12:36:45
Message-ID: e8aa138c0711270436l441639e0oc05cd9a5f488d641 () mail ! gmail ! com
[Download RAW message or body]


I've been wondering about this exchange. I haven't looked this up, but if
this is a problem of sharing across Servlet container contexts then are you
trying "to do what ought not to be done"? Why can't you unpack Alfresco and
add in Tapestry to the existing context?
You have access to Alfresco source which might help as well.
Adam

On 21/11/2007, Kaspar Fischer <fischerk@inf.ethz.ch> wrote:
>
> Hi,
>
> I am still working on how to get access, from my Tapestry webapp in
> Tomcat,
> to a Spring bean called "nodeService" which is from a different
> webapp of
> Tomcat (Alfresco in this case).
>
> In my previous post, I have run into a problem with the load order:
> Alfresco
> was loaded by Tomcat after Tapestry and because of this, the bean was
> not
> found (it obviously does not yet exist when my Tapestry webapp starts).
>
> I've managed to find a way around this by telling the bean
> "alfrescoContext"
> (see below) to load lazily:
>
>   <bean id="alfrescoContext"
> class="org.icarbasel.tapestry.knowledgecenter.alfresco.AlfrescoApplicati
> onContext" lazy-init="true">
>    <property name="nodeService">
>     <ref bean="nodeService" />
>    </property>
>   </bean>
>
> (The rest is the same as in my previous post.)
>
> I know get an exception
>
>    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
>
> I am asking myself now: Is Spring using a different "context" and
> does not
> look in the webapp Alfresco for "nodeService" but only in Tapestry's
> Spring
> "context"?
>
> Any idea what is going wrong here?
>
> Regards,
> Kaspar
>
> P.S. For the sake of completness I add my whole set of configuration/
> Java files.
>
> // WEB-INF/applicatonContext.xml
> <?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" lazy-init="true">
>    <property name="nodeService">
>     <ref bean="nodeService" />
>    </property>
>   </bean>
> </beans>
>
> // relevant part of web.xml
>   <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>
>
> // AlfrescoApplicationContext.java
> package org.icarbasel.tapestry.knowledgecenter.alfresco;
> import org.alfresco.service.cmr.repository.NodeService;
> public class AlfrescoApplicationContext
> {
>    private NodeService nodeService;
>
>    public void setNodeService(NodeService nodeService)
>    {
>      System.err.println("Received nodeService " + nodeService);
>      this.nodeService = nodeService;
>    }
>
>    public NodeService getNodeService()
>    {
>      return this.nodeService;
>    }
> }
>
> // ... and my page which spits out some dummy text
> public abstract class NodePage extends BasePage {
>
>    @InjectObject("spring:alfrescoContext")
>    public abstract AlfrescoApplicationContext getAlfrescoContext();
>
>    public String getGreetingSubject()
>    {
>      System.err.println(getAlfrescoContext().getNodeService());
>      return "dummy";
>    }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic