This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

bean ref not found

Apr 26th, 2005, 08:54 AM

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.

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

Comment

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

Comment

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

Comment

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?

Comment

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.

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?

Comment

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.

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.