Goto web.xml of your server by going to the location as $JBOSS_HOME/server/<your-server>/deploy/jboss-web.deployer/conf/web.xml file.
On there you Just Uncomment the <servlet> and <servlet-mapping> for the servlet name cgi, ie you want to uncomment
<servlet> <servlet-name>cgi</servlet-name> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>cgiPathPrefix</param-name> <param-value>WEB-INF/cgi</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> and <servlet-mapping> <servlet-name>cgi</servlet-name> <url-pattern>/cgi-bin/*</url-pattern> </servlet-mapping>then get back a directory means navigate to $JBOSS_HOME/server/<your-server>/deploy/jboss-web.deployer/ directory there you can find context.xml file on there you add the privileged="true" on the root tag itself like,
<Context cookies="true" crossContext="true" privileged="true">.
Then copy the <servlet> and <servlet-mapping> tags to your web.xml in your web Application. But you must change the servlet name cgi to someother.
Goto WEB-INF folder in your application and create a directory called "cgi" put all your perl files in this directory with the extension of .cgi Restart the server.
Now Try to execute your CGI files in the browser.
- You must need to edit the context.xml and set the previleged="true" if not you'll get some security exceptions.
- Also in your web.xmlin your Application you need to change the servlet name cgi to some other else it throws JNDI exception because the cgi is already exists due to web.xml in the server.