0

What is the class that is executed at the start of a JAVA EE WildFly project?

I know it's a very beginner question. But I have a gigantic project to study and I can not determine where the system starts. It is a Java EE project in WildFly.

  • Probably none. Or several. Typical Java EE web applications don't "start". They are deployed, and the application server instanciates and initializes the servlets, EJBs, etc. that are declared in the application. These objects are then ready to serve requests, jobs, etc. running in the application. In short, there is no main. – JB Nizet Jul 17 '19 at 17:37

2 Answers2

0

There should be a web.xml file in the project. Start there, it will have a list of servlets and other web resources. The servlets will have mappings to classes. The start of the execution of a request will start in the web methods of that class (e.g. doGet, doPost, etc.).

For example:

<servlet>
    <servlet-name>MyServlet</servlet-name>
    <servlet-class>com.mycompany.myproject.MyServletImpl</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/DoSomething</url-pattern>
</servlet-mapping>

You can also have code executed when a web application is deployed as described here: Using special auto start servlet to initialize on startup and share application data

John
  • 3,458
  • 4
  • 33
  • 54
0

Web applications don't have a main; the 'program' that is running is actually the web container (Apache Tomcat, Glassfish, JBoss, Weblogic, Wildfly in your case) and that program will service the web application(s) you deploy into it. You might want to read the JEE tutorial to learn and understand what a Java web environment is.

https://docs.oracle.com/javaee/7/tutorial/

From: Why don't I see any main method in this java dynamic web project?