qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qexo-general] Servlets from the cgi-bin wrapper - some suggested fixes


From: Eric Safern
Subject: [Qexo-general] Servlets from the cgi-bin wrapper - some suggested fixes and a question
Date: Mon, 23 Dec 2002 19:14:32 -0800

Hi,

I'm really excited about the potential for xquery and qexo - it's a
really expressive language! Thanks for developing this code!!

I'm trying to run a short program (that works well from the command line)
as a servlet.

It's working fine from within Tomcat, but I've had trouble with the cgi
wrapper.

Firstly, I suggest you fix a few minor problems with the docs, to save the
next guy some heartache.

Reference: http://www.gnu.org/software/kawa/CGI-scripts.html

<quote>
Then copy the resulting .class files to your server's CGI directory. On Red
Hat GNU/Linux, you can do the following (as root):


cp hello*.class /var/www/cgi-bin/

Next find the cgi-servlet program that Kawa builds and installs. If you
installed Kawa in the default place, it will be in
/usr/local/bin/cgi-servlet. (You'll have this if you installed Kawa from
source, but not if you're just using Kawa .jar file.) Copy this program into
the same CGI directory:


cp /usr/local/bin/cgi-servlet /var/www/cgi-bin/

You can link instead of copying:


ln -s /usr/local/bin/cgi-servlet /var/www/cgi-bin/

However, because of security issues this may not work, so it is safer to
copy the file. However, if you already have a copy of cgi-servlet in the
CGI-directory, it is safe to make a hard link instead of making an extra
copy.

Make sure the files have the correct permissions:


chmod a+r /var/www/cgi-bin/hello*.class /var/www/cgi-bin/hello
chmod a+x /var/www/cgi-bin/hello
</quote>

You suggest copying the *.class files and the cgi-servlet program into the
web server's cgi-bin.  No problem so far.

Then you mention checking the permissions.

But what's this file /var/www/cgi-bin/hello?  You only said to copy in
hello*.class.

I don't have an executable file produced when I compile my .xql file - only
a .class file.

You then say we should run <http://localhost/cgi-bin/hello> - but, again,
there's no
such program to be found.

So I studied the source code, and figured out this is what you wanted to
say:

<revisedquote>
cp /usr/local/bin/cgi-servlet /var/www/cgi-bin/hello

You can link instead of copying:


ln -s /usr/local/bin/cgi-servlet /var/www/cgi-bin/hello

However, because of security issues this may not work, so it is safer to
copy the file. However, if you already have a copy of cgi-servlet in the
CGI-directory, it is safe to make a hard link instead of making an extra
copy.

Make sure the files have the correct permissions:


chmod a+r /var/www/cgi-bin/hello*.class /var/www/cgi-bin/hello
chmod a+x /var/www/cgi-bin/hello
</revisedquote>

Then, I tried running 'hello' from the command line, only to
get the following message:

<quote>
KAWALIB does not specify a readable .zip/.jar file: No such file or
directory
</quote>

I traced that down to a problem with the Makefile in the bin directory - it
had
prefix = /usr/local hard-wired.  I don't know if this running a make install
would
solve that - I'm not ready to do that without a careful study of all of the
Makefiles.

I changed the reference to KAWALIB to point to something better for me:

$ diff Makefile Makefile.bak
132c132
< WITHOUT_GCJ_DEFS = -DJAVA='"$(JAVA)"' -DKAWALIB='"/home/esafern/lib/kawa-
$(VERSION).jar"'
---
> WITHOUT_GCJ_DEFS = -DJAVA='"$(JAVA)"' -DKAWALIB='"$(datadir)/java/kawa-$(
VERSION).jar"'
$

This is, I'm sure, only a partial solution.

At that point, the cgi wrapper works from the command line (whew! :-)

>From http, however, different story - 500 internal server error.

A perusal of the error log file yields:

<quote>

JFC: wam_match request 0812d828
Warning: Major version number mismatch.
Warning: Major version number mismatch.
Warning: Minor version number mismatch.
Warning: Major version number mismatch.
<snip ~100 lines>
java.lang.StackOverflowError
        at java.lang.String.toCharArray(String.java:line unknown, pc 0x817b
f5c)
        at java.io.PrintWriter.write(PrintWriter.java:116)
        at gnu.xml.XMLPrinter.writeChar(XMLPrinter.java:77)
        at gnu.xml.XMLPrinter.write(XMLPrinter.java:253)
        at java.io.PrintWriter.write(PrintWriter.java:116)
        at gnu.xml.XMLPrinter.writeChar(XMLPrinter.java:77)
        at gnu.xml.XMLPrinter.write(XMLPrinter.java:253)
        at java.io.PrintWriter.write(PrintWriter.java:116)
        at gnu.xml.XMLPrinter.writeChar(XMLPrinter.java:77)
        at gnu.xml.XMLPrinter.write(XMLPrinter.java:253)
        at java.io.PrintWriter.write(PrintWriter.java:116)
        at gnu.xml.XMLPrinter.writeChar(XMLPrinter.java:77)
        at gnu.xml.XMLPrinter.write(XMLPrinter.java:253)
<snip ~15000 lines>
        at gnu.xml.XMLPrinter.write(XMLPrinter.java:253)
        at java.io.PrintWriter.write(PrintWriter.java:116)
        at gnu.xml.XMLPrinter.writeChar(XMLPrinter.java:73)
        at gnu.xml.XMLPrinter.write(XMLPrinter.java:253)
        at java.io.PrintWriter.write(PrintWriter.java:82)
        at gnu.xml.XMLPrinter.beginGroup(XMLPrinter.java:119)
        at gnu.lists.TreeList.consumeRange(TreeList.java:841)
        at gnu.lists.TreeList.consumeNext(TreeList.java:787)
        at gnu.xml.XMLPrinter.writeObject(XMLPrinter.java:192)
        at gnu.lists.FilterConsumer.writeObject(FilterConsumer.java:93)
        at gnu.kawa.xml.HttpPrinter.writeObject(HttpPrinter.java:161)
        at gnu.xquery.util.ValuesFilter.apply(ValuesFilter.java:60)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:239)
        at gnu.mapping.CallContext.run(CallContext.java:283)
        at gnu.kawa.servlet.KawaServlet.doGet(KawaServlet.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:66)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:57)
        at gnu.kawa.servlet.CGIServletWrapper.main(CGIServletWrapper.java:4
0)
[Mon Dec 23 10:47:33 2002] [error] [client 69.254.179.166] Premature end of
 script headers: /var/www/cgi-bin/GetFortune

</quote>

The version mismatch error I've seen before - it's probably because somehow
the cgi wrapper is using a different version of Java than used to compile
the jar file - but I don't know why that would be.

Any thoughts?


                                Thanks,

                                Eric Safern






reply via email to

[Prev in Thread] Current Thread [Next in Thread]