Hi,
We have successfully run a spring-boot web application in WLS 12.1.3, but after an upgrade to 12.2.1 it fails on the first request. To me it looks like WLS tricks spring-boot into using XML configuration, or that spring-boot tricks itself for some reason.
When starting the server everything looks normal:
2016-04-01 09:31:07.334 INFO [bootstrap,,,] 90818 --- [ (self-tuning)'] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [GetRandomNumbers:name=refreshEndpoint,type=RefreshEndpoint]
2016-04-01 09:31:10.007 INFO [bootstrap,,,] 90818 --- [ (self-tuning)'] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-04-01 09:31:10.076 INFO [bootstrap,,,] 90818 --- [ (self-tuning)'] acme.App : Started App in 13.405 seconds (JVM running for 30.998)
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <WebLogicServer> <BEA-000332> <Started the WebLogic Server Managed Server "Server-0" for domain "base_domain" running in development mode.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:8101 for protocols iiop, t3, ldap, snmp, http.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:8101 for protocols iiop, t3, ldap, snmp, http.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
<Apr 1, 2016 9:31:11 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
But on the first request the dispatcherServlet starts and fails because of the no longer needed dispatcherServlet-servlet.xml:
2016-04-01 09:31:26.217 INFO [bootstrap,7ab47160dc7eaa02,7ab47160dc7eaa02,false] 90818 --- [ (self-tuning)'] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2016-04-01 09:31:26.238 INFO [bootstrap,7ab47160dc7eaa02,7ab47160dc7eaa02,false] 90818 --- [ (self-tuning)'] o.s.w.c.s.XmlWebApplicationContext : Refreshing WebApplicationContext for namespace 'dispatcherServlet-servlet': startup date [Fri Apr 01 09:31:26 CEST 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3e45b209
2016-04-01 09:31:26.245 INFO [bootstrap,7ab47160dc7eaa02,7ab47160dc7eaa02,false] 90818 --- [ (self-tuning)'] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]
2016-04-01 09:31:26.250 ERROR [bootstrap,7ab47160dc7eaa02,7ab47160dc7eaa02,false] 90818 --- [ (self-tuning)'] o.s.web.servlet.DispatcherServlet : Context initialization failed
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:667)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
....
Could this be a problem caused by spring-boot or is it WLS that initialises spring-boot in a bad way?
Using spring-boot 1.3.3, WLS 12.2.1.
Thanks a lot!
/Kristoffer
I've just successfully deployed our JSP sample to WLS 12.2.1 (after messing around with prefer-application-packages for org.slf4j) so it's either something specific to your app or to your configuration of WLS. Either way, to be able to investigate further we'll need a list of steps and sample application that reproduces the problem.
Thanks for helping out!
Unfortunately I get the same problem with spring-boot-sample-web-jsp (version 1.3.3.RELEASE).
I compiled and deployed the to the WLS 12.2, with the prefer-application-packages weblogic.xml tweaks (see copy below). I have made no configuration changed to WLS, it is started like this:
./startWebLogic.sh./startManagedWebLogic.sh Server-0 http://localhost:7001Running Mac OSX 10.10.5, Java JDK 1.8 patchlevel 73. This is the startup log from step 2:
Starting WLS with line:
/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java -server -Xms256m -Xmx512m -XX:CompileThreshold=8000 -Dweblogic.Name=Server-0 -Djava.security.policy=/Users/krre/Downloads/fmw_12.2.1.0.0_wls_quick_Disk1_1of1/wls12210/wlserver/server/lib/weblogic.policy -Dweblogic.security.SSL.trustedCAKeyStore=/Users/krre/Downloads/fmw_12.2.1.0.0_wls_quick_Disk1_1of1/wls12210/wlserver/server/lib/cacerts -Xverify:none -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/Users/krre/Downloads/fmw_12.2.1.0.0_wls_quick_Disk1_1of1/wls12210/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/Users/krre/Downloads/fmw_12.2.1.0.0_wls_quick_Disk1_1of1/wls12210/wlserver/server -Dweblogic.home=/Users/krre/Downloads/fmw_12.2.1.0.0_wls_quick_Disk1_1of1/wls12210/wlserver/server -Dweblogic.management.server=http://localhost:7001 weblogic.Server
weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
@renholm Sorry, I'd missed the need to make a request to the app in your original description. I've now reproduced the problem.
The problem is that WebLogic is creating a new DispatcherServlet instance when the request is received, rather than reusing the DispatcherServlet that was created when the application launched. Unlike the first DispatcherServlet, the second DispatcherServlet has not been configured with a WebApplicationContext so it attempts to create one. Unfortunately, I have no idea why WebLogic is creating a second DispatcherServlet instance. Here's the stack trace when it does so:
"[ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'" #56 daemon prio=5 os_prio=31 tid=0x00007f8e1970a000 nid=0x9903 at breakpoint[0x0000000183cd8000]
java.lang.Thread.State: RUNNABLE
at org.springframework.web.servlet.DispatcherServlet.<init>(DispatcherServlet.java:350)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:252)
at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:245)
at weblogic.servlet.internal.WebComponentContributor.createServletInstance(WebComponentContributor.java:274)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.newServletInstanceIfNecessary(StubSecurityHelper.java:365)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:317)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:294)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:99)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:87)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:71)
- locked <0x0000000129bd5de8> (a weblogic.servlet.internal.StubLifecycleHelper)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:57)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:31)
at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:673)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:612)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:414)
- locked <0x000000012f4e7808> (a weblogic.servlet.internal.ServletStubImpl)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:304)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:120)
at org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:61)
at org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:95)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:113)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3654)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3620)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2423)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2280)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2258)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1626)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1586)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
As far as I can tell, Spring Boot is doing nothing wrong here. Furthermore, given that this works with WebLogic 12.1.3 and several other Servlet/Java EE containers, I think the problem lies in WebLogic 12.2.1 and needs to be taken up with Oracle. Hopefully the stack trace above will help to kickstart that process. I'm going to close this issue for now. If Oracle identify a problem in Spring Boot then we can re-open it.
@wilkinsona Thank you, we will take this to Oracle.
I've updated Oracle SR 3-12394371821 with link to this issue.
'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.
@oyvindhorneland Thanks a lot! Great that they fixed it.
Great news!!! Thanks for your support!
I am getting this error when try to deploy war file , I added package entry in weblogic-application.xml .
net.sf.cglib. * as well. please advise for this error
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.aop.framework.AopConfigException
at net.sf.cglib.asm.$ClassWriter.getCommonSuperClass(Unknown Source)
at net.sf.cglib.asm.$ClassWriter.a(Unknown Source)
at net.sf.cglib.asm.$Frame.a(Unknown Source)
at net.sf.cglib.asm.$Frame.a(Unknown Source)
at net.sf.cglib.asm.$MethodWriter.visitMaxs(Unknown Source)
Truncated. see log file for complete stacktrace
@saravanaperumalpalani as mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements so please do not ask questions here. There is already a thread about this issue on the Weblogic forum.
Most helpful comment
'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.