Link to home
Start Free TrialLog in
Avatar of cutie_smily
cutie_smily

asked on

creating bean for BufferedWriter gets failed

I am trying to create bufferedWriter like as shown below in my cpring config file

<bean name="fileWriter" class="java.io.FileWriter">
                <constructor-arg index="0">
                        <value>/home/translator3.3/src/resources/sampledata/cigna/welcomecallrubric.txt</value>
                </constructor-arg>
                <constructor-arg index="1">
                        <value>false</value>
                </constructor-arg>
        </bean>
      <bean name="bufferedWriter" class="java.io.BufferedWriter">
                <constructor-arg index="1">
                        <ref bean="fileWriter" />
                </constructor-arg>
        </bean>



I am havin error

Cannot resolve reference to bean 'bufferedWriter' while setting bean property 'writer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bufferedWriter' defined in file [/home/rchilka/c4ctranslator3.3/src/resources/config/cigna/welcomecallrubric.xml]: Cannot resolve reference to bean 'fileWriter' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileWriter' defined in file [/home//src/resources/config/comecall.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.io.FileWriter]: Constructor threw exception; nested exception is java.io.FileNotFoundException: /home/rchilka/c4ctranslator3.3/src/resources/sampledata/cigna/welcomecallrubric.txt (No such file or directory)
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DocumentBuilderFactory' defined in file [/home/rchilka/c4ctranslator3.3/src/resources/config/cigna/welcomecallrubric.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: Ambiguous factory method argument types - did you specify the correct bean references as factory method arguments?


Can anybody help in solving above?
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial