Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying spring boot web sample, from war, to EAR, to websphere 8 using eclipse

I have created a web project using maven and imported it into eclipse. Then, I executed the command on cmd >> mvn spring-boot:run, the server (embedded tomcat) is starting fine and able to show my pages on browser. However, I have no idea why it failed after deploying it on websphere 8. Something must have went wrong in between the deployment or due to missing config, I guess.. (I do not know! >.<)

I have tried many solutions online, reading documentation, rebuilding samples over samples but nothing seems to work. I can't upload anything to show here thanks to my company's security policy (cant even access google drive due to network security). But follow the steps should be close enough to reproduce my case (I did try this MANY TIMES but it failed and I do not know why! sorry I am frustrated)

Here is what I am using:

  • Eclipse Kepler
  • Websphere Application Server v8.0
  • Java 6
  • maven
  • Spring-boot 1.4.1.RELEASE

Just to cut the long story short:

  1. download the sample web project
  2. unzip and import it to eclipse as existing maven project
  3. open cmd, cd to the project directory (where you can see the pom.xml)
  4. issue command: "mvn package", upon successful packaging, issue command: "mvn spring-boot:run" and open [localhost:8080] on your browser. You should be able to see a dummy webpage.

I can get to this point for most samples found online but here comes the trouble

  1. create an EAR Application Project
  2. Open the server tab in eclipse and add the EAR project to WebSphere Application Server v8. Here have an error: [Cannot add an EAR project to the server unless it contains a Web, EJB, or Connector module.] first issue

Then I found this link [http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-servlet-2-5], which I guess I need a web.xml for the project. I created a new file web.xml under /webapp/WEB-INF and copied and pasted the whole codes from the #howto-servlet-2-5 page. Is this correct??

  1. Now the EAR can be added to Websphere Application Server v8.0, go to the (WAS) admin console, select a virtual host for this project, saved and I restart the server.

  2. Open [localhost:8080] on web browser. You will see the page is now broken with this errorlog. second issue

Recap:

  1. Must I need a web.xml to order to deploy EAR to WAS8? If yes, what should I write in there? Please ref to the documentation/#howto-servlet-2-5 page and please tell me what I need to re-configure.

  2. Given the errorlog below, can someone explain why it is happening and what can I do to solve this?

I hope to see answer that gives a step by step actions from maven spring-boot web project (given a war file), to EAR, and deploy to WAS 8.

Your constructive and practical answer is appreciated.

Ps. Yes, I have to use EAR and WAS8 and Java6 due to company legacy. Please do not suggest anything that divert from the technology that is being mentioned.

errorlog

[10/14/16 12:03:13:246 SGT] 00000015 SystemOut     O 2016-10-14 12:03:13.246  INFO 1948 --- [    Default : 2] com.ibm.ws.webcontainer.webapp           : SRVE0292I: Servlet Message - [testUploadEAR#testUpload.war]:.Initializing Spring FrameworkServlet 'appServlet'
[10/14/16 12:03:13:247 SGT] 00000015 SystemOut     O 12:03:13.246 [Default : 2] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
[10/14/16 12:03:13:257 SGT] 00000015 SystemOut     O 12:03:13.256 [Default : 2] ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
java.lang.IllegalStateException: No WebApplicationContext found: initializer not registered?
    at org.springframework.web.servlet.FrameworkServlet.findWebApplicationContext(FrameworkServlet.java:594)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549)
    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:161)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1366)
    at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:618)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:587)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:421)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:746)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1165)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1369)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:967)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:771)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1362)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2163)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:607)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5468)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5594)
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:565)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1252)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69)
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272)
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1152)
    at java.security.AccessController.doPrivileged(AccessController.java:298)
    at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
    at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1146)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:999)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783)
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
    at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
    at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
    at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
    at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
    at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
[10/14/16 12:03:13:257 SGT] 00000015 SystemOut     O 2016-10-14 12:03:13.257 ERROR 1948 --- [    Default : 2] c.i.w.w.servlet.ServletWrapper           : Uncaught.init.exception.thrown.by.servlet
[10/14/16 12:03:13:265 SGT] 00000015 SystemOut     O 2016-10-14 12:03:13.264 ERROR 1948 --- [    Default : 2] com.ibm.ws.webcontainer.webapp           : SRVE0266E: Error occured while initializing servlets: {0}

javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:404) ~[com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168) ~[com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1366) ~[com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:618) ~[com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:587) ~[com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:421) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:746) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714) [com.ibm.ws.webcontainer.jar:na]
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1165) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1369) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:967) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:771) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1362) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2163) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:607) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5468) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5594) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:565) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1252) [com.ibm.ws.runtime.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) ~[na:1.6.0]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
    at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69) [na:1.6.0]
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
    at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272) [na:1.6.0]
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1152) [na:1.6.0]
    at java.security.AccessController.doPrivileged(AccessController.java:298) [na:na]
    at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30) [na:2.6 (04-09-2014)]
    at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41) [na:1.6.0]
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1146) [na:1.6.0]
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:999) [na:1.6.0]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847) [na:1.6.0]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783) [na:1.6.0]
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) [com.ibm.ws.admin.core.jar:na]
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) [bootstrap.jar:WAS80.SERV1 [cf091421.01]]
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) [com.ibm.ws.admin.core.jar:na]
    at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181) [com.ibm.ws.admin.core.jar:na]
    at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247) [com.ibm.ws.admin.core.jar:na]
    at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360) [com.ibm.ws.admin.core.jar:na]
    at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602) [com.ibm.ws.admin.core.jar:na]
    at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702) [com.ibm.ws.runtime.jar:na]
Caused by: java.lang.IllegalStateException: No WebApplicationContext found: initializer not registered?
    at org.springframework.web.servlet.FrameworkServlet.findWebApplicationContext(FrameworkServlet.java:594) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at javax.servlet.GenericServlet.init(GenericServlet.java:161) ~[javax.j2ee.servlet.jar:na]
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342) ~[com.ibm.ws.webcontainer.jar:na]
    ... 62 common frames omitted
like image 759
terencefung Avatar asked Jan 01 '26 19:01

terencefung


1 Answers

Alright here is the complete setup for a spring boot application to be ran on WebSphere with servlets 2.5. (At least what I'm running)

pom.xml

set your packaging to war

<packaging>war</packaging>

add these 2 dependencies

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-legacy</artifactId>
    <version>1.0.2.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

and have the spring boot plugin

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Spring Boot Application Class

Make sure that your main class extends SpringBootServletInitializer and override the method shown below.

@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(CustomerSignupServerApplication.class);
    }
}

web.xml

Make sure your web.xml is setup like below and the context-param section is pointing to the class annotated with @SpringBootApplication

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         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/web-app_2_5.xsd">

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>com.demo.DemoApplication</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
    </listener>

    <filter>
        <filter-name>metricFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>metricFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextAttribute</param-name>
            <param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

</web-app>

finally

When you package the application through maven by running mvn clean package it will build 2 WAR files: application.war and application.war.original the latter is what your going to want to take and package into an EAR.

like image 79
ndrone Avatar answered Jan 03 '26 09:01

ndrone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!