[question] Tomcat 5.5 & JNDI DataSources

From: Laszlo Spoor (lspoor_cayenn..otmail.com)
Date: Thu Feb 10 2005 - 10:03:35 EST

  • Next message: Andrus Adamchik: "RE: Cache with StoredProcedure cursor parameter"

    Cayenne 1.1
    MySQL 4.12
    Tomcat 5.5.7

    Hello,

    I want to use a JNDI DataSource for connecting to my Database. These are the
    steps I followed:

    - Used the modeler to tell Cayenne that I want to use the DataSource
    jdbc/PvaDS (as explained in the documentation)
    - Added to web.xml
            <listener>
               
    <listener-class>org.objectstyle.cayenne.conf.BasicServletConfiguration</listener-class>
            </listener>

      <resource-ref>
       <res-ref-name>jdbc/PvaDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
    </resource-ref>

    - Added to server.xml (In <GlobalNamingResources>-tag):

    <Resource name="jdbc/PvaDS"
              auth="Container"
              type="javax.sql.DataSource"
              factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
              maxActive="100"
              maxIdle="30"
              maxWait="10000"
              username="pva"
              password="welcome1"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/pva_dev?autoReconnect=true"/>

    - Added to context.xml (in <Context>-tag):

    <ResourceLink global="jdbc/PvaDS" name="jdbc/PvaDS"
    type="javax.sql.DataSource"/>

    I am certain that all references to the JNDI Datasource point to:
    jdbc/PvaDS. I have tried to use the factory:
    'org.objectstyle.cayenne.conn.ContainerPoolFactory', but then Tomcat does
    not want to start.

    Now, when I start Tomcat, I get the following message:

    15:12:14 ERROR (ManagerBase) -Exception loading sessions from persistent
    storage
    org.objectstyle.cayenne.ConfigurationException: [v.1.1 December 6 2004]
    Error during Configuration initialization. [v.1.1 December 6 2004] Load
    failures. Main configuration class:
    org.objectstyle.cayenne.conf.DefaultConfiguration, details:
            domain.node.name=ProvestaDomainNode, domain.node.datasource=jdbc/PvaDS,
    reason: DataSource load failed - Name jdbc is not bound in this Context
            at
    org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:304)
            at
    org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:278)
            at
    org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:261)
            at
    org.objectstyle.cayenne.conf.Configuration.getSharedConfiguration(Configuration.java:224)
            at
    org.objectstyle.cayenne.access.DataContext.awakeFromDeserialization(DataContext.java:350)
            at
    org.objectstyle.cayenne.access.DataContext.getObjectStore(DataContext.java:423)
            at
    org.objectstyle.cayenne.access.DataContext.readObject(DataContext.java:1872)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
            at
    java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
            at
    org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1362)
            at
    org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:894)
            at
    org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:393)
            at
    org.apache.catalina.session.StandardManager.load(StandardManager.java:320)
            at
    org.apache.catalina.session.StandardManager.start(StandardManager.java:634)
            at
    org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
            at
    org.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:354)
            at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:970)
            at
    org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:249)
            at
    org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
            at
    org.apache.catalina.core.StandardContext.start(StandardContext.java:4020)
            at
    org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
            at
    org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:590)
            at
    org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1106)
            at
    org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
            at
    org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1019)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
            at org.apache.catalina.core.StandardService.start(StandardService.java:450)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Caused by: org.objectstyle.cayenne.ConfigurationException: [v.1.1 December 6
    2004] Load failures. Main configuration class:
    org.objectstyle.cayenne.conf.DefaultConfiguration, details:
            domain.node.name=ProvestaDomainNode, domain.node.datasource=jdbc/PvaDS,
    reason: DataSource load failed - Name jdbc is not bound in this Context
            at
    org.objectstyle.cayenne.conf.RuntimeLoadDelegate.finishedLoading(RuntimeLoadDelegate.java:560)
            at
    org.objectstyle.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:115)
            at
    org.objectstyle.cayenne.conf.DefaultConfiguration.initialize(DefaultConfiguration.java:185)
            at
    org.objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(Configuration.java:296)
            ... 48 more

    Can someone tell me what I am doing wrong?

    Thanks in advance, Laszlo Spoor

    _________________________________________________________________
    Play online games with your friends with MSN Messenger
    http://messenger.msn.nl/



    This archive was generated by hypermail 2.0.0 : Thu Feb 10 2005 - 10:05:13 EST