Search code examples
springjava-ee-6tomcat7

Is Tomcat 7.0.10 Java EE 6 Compliant? javax.inject woes


Folks- I'm following an example from Craig Walls' "Spring in Action 3" (MEAP edition) on Tomcat 7.0.10. Getting a compiler error in eclipse on the following import:

import javax.inject.Inject;

The error message is:

The import javax.inject cannot be resolved

I understand javax.inject is part of Java EE 6, is Tomcat 7 not Java EE 6 compliant? I have all the jars in $CATALINA/lib copied to my WEB-INF/lib directory, also did a manual search (jar -tvf) but couldn't find this package.

Any help will be greatly appreciated. Thanks.


Solution

  • Tomcat is a servlet container, therefore it has nothing to do with JSR-330 (javax.inject).

    If you want to use JSR-330 annotations, you need to add JSR-330 jar to the classpath.