Search code examples
javaweb-servicesjakarta-eemavenglassfish-3

How to access a directory in maven web application (java)


I'm working in a Maven web application (Java), Glassfish as web server. I have a directory for example path = Application_name/src/main/webapp. But I need to access the directory as http:///localhost:8080/webapp. Do I need some configuration for this in my application or in Glassfish or some other configurations?


Solution

  • You configure the port in glassfish directly. 8080 is the default port. See here if you want to change: https://blogs.oracle.com/openroad/entry/changing_default_glassfish_port_numbers.

    For the name (webapp), it happens in your web.xml. Add this:

    >     <context-param>
    >         <param-name>webAppRootKey</param-name>
    >         <param-value>webapp</param-value>
    >     </context-param>