My spring java-config application packed as war runs wihout problem on weblogic 12.1.3 so I tried to deploy same war into weblogic 12.2.1 where it causes java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/DispatcherServlet-servlet.xml]
.
It seems like DispatcherServlet servlet is initialized with XmlWebApplicationContext
(default one) instead of AnnotationConfigEmbeddedWebApplicationContext
in 12.2.1 even when war is the same.
Has someone any idea what was changed in weblogic implementation since previous version what is causing this problem?
Using same war
:
- in WLS 12.1.3 it is working without issue, application configures using annotations/java
- in WLS 12.2.1 the same application looks for xml configuration at some point instead of configuring it using annotations/java as in 12.1.3.
Had the same problem. I guess there is something wrong with WebLogic 12.2.1.
Try to manually set context class for Spring servlet, like so:
And everything will work fine again :)
I managed to get spring-boot 1.3.6.RELEASE working on Weblogic 12.2.1.
I had to create an empty (no declared beans) dispatcherServlet-servlet.xml file on src/main/webapp/WEB-INF directory.
Here is the file content:
In addition, I made my main application class implement WebApplicationInitializer as stated on Spring Boot Ref Guide.
I am not sure if there are now two application contexts, but the one who is answering all my API calls seems to be working fine (dependency injection, aop, jdbc, jpa, logging, session context, actuator, etc).
PS: I have tried @amariq solution but it didn't work on Weblogic 12.2.1, only the one described above.
Sorry , I can't add a comment on the response of amariq.
Just a comment: if your WebApplicationInitializer extends AbstractDispatcherServletInitializer, you can override the method customizeRegistration like:
I had the exact same issue here and tried the solutions suggested above, but they didn't work for me. I finally managed to make it work by doing a few modifications using this GitHub repo as reference.
They main points I could outline are:
pom.xml
: addexcludes
fortomcat-embed-el
dependency fromspring-boot-starter-web
pom.xml
: add dependency forspring-boot-legacy
web.xml
withcontextConfigLocation
,SpringBootContextLoaderListener
andappServlet
(in my previous configuration I had noweb.xml
at all)Take a look at https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic for further details.
I hope it helps.