PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Trying to use search.cgi on JBoss AS7 fails

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to use search.cgi on JBoss AS7 fails

    Hello,

    I need help to get the search running on a JBoss Server AS7. The Onlinehelp including the search files were packed in a war file and deployed on the JBoss Server. When entering a search frase, I get the error message in log JBoss server log file

    2016-01-19 14:36:00,437 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/pps/doc].[cgi]] (http-/0.0.0.0:8080-53) J
    BWEB000236: Servlet.service() for servlet cgi threw exception: java.io.IOException: Cannot run program "" (in directory "D:\XXX\PpsJBossServ
    er\standalone\tmp\vfs\temp\temp2e7c27cdb7659e0b\co ntent-664d2533e55f61db\html-Help\search"): CreateProcess error=87, Wrong Parameter

    If I host the same onlinehelp files on a tiny web server, the search works.

    Is it known wheter the search CGI is running in JBoss AS7? I need to deploy it together with a web application there.

  • #2
    How to setup Tomcat to run search CGI?

    This is the URL used to obtain the search results (the root was slightly changed from above post):

    Code:
    "http://localhost:8080/pps/doc/cgi-bin/search.cgi?product=pps&version=rel&language=de&zoom_query=Order&zoom_per_page=200"
    Which results in this Error:
    2016-01-20 19:56:05,879 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/pps/doc].[cgi]] (http-/0.0.0.0:8080-170) JBWEB000236: Servlet.service() for servlet cgi threw exception: java.io.IOException: Cannot run program "" (in directory "D:\PPS\PpsJBossServer\standalone\tmp\vfs\temp\tem p3e434703579ac9c4\doc-onlinehelp-0.5.8a.war-11b0550eaec6c5b5\cgi-bin"): CreateProcess error=87, WrongParameter
    web.xml was setup as follows:
    Code:
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
    		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    		 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    		 id="pps-onlinehelp" version="3.0">
    	<servlet>
    		<servlet-name>cgi</servlet-name>
    		<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    		<init-param>
    			<param-name>debug</param-name>
    			<param-value>10</param-value>
    		</init-param>
    		<init-param>
    			<param-name>cgiPathPrefix</param-name>
    			<param-value>cgi-bin</param-value>
    		</init-param>
    		<init-param>
    			<param-name>executable</param-name>
    			<param-value></param-value>			 
    		</init-param>
    		<load-on-startup>5</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>cgi</servlet-name>
    		<url-pattern>/cgi-bin/*</url-pattern>
    	</servlet-mapping>
    </web-app>

    Comment


    • #3
      We don't test on JBoss Servers and we're not familiar with it. But we have had users report success on them previously, although not necessarily with AS7.

      First thing you should check is that you have selected the correct platform to match your server. E.g. Linux or Windows. Judging by your file paths, I presume the server is Windows based, in which case you should select in Zoom, "Configure"->"Start options"->"Platform"->"CGI"->"Windows".

      You said it worked on a tiny web server -- can you tell us if this web server is hosted on the same machine, or a different one?
      --Ray
      Wrensoft Web Software
      Sydney, Australia
      Zoom Search Engine

      Comment


      • #4
        Thanks for your reply.

        Platform was set correctly, since search worked with tiny under Windows 7 64 Bit OS. Nevertheless, today I could get it running.

        I needed to understand, that the search parameters are transfered via environment variables like QUERY_STRING, as you do it in your native sample code for making use of the search.cgi.
        The "interface" is probably laid down in the GATEWAY_INTERFACE=CGI/1.1 specification. The CGIServelet prepares the envirenment suitable, before the call.

        This web.xml worked for me.


        Code:
        <web-app xmlns="http://java.sun.com/xml/ns/javaee"
        		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        		 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        		 id="pps-onlinehelp" version="3.0">
        	<servlet>
        		<servlet-name>cgi</servlet-name>
        		<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
        		<init-param>
        			<param-name>debug</param-name>
        			<param-value>10</param-value>
        		</init-param>
        		<init-param>
        			<param-name>cgiPathPrefix</param-name>
        			<param-value>cgi-bin</param-value>
        		</init-param>
        		<init-param>
        			<param-name>executable</param-name>
        			<param-value>search.bat</param-value>			 
        		</init-param>
        		<load-on-startup>5</load-on-startup>
        	</servlet>
        	<servlet-mapping>
        		<servlet-name>cgi</servlet-name>
        		<url-pattern>/cgi-bin/*</url-pattern>
        	</servlet-mapping>
        </web-app>
        Second, some kind of executable to start the CGI was required. I used a batch file named search.bat for that.

        One line with a simple %1 ist sufficent in this batch.

        Sinse I didn't know how the call is done, I used for testing this batch search.bat which produces a log in the same folder where the batch ist stored.

        Code:
        @echo off
        set CurrentPath=%~dp0
        echo ============================================ >> %CurrentPath%searchlog.txt
        echo Search executed from JBoss >> %CurrentPath%searchlog.txt
        date /T >> %CurrentPath%searchlog.txt
        time /T >> %CurrentPath%searchlog.txt
        echo %1 %2 %3 %4 >> %CurrentPath%searchlog.txt
        if '%1'=='' exit 1
        %1 %2 %3 %4
        Third, I found how the CGIServlet searches for this executable by using the process monitor and placed the batch file to an appropriate place.
        I stored the batch file in the JBossServer\bin folder, which was one of the frist where the Search for this file happens. The CGIServlet passes the location of the search.cgi to this batch which receives it in %1 parameter and just executes this file.

        Thats it.

        If you or someone else has hints for improvemenst, you are welcome to post them.

        Comment

        Working...
        X