Announcement Announcement Module
Collapse
No announcement yet.
PerformanceMonitorInceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment


      • #4
        Christoph,

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

        Rob

        Comment


        • #5
          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>

          Comment


          • #6
            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

            Comment


            • #7
              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?

              Comment


              • #8
                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?

                Comment


                • #9
                  Can you show the full stack trace and the test code?

                  Rob

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      Just need the few lines that show the NullPointerException - say 10 lines.

                      Rob

                      Comment


                      • #12
                        The stack trace:

                        Code:
                            &#91;junit&#93; org.springframework.jdbc.datasource.DataSourceTransactionManager - Using transaction object &#91;org.springframework.jdbc.datasource.DataSourceTransactionManager$DataSourceTransactionObject@147358f&#93;
                            &#91;junit&#93; org.springframework.jdbc.datasource.DataSourceTransactionManager - Creating new transaction with name &#91;null&#93;
                            &#91;junit&#93; org.springframework.jdbc.datasource.DataSourceTransactionManager - Acquired Connection &#91;org.apache.commons.dbcp.PoolableConnection@12c8fa8&#93; for JDBC transaction
                            &#91;junit&#93; org.springframework.jdbc.datasource.DataSourceTransactionManager - Switching JDBC Connection &#91;org.apache.commons.dbcp.PoolableConnection@12c8fa8&#93; to manual commit
                            &#91;junit&#93; org.springframework.transaction.support.TransactionSynchronizationManager - Bound value &#91;org.springframework.jdbc.datasource.ConnectionHolder@d5eb7&#93; for key &#91;org.apache.commons.dbcp.BasicDataSource@d6a05e&#93; to thread &#91;main&#93;
                            &#91;junit&#93; org.springframework.transaction.support.TransactionSynchronizationManager - Initializing transaction synchronization
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl$$EnhancerByCGLIB$$a73652c7 - getJdbcTemplate&#40;&#41; &#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.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl - Invoking dummy get getParameterValueMap with &#58; com.apgsga.vk.preisermittlung.db.LoaderContext@4a7df6, parameter&#58; <sprachid> &#58; 1, <mitAnnullationen> &#58; false, <annullationenAb> &#58; null, <nurAktVertragsAbschnitte> &#58; false, <nurPositiverFeedback> &#58; false, <mitOptionen> &#58; false, <pseudoBuchnungen> &#58; false, <flaechenseltyp> &#58; com.apgsga.vk.preisermittlung.service.FlaechenSelektionsTyp@3, code&#58; 3, type&#58; Faktura, <kdvtId&#40;s&#41;> &#58; 15, 4, 16, 205664, 18, 3, 102864, 12, 102967, 205660, 17, 2, 13, 102968, 6, 308746, 14, 102965, 10, 308655
                            &#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;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - com.apgsga.vk.preisermittlung.db.AbstractDaoImpl$QueryByIdsWithINClause.execute&#40;AbstractDaoImpl.java&#58;335&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - com.apgsga.vk.preisermittlung.db.AbstractContextCreatingQueryDaoImpl.load&#40;AbstractContextCreatingQueryDaoImpl.java&#58;73&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - com.apgsga.vk.preisermittlung.db.LoaderImpl.loadZentralDispo&#40;LoaderImpl.java&#58;60&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - com.apgsga.vk.preisermittlung.db.LoaderImpl.load&#40;LoaderImpl.java&#58;51&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl.berechne&#40;BatchingServiceInterfaceImpl.java&#58;153&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - com.apgsga.vk.preisermittlung.service.BatchServiceInterfaceImplTests.testService&#40;BatchServiceInterfaceImplTests.java&#58;49&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - sun.reflect.NativeMethodAccessorImpl.invoke&#40;Unknown Source&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;Unknown Source&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - java.lang.reflect.Method.invoke&#40;Unknown Source&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestCase.runTest&#40;TestCase.java&#58;154&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestCase.runBare&#40;TestCase.java&#58;127&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestResult$1.protect&#40;TestResult.java&#58;106&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestResult.runProtected&#40;TestResult.java&#58;124&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestResult.run&#40;TestResult.java&#58;109&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestCase.run&#40;TestCase.java&#58;118&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestSuite.runTest&#40;TestSuite.java&#58;208&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestSuite.run&#40;TestSuite.java&#58;203&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestSuite.runTest&#40;TestSuite.java&#58;208&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.framework.TestSuite.run&#40;TestSuite.java&#58;203&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.textui.TestRunner.doRun&#40;TestRunner.java&#58;116&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.textui.TestRunner.start&#40;TestRunner.java&#58;172&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - junit.textui.TestRunner.main&#40;TestRunner.java&#58;138&#41;
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.service.BatchingServiceInterfaceImpl - Stacktrace finished.
                        Here the Bean and Proxy configuration:

                        Code:
                          &#91;junit&#93; org.springframework.beans.CachedIntrospectionResults - Getting BeanInfo for class &#91;com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl&#93;
                            &#91;junit&#93; org.springframework.beans.CachedIntrospectionResults - Caching PropertyDescriptors for class &#91;com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl&#93;
                            &#91;junit&#93; org.springframework.beans.CachedIntrospectionResults - Found property 'class' of type &#91;java.lang.Class&#93;
                            &#91;junit&#93; org.springframework.beans.CachedIntrospectionResults - Found property 'dataSource' of type &#91;javax.sql.DataSource&#93;
                            &#91;junit&#93; org.springframework.beans.CachedIntrospectionResults - Class &#91;com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl&#93; is cache-safe
                            &#91;junit&#93; org.springframework.beans.factory.support.BeanDefinitionValueResolver - Resolving reference from property 'dataSource' in bean 'auftraegeAgpsFlDao' to bean 'dataSource'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'dataSource'
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - About to invoke write method &#91;public final void com.apgsga.vk.preisermittlung.db.AbstractDaoImpl.setDataSource&#40;javax.sql.DataSource&#41;&#93; on object of class &#91;com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Invoked write method &#91;public final void com.apgsga.vk.preisermittlung.db.AbstractDaoImpl.setDataSource&#40;javax.sql.DataSource&#41;&#93; with value of type &#91;javax.sql.DataSource&#93;
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking BeanPostProcessors before initialization of bean 'auftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking afterPropertiesSet&#40;&#41; on bean with name 'auftraegeAgpsFlDao'
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl - datasource in afterProperties set&#58; org.apache.commons.dbcp.BasicDataSource@d6a05e
                            &#91;junit&#93; com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl - jdbcTemplate in afterProperties set&#58; org.springframework.jdbc.core.JdbcTemplate@193c0cf
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking BeanPostProcessors after initialization of bean 'auftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'monitoredauftraegeAgpsFlDao' with merged definition &#91;Root bean with class &#91;org.springframework.aop.framework.ProxyFactoryBean&#93; defined in class path resource &#91;batchtestbeans.xml&#93;&#93;
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking BeanPostProcessors before instantiation of bean 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.core.CollectionFactory - Creating java.util.IdentityHashMap
                            &#91;junit&#93; org.springframework.beans.CachedIntrospectionResults - Using cached introspection results for class &#91;org.springframework.aop.framework.ProxyFactoryBean&#93;
                            &#91;junit&#93; org.springframework.beans.factory.support.BeanDefinitionValueResolver - Resolving reference from property 'target' in bean 'monitoredauftraegeAgpsFlDao' to bean 'auftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.core.CollectionFactory - Creating java.util.LinkedHashSet
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'auftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Converting String to &#91;class &#91;Ljava.lang.String;&#93; using property editor &#91;org.springframework.beans.propertyeditors.StringArrayPropertyEditor@1576e70&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - About to invoke write method &#91;public void org.springframework.aop.framework.ProxyFactoryBean.setProxyInterfaces&#40;java.lang.String&#91;&#93;&#41; throws java.lang.ClassNotFoundException&#93; on object of class &#91;org.springframework.aop.framework.ProxyFactoryBean&#93;
                            &#91;junit&#93; org.springframework.aop.framework.ProxyFactoryBean - Added new aspect interface&#58; com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDao
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Invoked write method &#91;public void org.springframework.aop.framework.ProxyFactoryBean.setProxyInterfaces&#40;java.lang.String&#91;&#93;&#41; throws java.lang.ClassNotFoundException&#93; with value of type &#91;&#91;Ljava.lang.String;&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - About to invoke write method &#91;public void org.springframework.aop.framework.AdvisedSupport.setTarget&#40;java.lang.Object&#41;&#93; on object of class &#91;org.springframework.aop.framework.ProxyFactoryBean&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Invoked write method &#91;public void org.springframework.aop.framework.AdvisedSupport.setTarget&#40;java.lang.Object&#41;&#93; with value of type &#91;java.lang.Object&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Converting String to &#91;boolean&#93; using property editor &#91;[email protected]81e7&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - About to invoke write method &#91;public void org.springframework.aop.framework.ProxyConfig.setProxyTargetClass&#40;boolean&#41;&#93; on object of class &#91;org.springframework.aop.framework.ProxyFactoryBean&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Invoked write method &#91;public void org.springframework.aop.framework.ProxyConfig.setProxyTargetClass&#40;boolean&#41;&#93; with value of type &#91;boolean&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - About to invoke write method &#91;public void org.springframework.aop.framework.ProxyFactoryBean.setInterceptorNames&#40;java.lang.String&#91;&#93;&#41;&#93; on object of class &#91;org.springframework.aop.framework.ProxyFactoryBean&#93;
                            &#91;junit&#93; org.springframework.beans.BeanWrapperImpl - Invoked write method &#91;public void org.springframework.aop.framework.ProxyFactoryBean.setInterceptorNames&#40;java.lang.String&#91;&#93;&#41;&#93; with value of type &#91;&#91;Ljava.lang.String;&#93;
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking setBeanFactory on BeanFactoryAware bean 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.aop.framework.ProxyFactoryBean - Configuring advisor or advice 'performanceMontitor'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'performanceMontitor'
                            &#91;junit&#93; org.springframework.aop.framework.ProxyFactoryBean - Adding advisor or TargetSource &#91;com.apgsga.common.utils.PerformanceMonitor@7f4ec&#93; with name &#91;performanceMontitor&#93;
                            &#91;junit&#93; org.springframework.aop.framework.ProxyFactoryBean - Adding advisor with name &#91;performanceMontitor&#93;
                            &#91;junit&#93; org.springframework.aop.framework.ProxyFactoryBean - Not refreshing target&#58; bean name not specified in interceptorNames
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Creating CGLIB2 proxy for &#91;com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl&#93;
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public com.apgsga.vk.preisermittlung.db.AbstractDaoImpl$AbstractQuery com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.createQuery&#40;org.springframework.jdbc.core.JdbcTemplate,com.apgsga.vk.preisermittlung.db.LoaderContext&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateSqlBlockFromParameter&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateSqlBlockForAg&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateAnnullationsBlkFuerAg&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateSqlBlockForAgps&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateAnnullationsBlkFuerAgps&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateSqlBlockForFlzo&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public void com.apgsga.vk.preisermittlung.db.KdvtAgAgpsFlDaoImpl.generateAnnullationsBlkFuerFlzo&#40;com.apgsga.vk.preisermittlung.db.LoaderContext,java.lang.StringBuffer&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public java.util.Map com.apgsga.vk.preisermittlung.db.AbstractContextCreatingQueryDaoImpl.getParameterValueMap&#40;com.apgsga.vk.preisermittlung.db.LoaderContext&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public native int java.lang.Object.hashCode&#40;&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Found equals&#40;&#41; method - using INVOKE_EQUALS
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Unable to apply any optimisations to advised method public java.lang.String java.lang.Object.toString&#40;&#41; - using AOP_PROXY
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract int org.springframework.aop.framework.Advised.indexOf&#40;org.springframework.aop.Advisor&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract org.springframework.aop.TargetSource org.springframework.aop.framework.Advised.getTargetSource&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract org.springframework.aop.Advisor&#91;&#93; org.springframework.aop.framework.Advised.getAdvisors&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.addAdvisor&#40;org.springframework.aop.Advisor&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.addAdvisor&#40;int,org.springframework.aop.Advisor&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.setTargetSource&#40;org.springframework.aop.TargetSource&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract java.lang.Class&#91;&#93; org.springframework.aop.framework.Advised.getProxiedInterfaces&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.addAdvice&#40;int,org.aopalliance.aop.Advice&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.addAdvice&#40;org.aopalliance.aop.Advice&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.isInterfaceProxied&#40;java.lang.Class&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.removeAdvice&#40;org.aopalliance.aop.Advice&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.removeAdvisor&#40;int&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.removeAdvisor&#40;org.springframework.aop.Advisor&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.replaceAdvisor&#40;org.springframework.aop.Advisor,org.springframework.aop.Advisor&#41; throws org.springframework.aop.framework.AopConfigException is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract java.lang.String org.springframework.aop.framework.Advised.toProxyConfigString&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.isFrozen&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.isProxyTargetClass&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract void org.springframework.aop.framework.Advised.setExposeProxy&#40;boolean&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.aop.framework.Cglib2AopProxy - Method public abstract boolean org.springframework.aop.framework.Advised.isExposeProxy&#40;&#41; is declared on Advised - using DISPATCH_ADVISED
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking BeanPostProcessors before initialization of bean 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking BeanPostProcessors after initialization of bean 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Calling code asked for FactoryBean instance for name 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'monitoredauftraegeAgpsFlDao'
                            &#91;junit&#93; org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean with name 'monitoredauftraegeAgpsFlDao' is a factory bean

                        Comment


                        • #13
                          Can you show this method: AbstractDaoImpl$QueryByIdsWithINClause.execute

                          It looks from the stack trace that this is where the NPE is occuring on line 335

                          Rob

                          Comment


                          • #14
                            protected static class QueryByIdsWithINClause extends AbstractQuery {

                            private final transient String sqlTempl;

                            private final transient String wherePlceHolder;

                            protected QueryByIdsWithINClause(final JdbcTemplate jdbtTempl,
                            final String sqlTempl, final String wherePlceHolder) {
                            super(jdbtTempl);
                            this.sqlTempl = sqlTempl;
                            this.wherePlceHolder = wherePlceHolder;
                            }

                            protected Object execute(final QueryParameters paramter) {
                            final StringBuffer buffer = new StringBuffer();
                            boolean first = true;
                            final Iterator it = paramter.getParentKeyMap().mapIterator();
                            while (it.hasNext()) {
                            final Number kdvtId = (Number) it.next();
                            if (first) {
                            first = false;
                            } else {
                            buffer.append(", ");
                            }
                            buffer.append(kdvtId.toString());
                            }
                            final String sql = sqlTempl.replaceFirst(wherePlceHolder, buffer
                            .toString());
                            return jdbcTml.query(sql, paramter.getRsExtractor());
                            }
                            }
                            The npe comes from jdbcTml being null.
                            jdbcTml is initialized in the constructor of the superclass:

                            Code:
                              protected static abstract class AbstractQuery &#123;
                            
                                    /**
                                     * Logger available to subclasses.
                                     */
                                    protected final Log logger = LogFactory.getLog&#40;getClass&#40;&#41;&#41;;
                            
                                    protected transient final JdbcTemplate jdbcTml;
                            
                                    protected AbstractQuery&#40;final JdbcTemplate jdbcTml&#41; &#123;
                                        super&#40;&#41;;
                                        this.jdbcTml = jdbcTml;
                                    &#125;
                            
                                    protected abstract Object execute&#40;final QueryParameters parameter&#41;;
                                &#125;
                            Both are innerclasses of a abstract superclass of the dao bean, which is proxyed:

                            Code:
                            public abstract class AbstractDaoImpl implements InitializingBean &#123;
                            
                                /**
                                 * Logger available to subclasses.
                                 */
                                protected final Log logger = LogFactory.getLog&#40;getClass&#40;&#41;&#41;;
                            
                                // Kolonnen Namen
                            
                                protected final static String COL_KDVT_ID = Messages
                                        .getString&#40;"Db.Column.kdvt_id"&#41;;
                            
                                protected final static String COL_SPRACHE_ID = Messages
                                        .getString&#40;"Db.Column.sprache_id"&#41;;
                            
                                // Exception Texte
                            
                                protected final static String EXC_MAPPING = Messages
                                        .getString&#40;"Db.Exception.Mapping"&#41;;
                            
                                final static String EXC_NULL = Messages.getString&#40;"Db.Exception.Null"&#41;;
                            
                                private DataSource dataSource;
                            
                                private JdbcTemplate jdbcTemplate;
                            
                                /**
                                 *  
                                 */
                                public AbstractDaoImpl&#40;&#41; &#123;
                                    super&#40;&#41;;
                                &#125;
                            
                                /**
                                 * @return Returns the dataSource.
                                 */
                                public final DataSource getDataSource&#40;&#41; &#123;
                                    return dataSource;
                                &#125;
                            
                                /**
                                 * @param dataSource
                                 *            The dataSource to set.
                                 */
                                public final void setDataSource&#40;final DataSource dataSource&#41; &#123;
                                    this.dataSource = dataSource;
                            
                                &#125;
                            
                                /*
                                 * &#40;non-Javadoc&#41;
                                 * 
                                 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet&#40;&#41;
                                 */
                                final public void afterPropertiesSet&#40;&#41; &#123;
                                    jdbcTemplate = new JdbcTemplate&#40;dataSource&#41;;
                                    doInAfterPropertiesSet&#40;&#41;;
                                &#125;
                            
                                protected final JdbcTemplate getJdbcTemplate&#40;&#41; &#123;
                                    return jdbcTemplate;
                                &#125;
                            The JdbcTemplate is created in the afterPropertiesSet method of AbstractDaoImpl .

                            QueryByIdsWithINClause ist created and executed in the proxied Bean:

                            Code:
                             /*
                                 * &#40;non-Javadoc&#41;
                                 * 
                                 * @see com.apgsga.vk.preisermittlung.db.DetailLoadingDao#loadForParents&#40;java.util.Collection&#41;
                                 */
                                public final void load&#40;final LoaderContext loaderContext&#41; &#123;
                            
                                    final IterableMap keysMap = getKeysMap&#40;loaderContext&#41;;
                                    final ResultSetExtractor rex = createResultSetExtractor&#40;loaderContext&#41;;
                                    final AbstractQuery theQuery = createQuery&#40;getJdbcTemplate&#40;&#41;,
                                            loaderContext&#41;;
                                    if &#40;theQuery == null&#41; &#123;
                                        return;
                                    &#125;
                                    final QueryParameters qparm = new QueryParameters&#40;keysMap,
                                            loaderContext, rex&#41;;
                                    qparm.add&#40;getParameterValueMap&#40;loaderContext&#41;&#41;;
                                    theQuery.execute&#40;qparm&#41;;
                                &#125;
                            The JdbcTemplate is already null in the getJdbcTemplate() method.

                            Comment


                            • #15
                              Setting "proxyTargetClass" to "true", as Rob suggested, was the solution:

                              The reason for the NPE, was that the proxied method from the interface of the Bean Class, where final, so CGLIB could'nt subclass them as decribed in the Spring Reference Dokumentation: 5.5.4. Proxying classes.

                              To see the invoking class - instead of the implementing super class, i had to change the Performance Monitor a bit:

                              Code:
                                  String name = invocation.getThis&#40;&#41;.getClass&#40;&#41;.getName&#40;&#41;
                                              + "." + invocation.getMethod&#40;&#41;.getName&#40;&#41;;
                              instead of:

                              Code:
                              	String name = invocation.getMethod&#40;&#41;.getDeclaringClass&#40;&#41;.getName&#40;&#41; + "." + invocation.getMethod&#40;&#41;.getName&#40;&#41;;

                              Comment

                              Working...
                              X