Skip to content

Commit

Permalink
solve springboot trace fat test
Browse files Browse the repository at this point in the history
  • Loading branch information
richardherget committed Aug 3, 2023
1 parent cd2b3ae commit 6bf8a19
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

import static componenttest.custom.junit.runner.Mode.TestMode.FULL;

import java.util.Collections;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

Expand All @@ -27,99 +28,14 @@
import componenttest.custom.junit.runner.FATRunner;
import componenttest.custom.junit.runner.Mode;

// Disabled: Failing to start web server.

// org.springframework.context.ApplicationContextException: Unable to start web serve
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578) ~[spring-context-6.0.6.jar:6.0.6
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.4.jar:3.0.4
// at com.ibm.ws.springboot.fat30.test.app.TestApplication.main(TestApplication.java:36) ~[com.ibm.ws.springboot.fat30.app-0.0.1-SNAPSHOT.spring:na
// at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na
// at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na
// at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na
// at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na
// at com.ibm.ws.app.manager.springboot.internal.SpringBootRuntimeContainer.lambda$invokeSpringMain$6(SpringBootRuntimeContainer.java:139) ~[na:na
// at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:247) ~[na:na
// at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na
// at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na
// at java.base/java.lang.Thread.run(Thread.java:857) ~[na:na
// Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomca
// at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:488) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:210) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[spring-boot-3.0.4.jar:3.0.4
// at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-3.0.4.jar:3.0.4
// ... 17 common frames omitte
// Caused by: org.apache.catalina.LifecycleException: A child container failed during star
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:241) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:913) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-3.0.4.jar:3.0.4
// ... 22 common frames omitte
// Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during star
// at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na
// at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// ... 30 common frames omitte
// Caused by: org.apache.catalina.LifecycleException: A child container failed during star
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:846) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na
// at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// ... 30 common frames omitte
// Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@f618ee6e
// at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na
// at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// ... 38 common frames omitte
// Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@f618ee6e
// at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4567) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4700) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na
// at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na
// at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// ... 38 common frames omitte
// Caused by: java.lang.Error: factory already define
// at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1228) ~[na:na
// at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:121) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:52) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:73) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:686) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-10.1.8.jar:10.1.8
// ... 48 common frames omitted

@RunWith(FATRunner.class)
@Mode(FULL)
//@Mode(FULL)
@MinimumJavaLevel(javaLevel = 17)
public class EnableSpringBootTraceTests30 extends CommonWebServerTests {

@Override
public Set<String> getFeatures() {
return Collections.singleton("springBoot-3.0");
return new HashSet<>(Arrays.asList("springBoot-3.0", "servlet-6.0"));
}

@Override
Expand All @@ -143,4 +59,4 @@ public void stopTestServer() throws Exception {
public void testEnableSpringBootTraceFor30() throws Exception {
testBasicSpringBootApplication();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
WebSocketTests30.class,
MimeMapping30.class,
ErrorPage30Test.class,
//EnableSpringBootTraceTests30.class,
// Disabled: Failing to start web server. See the test class for details.
EnableSpringBootTraceTests30.class,
ExceptionOccuredAfterAppIsAvailableTest30.class,
JakartaFeatureTests30.class,
TemplateTests30.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,14 @@ public boolean expectApplicationSuccess() {
return false;
}

// Disabled: The jakarta servlet class is being provisioned even without the servlet feature!
//
// FeatureAuditor: Found [ true ] class [ org.springframework.web.WebApplicationInitializer ] as [ org/springframework/web/WebApplicationInitializer.class ]
// FeatureAuditor: Found [ false ] class [ org.springframework.web.socket.WebSocketHandler ] as [ org/springframework/web/socket/WebSocketHandler.class ]
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version15.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version15/container/LibertyConfiguration.class ]
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version20.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version20/container/LibertyConfiguration.class ]
// FeatureAuditor: Found [ false ] class [ io.openliberty.springboot.support.web.server.version30.container.LibertyConfiguration ] as [ io/openliberty/springboot/support/web/server/version30/container/LibertyConfiguration.class ]
// FeatureAuditor: Found [ false ] class [ javax.servlet.Servlet ] as [ javax/servlet/Servlet.class ]
// FeatureAuditor: Found [ true ] class [ jakarta.servlet.Servlet ] as [ jakarta/servlet/Servlet.class ]
// FeatureAuditor: Found [ false ] class [ javax.websocket.WebSocketContainer ] as [ javax/websocket/WebSocketContainer.class ]
// FeatureAuditor: Found [ true ] class [ jakarta.websocket.WebSocketContainer ] as [ jakarta/websocket/WebSocketContainer.class ]

@Test
public void testMissingServletFor30() throws Exception {
assertNotNull("No error message CWWKC0274E was found for missing servlet feature",
server.waitForStringInLog("CWWKC0274E"));
stopServer(true, "CWWKC0274E", "CWWKZ0002E");
}

// appsecurity-5.0 cannot be added for a seperate test as it contains the servlet-6.0 feature
@Override
public Set<String> getFeatures() {
return Collections.singleton("springBoot-3.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import static componenttest.custom.junit.runner.Mode.TestMode.FULL;
import static org.junit.Assert.assertNotNull;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

Expand All @@ -35,28 +34,32 @@ public boolean expectApplicationSuccess() {
return false;
}

// Disabled: The jakarta web socket class is being provisioned even without the web socket feature!
//
// FeatureAuditor: Found [ true ] class [ org.springframework.web.WebApplicationInitializer ] as [ org/springframework/web/WebApplicationInitializer.class ]
// FeatureAuditor: Found [ true ] class [ org.springframework.web.socket.WebSocketHandler ] as [ org/springframework/web/socket/WebSocketHandler.class ]
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version15.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version15/container/LibertyConfiguration.class ]
// FeatureAuditor: Found [ false ] class [ com.ibm.ws.springboot.support.web.server.version20.container.LibertyConfiguration ] as [ com/ibm/ws/springboot/support/web/server/version20/container/LibertyConfiguration.class ]
// FeatureAuditor: Found [ true ] class [ io.openliberty.springboot.support.web.server.version30.container.LibertyConfiguration ] as [ io/openliberty/springboot/support/web/server/version30/container/LibertyConfiguration.class ]
// FeatureAuditor: Found [ false ] class [ javax.servlet.Servlet ] as [ javax/servlet/Servlet.class ]
// FeatureAuditor: Found [ true ] class [ jakarta.servlet.Servlet ] as [ jakarta/servlet/Servlet.class ]
// FeatureAuditor: Found [ false ] class [ javax.websocket.WebSocketContainer ] as [ javax/websocket/WebSocketContainer.class ]
// FeatureAuditor: Found [ true ] class [ jakarta.websocket.WebSocketContainer ] as [ jakarta/websocket/WebSocketContainer.class ]

@Test
public void testMissingWebsocketFor30() throws Exception {
assertNotNull("No error message CWWKC0275E was found for missing websocket feature",
server.waitForStringInLog("CWWKC0275E"));
stopServer(true, "CWWKC0275E", "CWWKZ0002E");
}

@Test
public void testMissingWebsocketWithSecurity() throws Exception {
assertNotNull("No error message CWWKC0275E was found for missing websocket feature",
server.waitForStringInLog("CWWKC0275E"));
stopServer(true, "CWWKC0275E", "CWWKZ0002E");
}

@Override
public Set<String> getFeatures() {
return new HashSet<>(Arrays.asList("springBoot-3.0", "servlet-6.0"));
HashSet<String> features = new HashSet<>(3);
features.add("springBoot-3.0");
features.add("servlet-6.0");

String methodName = testName.getMethodName();
if ((methodName != null) && methodName.equals("testMissingWebsocketWithSecurity")) {
features.add("appSecurity-5.0");
}

return features;
}

@Override
Expand Down

0 comments on commit 6bf8a19

Please sign in to comment.