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

  • Bean Creation error

    I am getting the following error when I start my Tomcat server:

    Error creating bean with name 'barcodeFormatterBean' defined in class path resource [conf/application-context-barcode-formatter.xml]: 3 constructor arguments specified but no matching constructor found in bean 'barcodeFormatterBean' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)

    Here is the code:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
    	<import resource="application-context-database-errorhandler.xml" />
    	<import resource="application-context-valid-barcode-manager.xml" />
    	<import resource="application-context-formatter.xml" />
    	
    	<bean id="barcodeFormatterBean" class="com.formatter.barcode.BarcodeFormatter">
    		<constructor-arg index="0" type="String" value="BARCODE" />
    		<constructor-arg index="1" type="BaseManagerImpl" ref="fdManager" />
    		<constructor-arg index="2" type="ValidBarcodeManager" ref="validBarcodeMgr" />
    		<property name="onlineErrorMgr" ref="onlineErrorMgr" />
    	</bean>
    	
    </beans>
    here is the corresponding constructor:


    Code:
        public BarcodeFormatter(String fileType, BaseManagerImpl fdManager,  ValidBarcodeManager vbm)
        {
    	super(fileType, fdManager);
    	validBarcodeMgr = vbm;
    	barCodeMap = validBarcodeMgr.useAllBarCodes();
    
        }

  • #2
    BaseManagerImpl and ValidBarcodeManager are probably in a package. You have to specify it in @type of your constructor argument - or leave it out completely. Having an index should really be sufficient. I mostly refrain from both.

    Joerg

    Comment

    Working...
    X