Re: Multi Domain deploy problem

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Thu Aug 20 2009 - 07:32:44 EDT

  • Next message: akira: "Re: Multi Domain deploy problem"

    Hi,

    WebApplicationContextFilter indirectly (in ServerUtil class) uses
    DataContext.createDataContext() [NO PARAMETERS] method. It will not work
    with multi domain app. For that, you will need to rewrite
    WebApplicationContextFilter so that it uses
    DataContext.createDataContext(String domainName) mathod.

    Regards,
    Andrey

    2009/8/20 akira <wilsonaiked..mail.com>

    > Hi, i'm new to cayenne and i have a problem deploying a multi domain app. I
    > have followed cayenne's tutorial on how to deal with multi domain
    > applications, basically what i did was:
    > 1. Put domains, nodes and cayenne xml files inside WEB-INF/lib;
    > 2. Put the cayenne configuration path in web.xml;
    > 3. Put the CayenneFilter in web.xml
    > 4. I have a domain service class where i'm managing the domains:
    >
    > public class DomainManagerImpl implements DomainManagerDAO {
    >
    > public DataContext context = null;
    >
    > public DataContext getContext(String domain) {
    >
    > if (context == null || context.getParentDataDomain().getName() !=
    > domain) {
    > try {
    > context = DataContext.createDataContext(domain);
    > } catch (Exception e) {
    > e.printStackTrace();
    > }
    > }
    > return context;
    > }
    > }
    >
    > my web.xml:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <!DOCTYPE web-app
    > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    > "http://java.sun.com/dtd/web-app_2_3.dtd">
    > <web-app>
    > <display-name>mywebapp</display-name>
    > <context-param>
    > <!-- informs Tapestry where to look for pages, components and
    > mixins. -->
    > <param-name>tapestry.app-package</param-name>
    > <param-value>com.example.mywebapp</param-value>
    > </context-param>
    > <context-param>
    > <param-name>cayenne.configuration.path</param-name>
    > <param-value>/WEB-INF/config/cayenne-files</param-value>
    > </context-param>
    > <filter>
    > <filter-name>app</filter-name>
    > <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
    > </filter>
    > <!-- Filter for cayenne context -->
    > <filter>
    > <filter-name>CayenneFilter</filter-name>
    >
    > <filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</filter-class>
    > </filter>
    > <filter-mapping>
    > <filter-name>CayenneFilter</filter-name>
    > <url-pattern>/*</url-pattern>
    > </filter-mapping>
    > <filter-mapping>
    > <filter-name>app</filter-name>
    > <url-pattern>/*</url-pattern>
    > </filter-mapping>
    > </web-app>
    >
    > and when deployed i'm getting the following error:
    >
    > [#|2009-08-20T19:37:19.742+0900|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=e6b9b518-937d-40c4-8a75-70c95472c657;|StandardWrapperValve[default]:
    > PWC1406: Servlet.service() for servlet default threw exception
    > org.apache.cayenne.CayenneRuntimeException: [v.3.0M6 May 25 2009 19:26:54]
    > More than one domain is configured; use 'getDomain(String name)' instead.
    > at
    > org.apache.cayenne.conf.Configuration.getDomain(Configuration.java:425)
    > at
    > org.apache.cayenne.access.DataContext.createDataContext(DataContext.java:145)
    > at
    > org.apache.cayenne.conf.ServletUtil.getSessionContext(ServletUtil.java:116)
    > at
    > org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:86)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    > at
    > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
    > at
    > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
    > at
    > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
    > at
    > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    > at
    > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    > at
    > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
    > at
    > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    > at
    > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    > at
    > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
    > at
    > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    > at
    > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    > at
    > org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
    > at
    > com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
    > at
    > com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
    > at
    > com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
    > at
    > com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
    > at
    > com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
    > at
    > com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
    > at
    > com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
    > at
    > com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    > at
    > com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    > |#]
    >
    > I have searched in the web for errors like this but found nothing, what's
    > the best approach when dealing with multi domains configuratiion files?
    > I'm using Cayenne 3.0M6 server, Tapestry 5.1, Glassfish v2 on Mac OS X.
    > TIA.
    >
    > Oh, forgot to say that i have reengineered a postgres db using modeller and
    > it generated all the classes, i did nothing, just watch! Wonderful!



    This archive was generated by hypermail 2.0.0 : Thu Aug 20 2009 - 07:33:22 EDT