Search code examples
javaservletsjarweb-fragment

Given a JAR file, allegedly contains web server, how do I deploy it?


I've been handed a JAR file, told it contains a web application, and instructed to deploy it. I'm familiar with java as a language, but I have next to no experience with its web ecosystem. Trying to run it as an executable, I find out it has no main class, so I take a look at the contents, and find that it has a META-INF/web-fragment.xml file, along with a couple of Servlet classes and some config files referenced in the xml. It looks like there is basically everything here for a complete application, but I have no idea how to actually deploy it, and google only yields tutorials on how to build these things from scratch with IDEs and deploy using maven plugins and goals.

Assuming that building from source is out of the question and I only have standard unix and java CLI tools available, based on the information provided (And I can provide more if necessary), what is the simplest way to get this up and running?


Solution

  • A web applicaton should be in a WAR file, not a JAR file, and you should only need to just drop it into the webapp directory of your Tomcat, or follow the instructions for whatever other container you're using.

    If it's only a fragment, as appears from the XML, (a) it isn't a webapp, only part of one, and (b) you personally can't deploy it at all. You need the whole thing.

    Send the assignment back for clarification.