Using Multiple Domain in a Web Application

From: John Barrett (joh..sbcc.com)
Date: Thu Jan 08 2004 - 17:39:27 EST

  • Next message: Andrus Adamchik: "Re: Using Multiple Domain in a Web Application"

    Hello,

    I am building a Web Application, using Cayenne, with multiple domains.
    One domain is used for the entry point (validate user and get domain
    name) to get the domain to use. I have set up the
    WebApplicationListener in the WEB-INF and am using the following to get
    a DataContext:

    DataContext ctxt = DataContext.createDataContext( "company" );

    This works fine and I am able to access the correct domain/database,
    but in the catalina.out file the following is logged when a new session
    is created:

    INFO - Session event listener threw exception
    org.objectstyle.cayenne.CayenneRuntimeException: [v.1.0.2 October 27
    2003] More than one domain is configured; use 'getDomain(String name)'
    instead.
             at
    org.objectstyle.cayenne.conf.Configuration.getDomain(Configuration.java:
    422)
             at
    org.objectstyle.cayenne.conf.WebApplicationListener.sessionCreated(WebAp
    plicationListener.java:116)
             at
    org.apache.catalina.session.StandardSession.tellNew(StandardSession.java
    :406)
             at
    org.apache.catalina.session.StandardSession.setId(StandardSession.java:
    378)
             at
    org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:
    702)
             at
    org.apache.catalina.session.StandardManager.createSession(StandardManage
    r.java:347)
             at
    org.apache.coyote.tomcat5.CoyoteRequest.doGetSession(CoyoteRequest.java:
    2244)
             at
    org.apache.coyote.tomcat5.CoyoteRequest.getSession(CoyoteRequest.java:
    2087)
             at
    org.apache.coyote.tomcat5.CoyoteRequestFacade.getSession(CoyoteRequestFa
    cade.java:549)
             at
    com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.j
    ava:57)
             at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
    tionFilterChain.java:233)
             at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
    erChain.java:204)
             at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
    e.java:256)
             at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
    ntext.java:151)
             at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    564)
             at
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
    textValve.java:245)
             at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
    e.java:199)
             at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
    ntext.java:151)
             at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    564)
             at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
    :195)
             at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
    ntext.java:151)
             at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
    :164)
             at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
    ntext.java:149)
             at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    564)
             at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
    java:156)
             at
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
    ntext.java:151)
             at
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    564)
             at
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
             at
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
             at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
    805)
             at
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
    onnection(Http11Protocol.java:696)
             at
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
    605)
             at
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
    .java:677)
             at java.lang.Thread.run(Thread.java:554)

    I take it the application is creating a new data context for each
    transaction and not utilizing the session data context. What would be
    the correct way in configuring Cayenne (to eliminate the Exception) and
    obtain the correct data context for a given domain?

    Thanks,

    John Barrett
    JSB Consulting Corporation
    joh..sbcc.com
    703-318-9420



    This archive was generated by hypermail 2.0.0 : Thu Jan 08 2004 - 17:55:47 EST