當我手動將war檔案部署到tomcat時,我得到了404錯誤。但如果我在eclipse中運行maven build spring-boot:run,它就能正常作業,我可以通過localhost:8080訪問該應用程式。
/**.
*因為basePackage包括com.apiDemo.*和api模塊被匯入,api組件也將被呼叫。
*/
@Configuration
@ComponentScan(basePackages = "com.*")
@SpringBootApplication
public class WebApplication extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
SpringApplication.run(WebApplication.class, args)。
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.setInitParameter("com.sun.faces.expressionFactory", "org.apache.el.ExpressionFactoryImpl")。)
}
}
@Piotr P. Karwasz 謝謝,現在它在tomcat上作業,但我不能執行任何操作。更新和創建按鈕產生405或404錯誤。
uj5u.com熱心網友回復:
你的問題是為什么在將SpringBootServletInitializer部署到外部tomcat時有必要擴展的一個小變化。你擴展了該類,但同時覆寫了最重要的方法(見ServletContainerInitializer#onStartup的檔案):
@Override
public void onStartup(ServletContext servletContext) throwsServletException {
servletContext.setInitParameter("com.sun.faces.expressionFactory", "org.apache.el.ExpressionFactoryImpl")。)
}
你應該添加一個對super.onStartup的呼叫:
@Override
public void onStartup(ServletContext servletContext) throwsServletException {
servletContext.setInitParameter("com.sun.faces.expressionFactory", "org.apache.el.ExpressionFactoryImpl")。)
super.onStartup(servletContext)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/325353.html
標籤:
上一篇:我怎樣才能獲得證書檔案?


