Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

getting started

Colin
2012-07-13
2013-05-20
  • Colin
    Colin
    2012-07-13

    hello,

    I've used Jamon in the past with very positive results. That was a long time ago and now on a new project I would like to use this great tool again and monitor specifically the total time for HTTP requests and the time it is taking for specific SQL queries.

    I donwloaded 2.7.3 and installed following these steps:

    Tomcat 6
            Put jamon-2.7.jar (or higher) in the tomcat 'lib' directory.
            Put jamon.war (or higher) in the tomcat 'webapps' directory.
            Add the following Valve line to Tomcat's server.xml file. The 'Engine' line is used to show context.
                <Engine name="Catalina" defaultHost="localhost">
                <Valve className="com.jamonapi.http.JAMonTomcatValve"/>

    I then added the following to the web.xml of the application I want to monitor
    <filter>
        <filter-name>JAMonFilter</filter-name>
        <filter-class>com.jamonapi.JAMonFilter</filter-class>
       </filter>

       <filter-mapping>
        <filter-name>JAMonFilter</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
    <filter>

    I am using spring and ibatis to access the DB so I configured the settings as follows (but I don't think it's correct)

    jdbc.driver=jdbc:jamon:oracle
    jdbc.url=jdbc:oracle:thin:@localhost:1521:XE

    When I access the Jamon pages I don't see any results for the SQL statements
    And I thought it was possible to view a breakdown of an http request to see where most time was being spent??

    Any tips on the sql stuff most welcome!

    thx

    Colin

     
  • Steve Souza
    Steve Souza
    2012-07-13

    1) valves do the same thing as a servlet fitler but for the whole tomcat server.  you don't need both.  get rid of the servlet filter stuff in web.xml
    2) your jdbc driver and url stuff is incorrect.
    jdbc.driver=com.jamonapi.proxy.JAMonDriver
    jdbc.url=jdbc:jamon:oracle:thin:@localhost:1521:XEjamonrealdriver=oracle.jdbc.OracleDriver
    3) If this doesn't work, but you aren't getting exceptions make sure you don't have multiple jamon jars on your server.  for example in your web-inf/lib directory.  just keep the one at the server level.

    Note you are seeing correctly there is no space between XE and jamonrealdriver.

     
  • Colin
    Colin
    2012-07-16

    hi,

    Thx for the reply!
    I followed your steps and in terms of the HTTP requests that is beginning to look better.
    However I'm getting an exception on startup due to the Database URL no longer being valid :-(
    It doesn't seem to like the stuff after XE.

    For clarity - there were two jar files, one called jamontomcat and one called jamon. I thought the tomcat one was for an earlier version of tomcat (than version 6 that I use). Is that correct or should I be using THAT version in the tomcat/lib directory?

     
  • Steve Souza
    Steve Souza
    2012-07-16

    1) Paste your database url and driver as you set it in your code into your response and I will look at it.  Also try it in a standalone app that just does a simple db query and see if that works. 
    2) Tomcat 6 doesn't require anything but the standard jamon jar (doesn't require jamontomcat*.jar)

     
  • Colin
    Colin
    2012-07-16

    Below are the settings in the propertiesfile
    jdbc.driver=com.jamonapi.proxy.JAMonDriver
    jdbc.url=jdbc:jamon:oracle:thin:@localhost:1521:XE?jamonrealdriver=oracle.jdbc.OracleDriver

    Which are then passed onto the spring config file
        <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
            <property name="URL" value="${jdbc.url}" />
            <property name="user" value="${jdbc.user}"/>
            <property name="driverType" value="${jdbc.driver}"/>
            <property name="password" value="${jdbc.password}"/>
            <property name="connectionCachingEnabled" value="true" />
            <property name="connectionCacheProperties">
                <props merge="default">
                    <prop key="MinLimit">20</prop>
                    <prop key="MaxLimit">100</prop>
                    <prop key="AbandonedConnectionTimeout">10</prop>
                </props>
            </property>
        </bean>

     
  • Steve Souza
    Steve Souza
    2012-07-16

    Not sure if oracle accepts the question mark you put in your jdbc url. 

    jdbc.url=jdbc:jamon:oracle:thin:@localhost:1521:XE?jamonrealdriver=oracle.jdbc.OracleDriver

    jamon simply strips all references to jamon and passes it to oracle.  oracle gets

    jdbc.url=jdbc:jracle:thin:@localhost:1521:XE?

    oracle would have to think that trailing question mark without anything that follows is valid syntax.  i would hope it would, but i have found some db's don't like it.

    Use the one I pasted in my original answer. 
    jdbc.url=jdbc:jamon:oracle:thin:@localhost:1521:XEjamonrealdriver=oracle.jdbc.OracleDriver

    when stripped it becomes
    jdbc.url=jdbc:oracle:thin:@localhost:1521:XE

     
  • Colin
    Colin
    2012-07-16

    you're right with the comment regarding the ?
    It was one of the options I was testing after reading another post but understand it is now not needed.

    I copied the url as below
    jdbc.driver=com.jamonapi.proxy.JAMonDriver
    jdbc.url=jdbc:jamon:oracle:thin:@localhost:1521:XEjamonrealdriver=oracle.jdbc.OracleDriver

    But still the same result as in the URL is incorrect :-(

    I have also looked if I have double jars in the classpath but this doesn't seem to be the case

     
  • Steve Souza
    Steve Souza
    2012-07-16

    1) Try it in a standalone application that does a simple connect and query and see if it works.
    2) Does the exception get thrown by oracle.jdbc.pool.OracleDataSource?  If so, it may check to see if the driver is an oracle driver and never let jamon due its work?  If this is the case  you can also monitor the returned connections with jamon directly.

     
  • Shaine Gordon
    Shaine Gordon
    2012-08-04

    I had the same problem

    not jamon.jar in my webapp or jamon.war, only in my tomcat lib folder (confirmed this as I would get class not found "com.jamonapi.proxy.JAMonDriver" if I removed it)

    my webapp would startup with "Can not load real driver (oracle.jdbc.OracleDriver) from JAMonDriver: oracle.jdbc.OracleDriver"

    the only way I could fix it was to copy my ojdbc jar from my webapp into the tomcat lib folder