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

Thread: PerformanceMonitorInceptor

  1. #1
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default PerformanceMonitorInceptor

    i want to monitor different implementations of the same interface.
    using the PerformanceMonitorInterceptor i am getting"only" the name of Interface logged.
    Is it in any way possible to get the name of the implementing class?

    best thanx for any advice.
    Christoph

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Christoph,

    Can you post the configuration you are using to define the monitored proxies along with snippets of code for the objects being proxied.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default

    Rob,

    here a snippet from my configuration:

    Code:
    <bean id="rabattDao" class="com.apgsga.vk.preisermittlung.db.RabattDaoImpl">
    		<property name="dataSource">
    			<ref local="dataSource"/>
    		</property>
    	</bean>
    	<bean id="monitoredrabattDao" 
    		class="org.springframework.aop.framework.ProxyFactoryBean">
    		<property name="proxyInterfaces">
    			 <value>com.apgsga.vk.preisermittlung.db.ContextLoadingDao</value>
    		</property>
    		<property name="target">
    			<ref local="rabattDao"/>
    		</property>
    		<property name="interceptorNames">
    			<list>
    				<value>performanceMontitor</value>
    			</list>
    		</property>
    	</bean>
    and the performance monitor:
    Code:
    	<bean id="performanceMontitor" 
    		class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor">
    	</bean>
    I have different Dao's like the one above (rabattDao) all implementing the same Interface.
    My problem is that the name, which is logged is for all the same: the interface they implement.
    I would actually like to see the class name of the target.

    Christoph

  4. #4
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Christoph,

    Try setting the 'proxyTargetClass' property of ProxyFactoryBean to true.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  5. #5
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default

    Hi Rob,

    somehow the bean's don't load after setting the proxyTargetClass in the ProxyFactoryBean to true.

    I get the following exception stack:

    Code:
     &#91;junit&#93; 1&#41; testService&#40;com.apgsga.vk.preisermittlung.service.BatchServiceInterfaceImplTests&#41;org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'monitoredrabattDao' defined in class path resource &#91;batchtestbeans.xml&#93;&#58; Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException&#58; null
        &#91;junit&#93; java.lang.IllegalStateException&#58; Callback Lnet/sf/cglib/proxy/MethodInterceptor; is not assignable to Lnet/sf/cglib/proxy/MethodInterceptor;
        &#91;junit&#93; at net.sf.cglib.proxy.Enhancer.validate&#40;Enhancer.java&#58;374&#41;
        &#91;junit&#93; at net.sf.cglib.proxy.Enhancer.createHelper&#40;Enhancer.java&#58;399&#41;
        &#91;junit&#93; at net.sf.cglib.proxy.Enhancer.create&#40;Enhancer.java&#58;318&#41;
        &#91;junit&#93; at org.springframework.aop.framework.Cglib2AopProxy.getProxy&#40;Cglib2AopProxy.java&#58;194&#41;
        &#91;junit&#93; at org.springframework.aop.framework.Cglib2AopProxy.getProxy&#40;Cglib2AopProxy.java&#58;150&#41;
        &#91;junit&#93; at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance&#40;ProxyFactoryBean.java&#58;256&#41;
        &#91;junit&#93; at org.springframework.aop.framework.ProxyFactoryBean.setBeanFactory&#40;ProxyFactoryBean.java&#58;220&#41;
        &#91;junit&#93; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;349&#41;
        &#91;junit&#93; at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;223&#41;
        &#91;junit&#93; at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
        &#91;junit&#93; at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;271&#41;
        &#91;junit&#93; at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;312&#41;
        &#91;junit&#93; at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;80&#41;
        &#91;junit&#93; at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;65&#41;
        &#91;junit&#93; at org.springframework.test.AbstractSpringContextTests.loadContextLocations&#40;AbstractSpringContextTests.java&#58;113&#41;
        &#91;junit&#93; at org.springframework.test.AbstractDependencyInjectionSpringContextTests.loadContextLocations&#40;AbstractDependencyInjectionSpringContextTests.java&#58;147&#41;
        &#91;junit&#93; at org.springframework.test.AbstractSpringContextTests.getContext&#40;AbstractSpringContextTests.java&#58;95&#41;
        &#91;junit&#93; at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp&#40;AbstractDependencyInjectionSpringContextTests.java&#58;114&#41;
    Probably did something wrong?
    Code:
    	<bean id="monitoredlokalDispoPositionenDao" 
    		class="org.springframework.aop.framework.ProxyFactoryBean">
    		<property name="proxyInterfaces">
    			<value>com.apgsga.vk.preisermittlung.db.LokalDispoDao</value>
    		</property>
    		<property name="target">
    			<ref local="lokalDispoPositionenDao"/>
    		</property>
    		<property name="proxyTargetClass">
    			<value>true</value>
    		</property>
    		<property name="interceptorNames">
    			<list>
    				<value>performanceMontitor</value>
    			</list>
    		</property>
    	</bean>

  6. #6
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Ah, you need to upgrade the version of CGLIB you are using. I've seen that particular error in an older version of CGLIB (can't remember which one exactly). Try using the CGLIB jar pacakged with the latest Spring release.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  7. #7
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default

    I updated the cglib to the newest version. That got me further.
    But now i get a null pointer exception on the jdbcTemplate for the second invocation of a dao:

    Code:
        &#91;junit&#93; .com.apgsga.common.utils.PerformanceMonitor - com.apgsga.vk.preisermittlung.db.KdvtSelektionDaoImpl.load &#58; 0&#58;00&#58;09.994
        &#91;junit&#93; com.apgsga.common.utils.PerformanceMonitor - com.apgsga.vk.preisermittlung.db.KdvtSelektionDaoImpl.load &#58; 0&#58;00&#58;09.994
        &#91;junit&#93; jdbcTemplate&#58; null
        &#91;junit&#93; com.apgsga.common.utils.PerformanceMonitor - com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.createQuery &#58; 0&#58;00&#58;00.000
        &#91;junit&#93; com.apgsga.common.utils.PerformanceMonitor - com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.createQuery &#58; 0&#58;00&#58;00.000
        &#91;junit&#93; com.apgsga.common.utils.PerformanceMonitor - com.apgsga.vk.preisermittlung.db.AbstractContextCreatingQueryDaoImpl.getParameterValueMap &#58; 0&#58;00&#58;00.000
        &#91;junit&#93; com.apgsga.common.utils.PerformanceMonitor - com.apgsga.vk.preisermittlung.db.AbstractContextCreatingQueryDaoImpl.getParameterValueMap &#58; 0&#58;00&#58;00.000
        &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - Severe Error&#58; java.lang.NullPointerException
        &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - Stacktrace&#58;
    I have tried different DataSource implementations:
    Code:
    	<bean id="dataSource" 
    		class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName">
    			<value>oracle.jdbc.OracleDriver</value>
    		</property>
    		<property name="url">
    			<value>jdbc&#58;oracle&#58;thin&#58;@testserver&#58;1521&#58;test1</value>
    		</property>
    		<property name="password">
    			<value>xxxxx</value>
    		</property>
    		<property name="username">
    			<value>vk</value>
    		</property>
    	</bean>
    All fail. I am not sure, if the problem is restricted to the JdbcTemplate.
    I am still debugging, but maybe you saw already something similiar?

  8. #8
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default

    Additional information to above:
    I construct the JdbcTemplate with the datasource property the afterPropertiesSet Method of a Dao Bean and store it locally.
    When i retrieve the JdbcTemplate in the proxied Dao via getter Method it is null. Without the proxy it works fine?

  9. #9
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Can you show the full stack trace and the test code?

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  10. #10
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default

    Great thanx Rob for your help.
    The log4j console output of the junit run, with debug enabled is quite extensive (1386).
    Shall i post it?

    Christoph

Posting Permissions

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