Glassfish does not take root context from the application

Asked

Viewed 651 times

3

EDIT Guys I managed to solve, I was missing point my application to my virtual server, thank you.

I uploaded an application on the server today and glassfish is not taking the context of the application alone for example to access I’m having to put : www.bla.com/Customer service.

<glassfish-web-app>
<context-root>/Atendimento</context-root>

<parameter-encoding default-charset="UTF-8" />

<property name="alternatedocroot_1" value="from=/backgrounds/* dir=e:\HRatendimento\imagens\" />
<property name="alternatedocroot_2" value="from=/logos/* dir=e:\HRatendimento\imagens\" />
<property name="alternatedocroot_3" value="from=/gerais/* dir=e:\HRatendimento\imagens\" />
<property name="alternatedocroot_4" value="from=/anexos/* dir=e:\HRatendimento\imagens\" />
<property name="alternatedocroot_5" value="from=/usuarios/* dir=e:\HRatendimento\imagens\" />
<property name="alternatedocroot_6" value="from=/licenca/* dir=e:\HRatendimento\" />
<property name="alternatedocroot_7" value="from=/manuais/* dir=e:\HRatendimento\" />

And on the glassfish I left the contextRoot as /Atendimento.

inserir a descrição da imagem aqui

Does anyone have any idea what it might be?

  • Try editing the context root on the console (port 4848). If it doesn’t work take a screen from the settings on the console and show from your glassfish-web.xml (all the content as well as the folder in which it is located). If the goal is to play at the root of the site, just set the context-root to / .

  • @Anthonyaccioly again helping me, so this application worked smoothly, I made this deploy today and it happened, because I did not change these settings

  • I get it. Just so I can help you better. The goal is to eliminate /Atendimento and publish at the root? Or is to stay where you are only some problem is happening?

  • Yes publish at the root

1 answer

3


In Glassfish the synonym for root is /.

You can set this context in several ways:

  1. For configuration files like glassfish-web.xml:

    <glassfish-web-app>
        <context-root>/</context-root>
    </glassfish-web-app>
    
  2. By the administrative console as demonstrated in your question.
  3. For asadmin when publishing your application:

     asadmin deploy --contextroot "/" Atendimento.war
    
  4. From your IDE (there is usually an option to change the context-root in the deploy settings).
  • I switched / Service for only "/" and worked, but he is losing all images :(

  • 1

    There I can not say Wellington, maybe you have fixed resources path in the application. The interesting thing is to always leave them relative and consider the contextPath: e.g., ${pageContext.request.contextPath}/img/logo.png.

  • '<Property name="alternatedocroot_1" value="from=/backgrounds/* dir=e: Hratendimento images" />' this way, but your answer is correct, again thank you, I will try to figure out why you are losing your way.

  • I didn’t mean docroots (but checking if these folders contain the file might help). I believe that within Mark himself the path to his yaks is wrong. E.g., /Atendimento/backgrounds/meufundodetela.jpg. But anyway it’s kick; if you can’t solve it opens a question with the relevant information (folder structures, paths within the generated html, settings, etc.) that I’m sure people discover ;).

  • Just to everyone know I managed to tidy up, was missing point to my virtual service server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.