13

I have developed this proof of concept https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic to test the deployment of Spring Boot applications in Weblogic 12c (12.2.1).

The application deploys and starts successfully, but when I try to connect to it (i.e. /accounts?number=1234) the error below is shown:

Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error 
The server encountered an unexpected condition which prevented it 
  from fulfilling the request.

And the log file has the exception:

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:344)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:244)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run

Did I miss something?

Thanks,

eruiz
  • 1,963
  • 1
  • 14
  • 22
  • Where is `dispatcherServlet-servlet.xml` coming from? Could it be it's coming from the Weblogic specific Spring support or something? – Stephane Nicoll Dec 30 '15 at 08:49
  • No idea, the Spring Boot application is very simple, please take a look to the proof of concept at https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic – eruiz Dec 30 '15 at 08:52
  • I did already. I don't see anything wrong there. – Stephane Nicoll Dec 30 '15 at 08:56
  • Could you provide more info about what you said "the Weblogic specific Spring support"? – eruiz Dec 30 '15 at 09:01
  • https://docs.oracle.com/cd/E24329_01/web.1211/e24975/toc.htm - I can see in your stack that weblogic is kicking in (for whatever reason) and is probably trying to find a configuration file at a default location. Search the web for that thing maybe? – Stephane Nicoll Dec 30 '15 at 09:05
  • No results and no idea ... – eruiz Dec 31 '15 at 08:39
  • I've faced the same problem for Weblogic12.2, but switching to 12.1 resolves this issue. I'll share the root cause if I figure out why. – Efe Kahraman Jan 20 '16 at 11:44
  • Stéphane, could it be the new Servlet 3.1 API? The section "4.4 Configuration methods" of the "Java Servlet Spec v3.1" says: "If the ServletContext passed to the ServletContextListener's contextInitialized method where the ServletContextListener was neither declared in web.xml or web-fragment.xml nor annotated with @WebListener then an UnsupportedOperationException MUST be thrown for all the methods defined in ServletContext for programmatic configuration of servlets, filters and listeners." Spring MVC 4.2 doesn't use WebListener annotation and the web.xml is missing in the PoC project. – eruiz Jan 20 '16 at 14:23
  • @eruiz on your github you say you've solved the problem. Can you share the solution please? I've actually uploaded your project on to a Web Logic AS and it loads up and runs fine but I can't reach any of the URLs – Schokea Mar 24 '16 at 14:10
  • I have reviewed and improved the proof of concept, I tested it and it worked! You try now, it should work. – eruiz Mar 30 '16 at 22:34

2 Answers2

16

I found a workaround putting a dummy dispatcherServlet-servlet.xml file under WEB-INF:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- Do not remove this file! -->

</beans>
Robert Hume
  • 1,129
  • 2
  • 14
  • 25
11

I've reproduced this issue with WebLogic 12.2.1.0 (plain new install) using spring-boot-sample-war (with an additional weblogic.xml to handle logging). Also tried the latest patchset (WLS PATCH SET UPDATE 12.2.1.0.160419), but the issue remains.

For some reason WebLogic decides it needs to create the DispatcherServlet using it's own configuration as soon as you access the application available on /.

I've put in a service request to Oracle Support and we'll see what they think about this issue.

Update: 'Patch 23124727: CANNOT DEPLOY SPRING BOOT .WAR ON 12.2.1 DUE TO JAVA.IO.FILENOTFOUNDEXCEPTION' is available for Oracle WebLogic Server 12.2.1.0.0 and works with both the spring-boot-sample-war as well as a more advanced application.

  • Cool! Thanks for reporting to Oracle Support! – eruiz Mar 22 '16 at 15:10
  • Is there a way of tracking the service request? – Schokea Mar 24 '16 at 11:59
  • 2
    It's SR #3-12394371821. Not sure if it's available to others, though. Probably not.. They're currently investigating. – Øyvind Horneland Mar 24 '16 at 12:08
  • @ØyvindHorneland We have the same issue and I can add that it works on WLS 12.1.3 but not WLS 12.2, same as in your case. Any updates from Oracle? – Kristoffer Mar 30 '16 at 15:46
  • @Kristoffer No update yet. I've registered this as a severity 4 SR as this is not currently a production issue for us. – Øyvind Horneland Mar 30 '16 at 18:00
  • @ØyvindHorneland I opened a ticket with spring-boot, they think the problem is related to WLS and also added a strack trace to help: https://github.com/spring-projects/spring-boot/issues/5549 – Kristoffer Apr 01 '16 at 11:29
  • @ØyvindHorneland Anything new? Cheers! – Kristoffer Apr 19 '16 at 07:20
  • @Kristoffer Sorry, nothing new, yet. No estimates either. I'll update this issue when some real progress have been made (workaround, confirmed bug, patch, etc) – Øyvind Horneland Apr 19 '16 at 13:28
  • 1
    @Kristoffer Patch 23124727 is available. It seems it's been available since May 10., but I didn't get the update. Anyway, I've tried it now on the spring-boot-sample-war as well as our own application and it seems to work just fine. – Øyvind Horneland Jun 14 '16 at 06:24
  • Great work! Thanks for your patient and your insistence! – eruiz Jun 21 '16 at 17:06
  • @ØyvindHorneland do you know when the Weblogic with that patch will be released? – eruiz Jun 29 '16 at 05:57
  • Maybe is it included in 12.2.1.1.0? (https://blogs.oracle.com/fusionmiddlewaresupport/entry/oracle_fusion_middleware_12c_121) – eruiz Jun 29 '16 at 06:02
  • @eruiz It's tagged with 12.2.2.1.0 and it's not mentioned in the new 12.2.1.1.0 release's release notes. So until 12.2.2.1.0 is released, you'll need to download it (23124727) from Oracle Support and apply the patch. I don't know when 12.2.2.1.0 will be released, and Oracle Support did not provide any information about when we might expect that release. – Øyvind Horneland Jun 29 '16 at 08:55
  • If you try and apply patch 23124727 to 12.2.1.1.0 you get this: [Nov 4, 2016 12:27:42 PM] Found a higher component in OH inventory: oracle.wls.libraries, 12.2.1.0.0 [Nov 4, 2016 12:27:42 PM] Found a higher component in OH inventory: oracle.wls.libraries, 12.2.1.0.0 [Nov 4, 2016 12:27:42 PM] [ oracle.wls.libraries, 12.2.1.0.0, higher version 12.2.1.1.0 found. ] , [ oracle.wls.libraries, 12.2.1.0.0, higher version 12.2.1.1.0 found. ] [Nov 4, 2016 12:27:42 PM] Skip patch 23124727 from list of patches to apply: This patch is not needed. – Tim Webster Nov 04 '16 at 14:01