Versioning refers to XML schema version that syntax of your web.xml file must obey. More important, it also indicates the version of Servlet specification that your application implements.
Older Servlet containers don’t have support for the ServletContextInitializer bootstrap process used in Servlet 3.0. You can still use Spring and Spring Boot in these containers but you are going to need to add a web.xml to your application and configure it to load an ApplicationContext via a DispatcherServlet.
4 回答
我查看了您的代码并在此类代码中看到了一个问题:https://github.com/purrox/Spring-example/blob/master/src/main/java/hello/Application.java
你正确地做了(正如SpringBoot文档中所定义的那样),但似乎Weblogic12C存在一个错误(或者可能是对标准的解释) . 似乎Weblogic12C搜索直接实现WebApplicationInitializer的类 . 请注意您的代码如何扩展SpringBootServletInitializer(实现WebApplicationInitializer) . Weblogic12C似乎并不喜欢它 . 因此,最简单的方法是使Application类实现WebApplicationInitializer . 所以,改变这一行:
对此:
注意:一旦修复了上述内容,您将遇到另一个Weblogic12C部署问题:“java.lang.IllegalArgumentException:LoggerFactory不是Logback LoggerContext,但Logback在类路径上” . 要解决其他问题,请创建一个新文件src / main / webapp / WEB-INF / weblogic.xml并将此内容放入其中:
如果您要使用
multipart
文件请求,您仍可能在部署战争时遇到问题 .问题的根源是OrderedCharacterEncodingFilter在HiddenHttpMethodFilter之后运行 .
HiddenHttpMethodFilter
在请求时调用getParameter
时触发请求正文的处理 .OrderedCharacterEncodingFilter
然后运行并在处理其正文之后设置请求's encoding. Setting the request' s编码是错误的,并且在WebLogic上,导致请求失去对其所有多部分数据的跟踪 .解决方法是在application.properties中禁用字符编码过滤器:
您需要在hello.Application中添加“implements WebApplicationInitializer” .
这是多余的,因为它扩展了SpringBootServletInitializer,它本身实现了WebApplicationInitializer,但是,正如@Pierre指出的那样,weblogic需要一个类来直接实现它 .
我上次遇到这个问题 . 应用此帖子中的所有提案后,我仍然收到错误403.在我的情况下,问题出在
web.xml
文件中 . 我使用版本2.5而不是3.0而没有将其配置为通过DispatcherServlet
加载ApplicationContext
.从帖子:What exactly is the web-app version? What does it affect? .
并从Spring文档http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html:
最后我将
web.xml
文件的版本更改为3.0并开始工作 .