Announcement Announcement Module
No announcement yet.
Getting JDBC performance and HTTP endpoint data with Spring Insight? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting JDBC performance and HTTP endpoint data with Spring Insight?

    We have a fairly large application, and I thought I'd try running it under Spring Insight. I have it setup, running from within eclipse, and things are pretty nice, but I notice that I have no JDBC data and no HTTP enpoint data for my application.

    I moved my datasource declaration from the app's context.xml into the server's <GlobalNamingResources>. I've added parameters to match the example on, including in particular the jdbcInterceptors.

    The application continues to work, queries the database through hibernate, etc. But I still have no statements listed on any of the traces.

    As for the HTTP enpoints, I don't even know where to start investigating. Any suggestions?

    Thank you

  • #2
    If you have jars for the JDBC driver outside the application, Spring Insight won't collect data for it. We might extend this in future, but currently the JDBC drivers must reside in webapps/<app>/lib directory and you application must use those jars.

    I am not sure why HTTP endpoints don't work for you, though. Can you provide more details on your configuration?



    • #3
      Thank you for your quick reply. I am trying putting the jars in there now, and I'll give you a bit more details tomorrow (it's quitting time here


      • #4
        I can see app traces fine in the recent activity view, but I can't see any HTTP endpoint activity either in the application health view.

        Our app is Spring 2.5.x and running as the ROOT context in tomcat.


        • #5
          I moved the jdbc drivers (mysql) to .../webapps/myapp/WEB-INF/lib (which I think is what you were suggesting) but that means the classes aren't found in the <GlobalNamingResources> section. I moved the resource definition back to the application's context.xml. That still didn't work (ClassNotFound for com.mysql.jdbc.Driver)

          I moved the jar to <tomcat root>/lib/ and the driver class is found. But I still get no JDBC data in the traces (whether the resource is defined in the <GlobalNamingResources> or in the context.xml).

          As for the HTTP endpoints, my application is very large, so I thought I'd try something simpler. I used the springtravel application (through the STS tutorials). With the application as-is from the tutorial, I get endpoints. I noticed that the application uses annotations to map requests (and parameters) to method calls. We do not use annotations. I changed the sample code to use bean-driven configuration, with a handler mapping. No more endpoints.

          So, am I right in assuming to be listed in the "Application Health", endpoints must be configured through annotations?

          I also noticed that in the traces, some methods are listed and their execution time is listed, but some aren't. For a number of calls, I have the total run time, the time for Spring Web Dispatch, the time spent in FileValidator#validate (our class/code), and the time to Resolve View and Render View. Is there something I can do to show how long, say, calls to the DAO took?

          More on our project: we do not use annotations at all. Beans are spread out in a number of files, many of which in dependent ("utility") projects. Some of the bean files are outside the application's area. We use hibernate to access a mysql db. We also have solr running in a different webapp, and make requests from it. The application also uses GWT (with rpc).

          I'll see if I can get JDBC data with a simpler setup


          • #6

            Can you file a bug. We have so far focused on webapps at non-root context and ROOT context may be something we need to handle.




            • #7

              Spring Insight's instrumentation works off of annotations for the web part (Controllers, mainly). Other parts such as JDBC, transaction management, and top-level HTTP requests work without any consideration for annotations.

              Every call should show time taken. Can you post a screenshot of what you see. This way, we can notice a bug, if any.

              Also, please add to JIRA any issues you face, any suggestion for improvements etc.




              • #8
                Hey Guys,

                Confirming the "not seeing SQL performance break down / tracing", in fact nothing SQLish at all, just HTTP trace and details.

                Have Oracle JDBC driver JAR in "WEB-INF/lib" + put it under "tc-server-6.0.20.C/lib".

                I would create a JIRA, but looking at the project list ( not sure where to create it. Let me know where, and I will.


                • #9
                  ok, found the JIRA ( took a google search )

                  created the first JIRA in Spring Insight history:


                  • #10


                    • #11
                      More information, which may help or muddle things even further. I started with the petclinic application, enabled mysql, and got it running using an entry in servlet.xml: <Context docBase="path/to/petclinic/war" .../> and it looks just fine (jdbc calls in the trace, etc, and all the HTTP enpoints). But it looks like the file war/META-INF/context.xml isn't read (typos/errors in the file go unnoticed).

                      Then I copied all in the war directory to the catalina base (the tc Server instance), using eclipse's deployment mechanism. Now I get only the top level (ex: GET /petclinic/ But I know the context.xml file is read, because a typos/errors show up as errors in the logs.

                      I inserted a breakpoint at ClinicController#vetsHandler() and compared the stack traces (thinking maybe the valves were setup differently, but the two stacks looked the same.


                      • #12
                        Originally posted by sneakybeaky View Post
                        I can see app traces fine in the recent activity view, but I can't see any HTTP endpoint activity either in the application health view.

                        Our app is Spring 2.5.x and running as the ROOT context in tomcat.
                        I see the same issue, however I'm not deploying on root. I am using a context path to deploy it. I just raised
                        Last edited by rahulsom; Nov 4th, 2009, 03:33 PM. Reason: Added ticket info


                        • #13
                          I have a similar issue with an application I am trying to analyze using Insight. I deployed the application by copying the .war file in the webapps directory (i.e. it is not running in the ROOT context).

                          First of all, using the default configuration (which works fine on regular (non-Spring) Tomcat), the application won't start at all, and I get a lengthy Exception stack trace in my applications log file that the "myDataSource" bean could not be instanciated. The root cause is a javax.naming.NamingException with no error message.

                          The "myDataSource" bean is configured as follows:
                              <bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
                                  <property name="jndiName">
                          By default, the application provides the configuration for the resource in its META-INF/context.xml file. I tried moving the resource definition into the tc server's server.xml file under <GlobalNamingResources>, but I still get the same error.

                          So I changed the data source definition to skip JNDI and configure it directly in my Spring configuration, like so:
                              <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
                                  <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
                                  <property name="url" value="jdbc:mysql://localhost:3306/mydatabase"/>
                                  <property name="username" value="xxxxxxx"/>
                                  <property name="password" value="xxxxxxx"/>
                          Now I can run the application on tc server and it shows up in Insight as well, but the traces contain nothing but information about the HTTP requests made (no call tracing, and no SQL tracing either, just like the OP). Also, under "Application Health", there are no endpoints listed.

                          I tried moving the MySQL JDBC driver into the webapp/lib directory, but it doesn't change anything. Still no SQL trace information available.

                          I'm using mysql-connector-java-5.0.7-bin.jar, the application is built using Spring 2.5 and Hibernate 3.0 (through JPA).


                          • #14
                            I'm going to resurrect this thread. Litius, did you try putting the driver _only_ in WEB-INF/lib? That is the recommended fix. If you put it in both the WEB-INF/lib and the server/lib I don't believe it will take the latter.


                            • #15

                              Yeap, that is the first thing I tried (having the only jar in WEB-INF/lib).