2016-07-14 19 views
1

私は春のフレームワークに新しいですし、春のXMLを使用してBeanを作成しようとしていたが、私は今、例外の下org.springframework.beans.NotWritablePropertyException:Beanクラスの無効なプロパティ「XXXX」:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'feedServerLineRead' defined in class path resource [FeedServer.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'feedProcessor' of bean class [workflow.FeedServerLineRead]: Bean property 'feedProcessor' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) 
    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 controller.FeedController.main(FeedController.java:76) 
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'feedProcessor' of bean class [workflow.FeedServerLineRead]: Bean property 'feedProcessor' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024) 
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900) 
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76) 
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358) 

に直面しています
package workflow; 

import java.util.ArrayList; 
import java.util.List; 
import java.util.concurrent.BlockingQueue; 

import org.springframework.jmx.export.annotation.ManagedResource; 

import FeedData; 
import FeedProcessor; 

@ManagedResource(objectName="bean:name=FeedServerLineRead") 
public class FeedServerLineRead implements Runnable { 

    private FeedProcessor feedProcessor; 
    BlockingQueue<String> queue; 

    @Override 
    public void run() { 
     while(true) { 
      String sb; 
      try { 

       sb = queue.take(); 
       List <FeedData> beanList = new ArrayList<FeedData>(); 

       FeedData dataPojo = new FeedData(); 
       dataPojo.setSide(sb.charAt(60));               
       dataPojo.setProduct(sb.substring(145, 163));            
       beanList.add(dataPojo); 
       feedProcessor.insertBatch(beanList); 

      } catch (InterruptedException ex) { 
       break; 
      } 
     } 
    } 


    public FeedServerLineRead(){ 
     this.queue=null; 
    } 

    public FeedServerLineRead(BlockingQueue<String> queue) { 
     this.queue = queue; 
    } 

    public FeedProcessor getFeedProcessor() { 
     return feedProcessor; 
    } 

    public void setFeedProcessor(FeedProcessor feedProcessor) { 
     this.feedProcessor = feedProcessor; 
    } 
} 



<?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:util="http://www.springframework.org/schema/util" 
     xmlns:p="http://www.springframework.org/schema/p" 
     xmlns:task="http://www.springframework.org/schema/task" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
      http://www.springframework.org/schema/util 
      http://www.springframework.org/schema/util/spring-util-3.0.xsd 
      http://www.springframework.org/schema/task 
      http://www.springframework.org/schema/task/spring-task-3.0.xsd"> 


    <bean id="feedProcessor" class="processor.FeedProcessor" /> 

    <bean id="feedServerLineRead" class="workflow.FeedServerLineRead"> 
     <property name="feedProcessor" ref="feedProcessor" /> 
    </bean> 
</beans> 

答えて

0

問題が解決しました:不正なjarが使用されたためでした。 spring.txはspring.daoを使用している間に使用する必要のある瓶です

関連する問題