Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: bean ref not found

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default bean ref not found

    Installed Spring-ide version 1.1.1 in Spring 3.01, and use Spring 1.2 rcX.
    Added nature to project and added context files to project.
    Problem: beans that are referenced with "ref bean" are not being found.

    In my applicationContext-db.xml file I have:
    Code:
        <bean id="propertyConfigurer" class="org.springframework.beans.
                factory.config.PropertyPlaceholderConfigurer">
            <description>Use the 'run.properties' file to 
                   override the properties 
                   used in the Spring container</description>
            <property name="properties"><ref  
                 bean="runProperties"></ref></property>        
        </bean>
    This refers to the bean in the root applicationContext.xml file:
    Code:
        <bean id="runProperties" class="org.springframework.beans.
             factory.config.PropertiesFactoryBean">
            <description></description>
            <property name="locations">
                <list>
                    <value>file&#58;run.properties</value>
                </list>
            </property>        
        </bean>

    All context files are flagged as in error in Eclipse. The app compiles and runs fine. I must be missing something about Spring-ide?

  2. #2
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    Hi jbetancourt,

    Spring IDE 1.1.1 ships with spring-core.jar version 1.1.5. Please don't use any features from the upcoming Spring 1.2 release e.g. inline values or refs. This is because the Spring IDE Xml parser (xerces) validates against the shipped dtd.

    If this does not help please provide the full spring config files as well as the .springProject file from your eclipse project.

    Greetings
    Christian
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  3. #3
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default

    Did you create a config set for your depending config files?

    Otherwise Spring IDE doesn't know anything about a relationship of certain config files and it validates every config file on it's own. With the existance of config sets config files which are part of a config set are validated within the context of a BeanFactory created from the config files belonging to the same config set.

    This way the bean references can be resolved during validation.

    Cheers,
    Torsten

  4. #4
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

    That fixed it, thanks.


    Quote Originally Posted by Torsten Juergeleit
    Did you create a config set for your depending config files?

    Otherwise Spring IDE doesn't know anything about a relationship of certain config files and it validates every config file on it's own. With the existance of config sets config files which are part of a config set are validated within the context of a BeanFactory created from the config files belonging to the same config set.

    This way the bean references can be resolved during validation.

    Cheers,
    Torsten

  5. #5
    Join Date
    Aug 2004
    Posts
    230

    Default

    Quote Originally Posted by Torsten Juergeleit
    Did you create a config set for your depending config files?
    This works if all the config-files are in the same project. But when some (or most) of the ref'ed beans are defined in config-files from other projects the I cannot eliminate the errors. (see http://springide.org/project/ticket/77)

    Is there some other workaround?

    Also when I remove the spring nature, the error markers remain. How can I get rid of the error markers after removing the spring nature?
    Barry Kaplan (memelet)

  6. #6
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default

    Quote Originally Posted by memelet
    This works if all the config-files are in the same project. But when some (or most) of the ref'ed beans are defined in config-files from other projects the I cannot eliminate the errors.
    For referencing config files in a different Spring project you have to select this external Spring project in the list of "Project References" in your Spring project's properties first. This way Spring IDE get's aware of your externally defined Spring config files. Now you can add the Spring config files of the external Spring project to config sets defined in your Spring project. The Java build path isn't checked for Spring projects because it's available for Java projects only. Spring projects don't have to be Java projects.
    Quote Originally Posted by memelet
    Also when I remove the spring nature, the error markers remain. How can I get rid of the error markers after removing the spring nature?
    To get rid of the problem markers you have the following options:
    • remove the config files from the Spring project via project properties dialog "Spring Beans / Config"
    • turn of displaying Spring IDE's problem markers at all (via the problem views' filter setting by deselecting "Spring Problem Marker")

    I have added these questions to the Spring IDE FAQ: http://springide.org/project/wiki/SpringideFaq

    Your ticket (http://springide.org/project/ticket/77) is updated as well.

  7. #7
    Join Date
    Aug 2004
    Posts
    230

    Default

    Quote Originally Posted by Torsten Juergeleit
    For referencing config files in a different Spring project you have to select this external Spring project in the list of "Project References" in your Spring project's properties first. This way Spring IDE get's aware of your externally defined Spring config files.
    I forgot to mention that I tried this (because it was indicated on the wiki somewhere), but it did not work. Even with the depedent project selected I was not offered the option to select config files from that project.

    (This is 1.2 running M7 BTW)
    Barry Kaplan (memelet)

  8. #8
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default

    Quote Originally Posted by memelet
    Even with the depedent project selected I was not offered the option to select config files from that project.
    Your are only offered to add them while creating / editing a config set ;-).

    I have updated the FAQ http://springide.org/project/wiki/SpringideFaq. Please edit entry 2.1 in this wiki page if it's not clearly defined yet . Thanx.

    Cheers,
    Torsten

  9. #9
    Join Date
    Aug 2004
    Posts
    230

    Default

    Ok, I works now. Almost. Now I get a popup containing:

    Errors during build.
    Errors running builder "Spring Project Builder" on project bbt.liquidityarbitrage.
    An error occurred while traversing resources.
    The entry in the log contains:
    Code:
    java.lang.IllegalArgumentException&#58; Path for project must have only one segment.
    	at org.eclipse.core.internal.utils.Assert.isLegal&#40;Assert.java&#58;60&#41;
    	at org.eclipse.core.internal.resources.WorkspaceRoot.getProject&#40;WorkspaceRoot.java&#58;134&#41;
    	at org.springframework.ide.eclipse.beans.core.internal.model.BeansModel.getProject&#40;BeansModel.java&#58;125&#41;
    	at org.springframework.ide.eclipse.beans.core.internal.model.BeansModelUtils.getConfig&#40;BeansModelUtils.java&#58;55&#41;
    	at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfigValidator.validate&#40;BeansConfigValidator.java&#58;96&#41;
    	at org.springframework.ide.eclipse.beans.core.internal.project.BeansProjectValidator.build&#40;BeansProjectValidator.java&#58;69&#41;
    	at org.springframework.ide.eclipse.core.internal.project.SpringProjectBuilder.build&#40;SpringProjectBuilder.java&#58;154&#41;
    	at org.springframework.ide.eclipse.core.internal.project.SpringProjectBuilder.access$0&#40;SpringProjectBuilder.java&#58;150&#41;
    	at org.springframework.ide.eclipse.core.internal.project.SpringProjectBuilder$Visitor.visit&#40;SpringProjectBuilder.java&#58;109&#41;
    	at org.eclipse.core.internal.resources.Resource$2.visit&#40;Resource.java&#58;103&#41;
    	at org.eclipse.core.internal.resources.Resource$1.visitElement&#40;Resource.java&#58;50&#41;
    	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration&#40;ElementTreeIterator.java&#58;81&#41;
    	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration&#40;ElementTreeIterator.java&#58;85&#41;
    	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration&#40;ElementTreeIterator.java&#58;85&#41;
    	at org.eclipse.core.internal.watson.ElementTreeIterator.iterate&#40;ElementTreeIterator.java&#58;126&#41;
    	at org.eclipse.core.internal.resources.Resource.accept&#40;Resource.java&#58;60&#41;
    	at org.eclipse.core.internal.resources.Resource.accept&#40;Resource.java&#58;101&#41;
    	at org.eclipse.core.internal.resources.Resource.accept&#40;Resource.java&#58;80&#41;
    	at org.springframework.ide.eclipse.core.internal.project.SpringProjectBuilder.build&#40;SpringProjectBuilder.java&#58;91&#41;
    	at org.eclipse.core.internal.events.BuildManager$2.run&#40;BuildManager.java&#58;585&#41;
    	at org.eclipse.core.internal.runtime.InternalPlatform.run&#40;InternalPlatform.java&#58;1029&#41;
    	at org.eclipse.core.runtime.Platform.run&#40;Platform.java&#58;775&#41;
    	at org.eclipse.core.internal.events.BuildManager.basicBuild&#40;BuildManager.java&#58;168&#41;
    	at org.eclipse.core.internal.events.BuildManager.basicBuild&#40;BuildManager.java&#58;202&#41;
    	at org.eclipse.core.internal.events.BuildManager$1.run&#40;BuildManager.java&#58;231&#41;
    	at org.eclipse.core.internal.runtime.InternalPlatform.run&#40;InternalPlatform.java&#58;1029&#41;
    	at org.eclipse.core.runtime.Platform.run&#40;Platform.java&#58;775&#41;
    	at org.eclipse.core.internal.events.BuildManager.basicBuild&#40;BuildManager.java&#58;234&#41;
    	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop&#40;BuildManager.java&#58;253&#41;
    	at org.eclipse.core.internal.events.BuildManager.build&#40;BuildManager.java&#58;282&#41;
    	at org.eclipse.core.internal.events.AutoBuildJob.doBuild&#40;AutoBuildJob.java&#58;139&#41;
    	at org.eclipse.core.internal.events.AutoBuildJob.run&#40;AutoBuildJob.java&#58;200&#41;
    	at org.eclipse.core.internal.jobs.Worker.run&#40;Worker.java&#58;67&#41;
    The error only occurs with spring-nature enabled -- remove the spring-nature and the error is not issued.
    Barry Kaplan (memelet)

  10. #10
    Join Date
    Aug 2004
    Location
    Frankfurt/Main, Germany
    Posts
    253

    Default

    Quote Originally Posted by memelet
    Ok, I works now. Almost. Now I get a popup containing:
    Errors during build.
    Errors running builder "Spring Project Builder" on project bbt.liquidityarbitrage.
    An error occurred while traversing resources.
    I opened a new ticket: http://springide.org/project/ticket/80

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •