0

I'm working with Spring right now and have been trying to resolve a number of Failed to load ApplicationContext errors. This latest one is because it can't find a specific class when creating a bean structured like the following:

<bean id="problematicBean"
          class="com.domain.application.search.problematicBean">
        <property name="missingClass">
            <bean class="com.domain.application.search.MissingClass">

            </bean>
        </property>
    </bean>

I've triple checked and the filepath used in the bean class is correct. Other beans with identical paths (at least to the point of applicaiton) work perfectly. The file exists exactly where it should be for this classpath to work. The only difference is that this is a groovy file. Does anyone know why my application can't find the class?

Maria-Andersado
  • 777
  • 1
  • 9
  • 18
  • 1) Check the classpath, not the file path. Is that class in one of the JARs or directories on the classpath? 2) Check the logfile for earlier errors; e.g. errors in initializing a class that this class depends on. – Stephen C Oct 19 '19 at 02:12
  • I'm using eclipse, so should I check the java build path? – Maria-Andersado Oct 19 '19 at 02:18
  • It is the runtime classpath that matters. That will depending on how you are *deploying and running* the application. – Stephen C Oct 19 '19 at 03:19
  • right now I'm just trying to get a unit test to run with Spring lol – Maria-Andersado Oct 19 '19 at 21:34
  • 1
    Well it will the classpath that is in effect when the unit tests are run. Without a deep understanding of your code, I can't say whether that should be the same as the build path. The other thing to check is that the source has actually been compiled to a .class file. The JVM will only load .class files. – Stephen C Oct 20 '19 at 01:29

0 Answers0