I know for any restful web service the packaging should be in .war format so that it can be delpoyed to any servlet container eg: tomcat or jetty. Currently i am working in some project and I cannot see any file with a .war extensio. All i see is a .jar file and i guess the jar is itself getting deployed. I want to understand how and why it is working.
2 Answers
It can be something else but, right now, the most obvious explanation I can think of is that your application is using one of the java frameworks designs to help to build web applications, like Spring Boot or Dropwizard. These frameworks pack their own webserver and they generate a .jar
when packaged to be able to run them easily on containers or everywhere is needed. Spring Boot usually uses Tomcat and Dropwizard uses Jetty for example.
Java Web project is packaged or deployed as a jar package because it is packed in jar package. Like spring boot, Tomcat or underlow or jetty are embedded in the jar package. java -jar is used The command starts the container from the main method entry of a main startup class, then initializes the container and loads the web project related resources.
you can get demo quickly by spring boot :https://spring.io/projects/spring-boot