0

Spring 3.2 ベースのアプリケーションで Perf4j をセットアップする必要があります。次の Spring xml 構成コンテンツがあります。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<context:component-scan base-package="com.xxx.yyy.services" />

<jee:jndi-lookup id="jmsConnectionFactory" jndi-name="java:/JmsXA" lookup-on-startup="true"/>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <property name="deliveryPersistent" value="false"/>
    <property name="receiveTimeout" value="30000"/>
</bean>

<bean id="eventConsumer" class="com.motive.kmp.event.JmsEventConsumer"/>

<bean id="eventProducer" class="com.motive.kmp.event.JmsEventProducer">
    <constructor-arg ref="jmsTemplate"/>
</bean>


<aop:aspectj-autoproxy>
      <aop:include name="timingAspect" />
</aop:aspectj-autoproxy>

<bean id="timingAspect" class="org.perf4j.slf4j.aop.TimingAspect" />

アプリケーションを JBoss AS 7.1.0.Final にデプロイすると、次のエラーが発生します。

 Exception sending context initialized event to listener instance of class   
  org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in class path resource [service-common-context.xml]: Cannot resolve reference to bean 'jmsConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConnectionFactory': Post-processing of the FactoryBean's object failed; nested exception is java.lang.IllegalArgumentException: error Type referred to is not an annotation type: org.perf4j.aop.Profiled

 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConnectionFactory': Post-processing of the FactoryBean's object failed; nested exception is java.lang.IllegalArgumentException: error Type referred to is not an annotation type: org.perf4j.aop.Profiled
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:165) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1443) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]

Profiled アノテーションはサービス Bean メソッドに適用されます。Profiled アノテーションが実際に使用されている Bean リストを指定する方法はありますか?

前もって感謝します。

4

1 に答える 1

0

JMS リソースの jee:jndi-lookup 定義を変更した後、proxy-interface を指定して問題を解決しました。

<jee:jndi-lookup id="jmsConnectionFactory" 
                 jndi-name="java:/JmsXA" 
                 lookup-on-startup="true"
                 proxy-interface="javax.jms.ConnectionFactory"/>
于 2013-04-25T08:35:56.037 に答える