Announcement Announcement Module
Collapse
No announcement yet.
First impressions & JNDI query Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • First impressions & JNDI query

    Congratulations on reaching public beta stage. First impressions are very favourable.

    To put the following comments in context I've only tried tcServer on my local (Windows) dev box so far and am in the process of attempting to replicate the functionality I have with some Tomcat 6.0.18 instances behind an Apache httpd server configured for sticky session handling. I used the "Spring Source" directory structure since this seems identical to what I have on my previous Tomcat instances (the single binaries with separate instances).

    I downloaded JDK 1.6.0_13 for the purpose of running tcServer and followed the "Getting Started" guide. It seems that a "server" version of the JRE is required (this is not the default on installation) to start each tcServer Windows service but I don't think this is mentioned in the guide. For expediency I simply copied the "client" directory of my installed JDK to a "server" directory - assuredly not the correct approach but I was keen to get on with getting tcServer up and running.

    I'm not quite sure what the process of creating data sources in the AMS Server GUI actually does behind the scenes. I guess I was expecting some new <Resource> elements to appear in the context.xml files of my tcServer instances as I have in my previous Tomcat instances. However, "pushing" the changes from the GUI out to the instance did not have this effect and my app refused to run due to being unable to find its data sources. Manually copying those tags to context.xml (and putting the ubiquitous classes12.zip into the lib directory to provide me with an Oracle data source) does the trick. I suspect this is not the right way but it works for now. Am I missing something?

    As a bit of an aside the default port used for the AMS Agent (2144) seems to be used by iTunes on Windows - not an issue for most servers but might delay people slightly on local dev machines

    Overall I'm very impressed so far.

    Cheers,
    Simon

  • #2
    Simon,
    Thanks for the input! Regarding the data sources, they are configured on a global level, so you should see them written to GlobalNamingResources in server.xml. You can link them to your web applications by adding a <ResourceLink> to the appropriate context. See http://tomcat.apache.org/tomcat-6.0-...resources.html for more information. We'll look into making that more intuitive.

    We are looking into automatic provisioning of the various database drivers in a future release (so you won't have to manually copy over classes12.zip!)

    Thanks,
    Jennifer

    Comment


    • #3
      Hi Jennifer,

      Thanks for your reply. I must be mis-configuring something somewhere because when I create a new Data Source (either DBCP or "high concurrency") via the GUI it does write it as a <Resource> within the <GlobalNamingResources> in server.xml but I get a runtime naming exception.

      For example, if I create a "high concurrency" data source named "jdbc/myds" and then push it to the server configuration I get an element of the following form in server.xml:

      <Resource accessToUnderlyingConnectionAllowed="false"
      defaultAutoCommit="false"
      defaultReadOnly="true"
      driverClassName="oracle.jdbc.driver.OracleDriver"
      factory="org.apache.tomcat.dbcp.dbcp.BasicDataSour ceFactory"
      initialSize="10"
      logAbandoned="false"
      maxActive="100"
      maxIdle="10"
      maxOpenPreparedStatements="0"
      maxWait="10000"
      minEvictableIdleTimeMillis="10000"
      minIdle="10"
      name="jdbc/myds"
      numTestsPerEvictionRun="3"
      password="my_schema_password"
      poolPreparedStatements="false"
      removeAbandoned="false"
      removeAbandonedTimeout="60"
      testOnBorrow="true"
      testOnReturn="false"
      testWhileIdle="false"
      timeBetweenEvictionRunsMillis="10000"
      type="javax.sql.DataSource"
      url="jdbc:oracle:thin:@my_db:1521:my_instance"
      username="my_schema_name"
      validationQuery="select 1 from dual"/>

      My application configures this data source in the following manner:

      <bean id="myDataSource"
      class="org.springframework.jndi.JndiObjectFactoryB ean">
      <property name="jndiName">
      <value>jdbc/myds</value>
      </property>
      <property name="resourceRef">
      <value>true</value>
      </property>
      </bean>

      At runtime I get a runtime exception that boils down to:

      Caused by: javax.naming.NameNotFoundException: Name myds is not bound in this Context

      It appears I have some mis-configuration around the "jdbc/" prefix part of the name.

      Alternatively, if I manually add a similar data source as a <Resource> within the <Context> in context.xml things work fine.

      Would you have any pointers as to where I might be going wrong?

      Thanks,
      Simon

      Comment


      • #4
        Did you try adding the following line to your context.xml?
        Code:
        <ResourceLink global="jdbc/myds" name="jdbc/myds"/>
        Jennifer

        Comment


        • #5
          That did the trick thanks. Is it expected that pushing GUI updates out will include this context.xml update in the future or is this question showing my inexperience with Tomcat?

          It took me some time to investigate because the Windows wrapper service refused to start the instance. The only related log message I could see was in wrapper.log but it didn't provide any explanation. After some attempts to resurrect it I found it necessary to remove and recreate the instance. Is there some other logging I should check when the Windows service refuses to start an instance?

          Comment

          Working...
          X