I have one jar file with set of Servlets
, Filters
and a web-fragment.xml
file defined inside META-INF
folder. I'm including this jar in my second war project. The war project has the web.xml with metadata-complete=false
, and I'm using gradle to build the project.
If I deploy the war in to a standalone servlet container Jetty or Tomcat, it finding the web-fragment.xml correctly and the webpages are loading properly. But this is not happening when I do the Jetty setup myself for integration testing.
The Jetty APIs I used is given bellow,
_server = new Server(8080);
_server.setStopAtShutdown(true);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setParentLoaderPriority(true);
webAppContext.setResourceBase("src/main/webapp");
_server.setHandler(webAppContext);
_server.start();
By default the WebAppContext
class using the following configurations, from that I can see FragmentConfiguration
is there.
public static final String[] DEFAULT_CONFIGURATION_CLASSES =
{
"org.eclipse.jetty.webapp.WebInfConfiguration",
"org.eclipse.jetty.webapp.WebXmlConfiguration",
"org.eclipse.jetty.webapp.MetaInfConfiguration",
"org.eclipse.jetty.webapp.FragmentConfiguration",
"org.eclipse.jetty.webapp.JettyWebXmlConfiguration"
} ;
Why it's not working when I'm using the Jetty APIs myself, Am I missing any classpath / classloader related configuration here or something else ? please help me to find it out.
Thank you.