This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with calling Kawa from servlet




What is the proper way of executing arbitrary Scheme expressions from Java 
servlets? I keep getting

java.lang.ArrayIndexOutOfBoundsException
	at gnu.mapping.ValueStack.find(ValueStack.java:15)
	at gnu.lists.TreeList.writeObject(TreeList.java:426)
	at gnu.mapping.Values.writeValues(Values.java:192)
	at gnu.mapping.CallContext.writeValue(CallContext.java:302)
	at gnu.mapping.Procedure.apply(Procedure.java:129)
	at gnu.mapping.CallContext.runUntilDone(CallContext.java:239)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:189)
	at kawa.lang.Eval.evalBody(Eval.java:84)
	at kawa.lang.Eval.evalBody(Eval.java:38)
	at kawa.standard.Scheme.eval(Scheme.java:756)
	at kawa.standard.Scheme.eval(Scheme.java:734)
	at kawa.standard.Scheme.eval(Scheme.java:739)
	at ...schemetest.doGet(schemetest.java:18)

after a few calls to eval(). The servlet is below, is there something 
fundamentally wrong with it? (It runs fine the first few times and then dies.)

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import kawa.standard.Scheme;

public class schemetest extends HttpServlet 
{
    protected void doGet(HttpServletRequest req,
			 HttpServletResponse res)
	throws ServletException, IOException
    {
	res.setContentType("text/html");
	PrintWriter out = res.getWriter();
	Scheme scm = new Scheme();
	Object x = scm.eval("(+ 3 2)");
	out.println(x);
	x = scm.eval("(+ 7 2)");
	out.println(x);
	x = scm.eval("(+ 19 " + "28)");
	out.println(x);
	out.close();
    }

    public void init(ServletConfig config) throws ServletException {
	super.init(config);
    }

    public String getServletInfo() {
	return "schemetest by ola";
    }
}
-- 
Ola Rinta-Koski  ola@cyberell.com  +358 41 467 2502
Cyberell Oy      http://www.cyberell.com/




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]