Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: no jdbc analysis with spring+jdo+postgres?

  1. #1
    Join Date
    Nov 2009
    Posts
    24

    Default no jdbc analysis with spring+jdo+postgres?

    Hi,

    What does spring insight need in order to display the jdbc response times? I can find the transaction / service method calls but I cannot inspect the jdbc times. My app uses spring 3, postgresql and jdo (datanucleus).

    Cheers,

    Jan

  2. #2
    Join Date
    Feb 2008
    Location
    Nashua, NH
    Posts
    78

    Default

    This is a fairly common issue. Odds are the JDBC driver your using is located in the server's lib directory. Try moving it into the webapp's lib directory.

    While running with a JDBC driver inside a WAR is not recommended for a production application, it's ok at development time. We're looking to address this issue in an upcoming release.
    Scott Andrews

    Software Engineer, Web Products Team
    SpringSource

  3. #3
    Join Date
    Nov 2009
    Posts
    24

    Red face

    My maven project has the following dependencies:
    Code:
    > mvn dependency:tree | grep jdbc
    [INFO] |  |  |  |  +-org.springframework:org.springframework.jdbc:jar:3.0.0.RELEASE:compile
    [INFO] |  |  |  +- org.postgis:postgis-jdbc:jar:1.1.5:compile
    [INFO] |  |  |  +- org.postgis:postgis-jdbc-jts:jar:1.4.1komoot:compile
    [INFO] |     |  |  +- org.geotools:gt-jdbc:jar:2.6.0:compile
    [INFO] |     |  +- postgresql:postgresql:jar:8.3-603.jdbc3:compile
    all of them are in the lib dir of MyWebapp

    in webapp-lib, there is:
    Code:
    # ls
    insight-jdbc-1.0.0-SNAPSHOT.jar  insight-springcore-1.0.0-SNAPSHOT.jar  insight-springtx-1.0.0-SNAPSHOT.jar  insight-springweb-1.0.0-SNAPSHOT.jar  spring_insight_collection-1.0.0-SNAPSHOT.jar
    Do you mean that jdbc file? And I should move it to my webapp?

    Cheers,

    Jan

  4. #4
    Join Date
    Nov 2009
    Posts
    24

    Question

    Ok, I have to adjust my previously made observations. Indeed, Spring insight can inspect JDBC calls - but not mine. Only the "startup jdbc calls" made by datanucleus are recorded. Mine, however, are not available. See the attached screenshot.

    EDIT: Link to the image

    Do I need special annotations or how does it work with spring? I use the
    org.springframework.orm.jdo.TransactionAwarePersis tenceManagerFactoryProxy which wraps the org.datanucleus.jdo.JDOPersistenceManagerFactory in case this matters.

    Cheers,

    Jan
    Last edited by jtheuer; Jan 29th, 2010 at 06:12 AM.

  5. #5
    Join Date
    Feb 2008
    Location
    Nashua, NH
    Posts
    78

    Default

    You shouldn't need to do anything special. It's a good sign that you see some of the initial queries, that means Insight is up and running properly and it's able to detect something.

    Just for my own sanity, can you confirm that the DataNucleus and JDBC jars are located in the WAR (ie. WEB-INF/lib)?
    Scott Andrews

    Software Engineer, Web Products Team
    SpringSource

  6. #6
    Join Date
    Nov 2009
    Posts
    24

    Default

    Quote Originally Posted by sandrews View Post
    Just for my own sanity, can you confirm that the DataNucleus and JDBC jars are located in the WAR (ie. WEB-INF/lib)?
    Here it is:
    Code:
    gt-jdbc-2.6.0.jar
    insight-jdbc-1.0.0-SNAPSHOT.jar
    org.springframework.jdbc-3.0.0.RELEASE.jar
    postgis-jdbc-1.1.5.jar
    postgis-jdbc-jts-1.4.1.jar
    postgresql-8.3-603.jdbc3.jar
    How does insight work? I'm nor sure if for example the gt-jdbc-2.6.0.jar should be in the classpath, I don't really need it, it is just one of the "transitive dependencies".
    My jdbc driver "postgresql_jts" is defnetly only in the postgis-jdbc-jts jar.

    Thanks, Jan

  7. #7
    Join Date
    Feb 2008
    Location
    Nashua, NH
    Posts
    78

    Default

    Spring Insight uses AspectJ to weave the classes available inside your WAR to collect metrics about the applications execution. Since only classes inside the WAR are woven, if a class is provided from the server's lib directory or the JRE, it will not be woven.

    For your situation, any class that makes calls to java.sql.Statement or PreparedStatment, need to be located inside the WAR in order for the Insight instrumentation to collect the SQL query.

    You mentioned previously that you are using datanucleus with JDO. I don't see any of the datanucleus JARs in the list you provided.

    In general, if all the dependencies are inside the WAR, everything will pickup automatically.
    Scott Andrews

    Software Engineer, Web Products Team
    SpringSource

  8. #8
    Join Date
    Nov 2009
    Posts
    24

    Default

    Ok, here is the complete list of dependencies. datanucleus-rdbms contains the jdbc commands.
    Code:
    activation-1.1.1.jar                                                                              
    ant-optional-1.5.1.jar                                                                            
    asm-3.1.jar                                                                                       
    cglib-2.2.jar                                                                                     
    common-2.2.1.jar                                                                                  
    commons-beanutils-1.8.0.jar                                                                       
    commons-codec-1.4.jar                                                                             
    commons-collections-3.2.1.jar                                                                     
    commons-dbcp-1.2.2.jar                                                                            
    commons-io-1.4.jar                                                                                
    commons-jxpath-1.2.jar                                                                            
    commons-lang-2.4.jar                                                                              
    commons-logging-1.1.1.jar                                                                         
    commons-math-2.0.jar                                                                              
    commons-pool-1.5.3.jar                                                                            
    com.springsource.org.aopalliance-1.0.0.jar                                                        
    com.springsource.org.apache.commons.fileupload-1.2.1.jar                                          
    com.springsource.org.apache.commons.logging-1.1.1.jar                                             
    datanucleus-core-2.0.0-m4.jar                                                                     
    datanucleus-rdbms-2.0.0-m4.jar                                                                    
    datanucleus-spatial-2.0.0-m4.jar                                                                  
    datanucleus-thirdparty-1.0.1.jar                                                                  
    dozer-5.1.jar                                                                                     
    easymock-2.3.jar                                                                                  
    ecore-2.2.2.jar                                                                                   
    geoapi-2.3-M1.jar                                                                                 
    geoapi-pending-2.3-M1.jar                                                                         
    geronimo-jta_1.1_spec-1.1.jar                                                                     
    gt-api-2.6.0.jar                                                                                  
    gt-coverage-2.6.0.jar                                                                             
    gt-data-2.6.0.jar                                                                                 
    gt-epsg-hsql-2.6.0.jar                                                                            
    gt-geometry-2.6.0.jar                                                                             
    gt-geotiff-2.6.0.jar                                                                              
    gt-gpx-2.5.5.jar                                                                                  
    gt-graph-2.6.0.jar                                                                                
    gt-jdbc-2.6.0.jar                                                                                 
    gt-main-2.6.0.jar                                                                                 
    gt-metadata-2.6.0.jar                                                                             
    gt-postgis-2.6.0.jar                                                                              
    gt-referencing-2.6.0.jar                                                                          
    gt-xml-gpx-2.5.5.jar                                                                              
    gt-xsd-core-2.5.5.jar                                                                             
    hamcrest-core-1.1.jar                                                                             
    hibernate-validator-4.0.2.GA.jar                                                                  
    hsqldb-1.8.0.7.jar                                                                                
    imageio-ext-tiff-1.0.4.jar                                                                        
    imageio-ext-utilities-1.0.4.jar
    insight-jdbc-1.0.0-SNAPSHOT.jar
    jackson-core-asl-1.4.0.jar
    jackson-jaxrs-1.4.0.jar
    jackson-mapper-asl-1.4.0.jar
    jackson-xc-1.4.0.jar
    jai_codec-1.1.3.jar
    jai_core-1.1.3.jar
    jai_imageio-1.1.jar
    jaxb-api-2.1.jar
    jaxb-impl-2.1.3.jar
    jcl-over-slf4j-1.5.7.jar
    jdo2-api-2.3-eb.jar
    jdom-1.0.jar
    joda-time-1.6.jar
    jta-1.1.jar
    jts-1.10.jar
    jtsio-1.7.jar
    junit-dep-4.5.jar
    komoot-test-1.1.jar
    log4j-1.2.14.jar
    mail-1.4.1.jar
    org.springframework.aop-3.0.0.RELEASE.jar
    org.springframework.asm-3.0.0.RELEASE.jar
    org.springframework.beans-3.0.0.RELEASE.jar
    org.springframework.context-3.0.0.RELEASE.jar
    org.springframework.context.support-3.0.0.RELEASE.jar
    org.springframework.core-3.0.0.RELEASE.jar
    org.springframework.expression-3.0.0.RELEASE.jar
    org.springframework.jdbc-3.0.0.RELEASE.jar
    org.springframework.orm-3.0.0.RELEASE.jar
    org.springframework.oxm-3.0.0.RELEASE.jar
    org.springframework.security.config-3.0.0.RELEASE.jar
    org.springframework.security.core-3.0.0.RELEASE.jar
    org.springframework.security.web-3.0.0.RELEASE.jar
    org.springframework.test-3.0.0.RELEASE.jar
    org.springframework.transaction-3.0.0.RELEASE.jar
    org.springframework.web-3.0.0.RELEASE.jar
    org.springframework.web.servlet-3.0.0.RELEASE.jar
    picocontainer-1.2.jar
    postgis-driver-1.0.jar
    postgis-jdbc-1.1.5.jar
    postgis-jdbc-jts-1.4.1komoot.jar
    postgresql-8.3-603.jdbc3.jar
    slf4j-api-1.5.7.jar
    slf4j-log4j12-1.5.7.jar
    transaction-api-1.1.jar
    validation-api-1.0.0.GA.jar
    vecmath-1.3.2.jar
    xercesImpl-2.7.1.jar
    xml-apis-1.0.b2.jar
    xml-apis-xerces-2.7.1.jar
    xsd-2.2.2.jar

  9. #9
    Join Date
    Feb 2008
    Location
    Nashua, NH
    Posts
    78

    Default

    I'm not sure off hand what is going on, this is something we will need to reproduce and investigate further. Would you please open a bug report?
    https://issuetracker.springsource.com/browse/INSIGHT
    Scott Andrews

    Software Engineer, Web Products Team
    SpringSource

  10. #10
    Join Date
    Feb 2005
    Posts
    13

    Thumbs up JDBC Analysis with JDBC Driver located in servers lib directory

    Quote Originally Posted by sandrews View Post
    This is a fairly common issue. Odds are the JDBC driver your using is located in the server's lib directory. Try moving it into the webapp's lib directory.

    While running with a JDBC driver inside a WAR is not recommended for a production application, it's ok at development time. We're looking to address this issue in an upcoming release.
    Hello,
    would be great if it will be possible to use JDBC driver located in the server's lib directory. Because I canīt use JNDI lookup when moving the JDBC driver to the webapp's lib directory and have to provide a different dataSource config in Spring-ApplicationContext.

    Is there a roadmap when you plan to provide this feature?

    Best reagards
    Saemmy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •