Boa tarde pessoal,
Tenho uma aplicação que preciso fazer para logs e estou utilizando AOP. Porém foi necessário criar uma classe para utilizar o quartz e a aplicação não funciona mais.
Estou utilizando: Spring 2.5, quartz e aspectj.
Abaixo segue meu arquivo de configuração (applicationContext.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:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd ">
<aop:aspectj-autoproxy />
<!-- Aspect -->
<bean id="logAspect" class="br.log.Log4Aop" />
<!-- Hibernate SessionFactoryAFI -->
<bean id="jbossTransactionManager"
class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple">
</bean>
<bean id="jbossUserTransaction"
class="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple" />
<!-- Transaction manager for a single Hibernate SessionFactory (alternative
to JTA) -->
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<ref bean="jbossTransactionManager" />
</property>
<property name="userTransaction">
<ref bean="jbossUserTransaction" />
</property>
</bean>
<bean id="testeServiceTarget" class="br.teste.TesteService1" />
<bean id="testeService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="target" ref="testeServiceTarget" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="jobObj" class="br.teste.Job" />
<bean id="job"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="jobObj" />
<property name="targetMethod" value="methodJob" />
</bean>
<bean id="triggerJob" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="job" />
<property name="cronExpression" value="0 0 8 * * ?" />
<property name="jobDataAsMap">
<map>
<entry key="triggerMessage" value="Iniciando Exclusão de Registros" />
</map>
</property>
</bean>
</beans>
statck Trace
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triggerJob' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy13 implementing java.lang.Cloneable,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.quartz.JobDetail] for property 'jobDetail'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy13 implementing java.lang.Cloneable,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at br.gov.am.prodam.log.teste.Teste.main(Teste.java:9)
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy13 implementing java.lang.Cloneable,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.quartz.JobDetail] for property 'jobDetail'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy13 implementing java.lang.Cloneable,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
... 14 more
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy13 implementing java.lang.Cloneable,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.quartz.JobDetail] for property 'jobDetail': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
... 18 more
Desde já agradeço!