Wednesday, June 13, 2012

How to implement Perl/CGI Scripts in JBoss?

n case if you are using any Perl/CGI application in JBOSS AS [Application Server] its pretty Cool to do this in JBOSS AS. Lets see how to Configure Perl/CGI in JBOSS AS.

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



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.

No comments:

Post a Comment