1

I have a Spring beans.xml that specifies a certain class my.package.Class to be injected somewhere in my code by Autowiring. The program is actually a web application inside a Tomcat container. Now when I launch Tomcat the logfile tells me my.package.Class cannot be found, even though its JAR is both in the classpath and the web application's lib/ directory. Do I have to tell Tomcat or Spring where to find the JAR, too, and if so: how?

1
  • 1
    is your .class file in folder WEB-INF/classes folder? Commented Oct 25, 2012 at 13:14

1 Answer 1

3

Make sure, you have this code in your context:

<context:annotation-config />
<context:component-scan base-package="package.autowire.context" />

For more info you better read http://springindepth.com/book/in-depth-ioc-autowiring.html

By the way, check the default output folder in your project build path. That could also be the cause.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot, that did the trick! I must say though that the Error description that Tomcat/Spring gave wasn't quite informative, don't you agree?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.