我正在尝试使用 vFabric tc Server 在 Spring Tool Suite (STS) 中部署我的 Web 应用程序,但出现异常。值得注意的是,如果我在独立的 Tomcat 6 中编译和运行,它运行良好。我尝试了 vFabric tc 版本的 tomcat-7.0.35.B.RELEASE 和 tomcat-6.0.36.B.RELEASE。
错误是:
java.lang.IllegalArgumentException: class [springapp.web.spring.MyInitializer] must implement ApplicationContextInitializerclass springapp.web.spring.MyInitializer is not assignable to interface org.springframework.context.ApplicationContextInitializer
我无法解释为什么在初始化程序确实实现时会发生此错误ApplicationContextInitializer
:
public class MyInitializer implements ApplicationContextInitializer {
public void initialize(ConfigurableApplicationContext ctx) {
try {
PropertySource ps = new ResourcePropertySource("file:///home/jim/development/act/impact/webapp.properties");
ctx.getEnvironment().getPropertySources().addFirst(ps);
// perform any other initialization of the context ...
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
有没有人对我可以尝试让它运行有什么建议?