0

My current glassfish application can be accessed using this url

localhost:9595/apex

I want to change it to

localhost:9595/pls/apex

what i need change in this case.

Jigar Parekh
  • 595
  • 10
  • 23

2 Answers2

4

You can change the context-root for your application by adding a context-root in glassfish-web.xml (If you don't have this file in your project, create it in the WEB-INF folder) like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
    <context-root>/pls/apex</context-root>
</glassfish-web-app>

Update: If this doesn't work you can try to use a sun-web.xml like it is described in this question.

Community
  • 1
  • 1
unwichtich
  • 13,712
  • 4
  • 53
  • 66
  • @unwichtoch i create jlassfish-web.xml in my current WEB-INF folder and put above code but it gives error only..This techniq don't work – Jigar Parekh Apr 27 '13 at 07:45
  • The requested resource () is not available. i tried using both ways sun-web.xml and glassfish-web.xml inside WEB-INF what changes i need – Jigar Parekh Apr 29 '13 at 09:03
  • I am trying to do the same.. what I did is to change the folder name in glassfish\domains\domain1\autodeploy\ path. I edit here my project it was Project1_war to enterprise_war and now I can access like http://localhost:8080/enterprise/ – smeerkahoven Aug 03 '18 at 07:06
3

Alternatively to using the descriptior glassfish-web.xml you can explicitly definde the context root at deploy time by using the --contextroot switch of asadmin:

asadmin deploy --contextroot="/pls/apex" apex.war

or fill the appropriate context root field in the admin console.

Markus
  • 569
  • 2
  • 4
  • 18
  • @unwichtoch, Markus i used both ways but glassfish gives following error, thanx for your reply ..please give me solution java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response – Jigar Parekh Apr 29 '13 at 07:26