Thursday, April 6, 2017

To Change Context name in PRPC in Tomcat

Sometimes we will be having many application  or environment URLs like Dev, SIT, UAT and Prod. With URL it will be difficult to find, so we can change the name of the context to identify it easily.

Or sometimes, in same tomcat, we might need to deploy two different Pega PRPC Apps, then we need to change the context of the application.

Say our URL is 
http://localhost:8089/prweb/PRServlet

Need to change this URL to:
http://localhost:8089/<<context name>>/<<App name>>
http://localhost:8089/Test/app


If we want to change context to different name like our application name, then below steps need to follow.

Step 1:
In tomcat folder, Tomcat/webapps we will deploy our "prweb.war" once we start our tomcat, "prweb" folder will get created. Stop the tomcat and then rename the folder to <<context name>>, "Test" as in this case. 

Step 2:
In new renamed, folder under WEB-INF folder, web.xml u can find it.
in this case Tomcat_home/webapps/Test/WEB-INF/web.xml

Step 3:
In web.xml, search with PRServlet name, find the exact match and replace that string with the <<App Name>>, in this case "app".

Before editing:
<servlet-mapping>
                <servlet-name>WebStandard</servlet-name>
                <url-pattern>/PRServlet</url-pattern>
         </servlet-mapping>
<servlet-mapping>
<servlet-name>WebStandard</servlet-name>
<url-pattern>/PRServlet/*</url-pattern>
</servlet-mapping> 

After editing:
<servlet-mapping>
<servlet-name>WebStandard</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WebStandard</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>

Step 4:
Start the Tomcat Again and try with the new URL.

No comments:

Post a Comment