Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Edit conf/context.xml like below:
    Code Block
    xml
    xml
    
    <?xml version='1.0' encoding='utf-8'?>
    <Context>
        <!-- definition of DB connection resource -->
        <Resource name="jdbc/mmsql"
        	auth="Container"
        	type="javax.sql.DataSource"
        	driverClassName="net.sourceforge.jtds.jdbc.Driver"
        	url="jdbc:jtds:sqlserver://[server]/[database]"
        	username="[username]"
        	password="[password]"
        	maxActive="8"
        	maxIdle="4"
        />
    
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
    </Context>
    
  • Wiki Markup
    Add the following code in <web-app> tag in webapps/\[your_webapps\]/WEB-INF/web.xml:
    Code Block
    xml
    xml
    
    	<resource-ref>
    		<description>DB connection description</description>
    		<res-ref-name>jdbc/mmsql</res-ref-name>
    		<res-type>javax.sql.DataSource</res-type>
    		<res-auth>Container</res-auth>
    	</resource-ref>
    

...

The next file to edit is also in CATALINA_HOME/conf called web.xml. You will need to find the lines that discuss the _ Common Gateway Includes (CGI) processing servlet_, you can do this by searching for CGI. You will need to uncomment the section below and add the missing parts. Most of it is already filled in by default and is just commented out.

Code Block
xml
xml

<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>executable</param-name>
          <param-value>/usr/bin/python</param-value>
        </init-param>
        <init-param>
          <param-name>cgiPathPrefix</param-name>
          <param-value>WEB-INF/cgi</param-value>
        </init-param>
        <init-param>
        <param-name>passShellEnvironment</param-name>
        <param-value>true</param-value>
        </init-param>
         <load-on-startup>5</load-on-startup>
    </servlet>

Be sure to add the complete path to your python executable. Also, note the cgiPRefixPath. You will need to create a directory inside the WEB_INF folder called cgi and place the proxy.cgi file inside it. Further down in this file you will need to uncomment the following line:

Code Block
xml
xml

<servlet-mapping>
        <servlet-name>cgi</servlet-name>
        <url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>

...

The final step involves setting the proxy host and creating the war file. If you name your war file marketmaker.war this will unzip and create the directory marketmaker which includes a subdirectory called WEB-INF. Inside the WEB-INF directory there should be a directory called cgi that contains the file proxy.cgi. In this case, inside your entry point class where you set the proxy host, you will need to specify the proxy host as "/marketmaker/cgi-bin/proxy.cgi?url=" so that the proxy host is set properly. If we had named the war file client.war, the proxy host would be set as "/client/cgi-bin/proxy.cgi?url=". You can test your proxy by going to the link http://localhost:8080/marketmaker/cgi-bin/proxy.cgiImage Removed if you named the war file marketmaker.war and left the default port for tomcat.