This is what I had to do to get WASP working on my Windows NT SP4 machine (PO).

Java

JDK

I have Symantec Visual Cafe 1.1 installed, this appears to be based on JDK 1.1.3, which worried me occasionally, but seemed to work fine. I did try installing and compiling with JDK 1.1.7a, which is a doddle to install.

 

 

Servlet Runner

JRun

I decided to use the JRun221 RC2, as some of the bug reports on the site pointed to 2.1 having problems on NT. The RC2 has nicer set-up screens, although some of the admin guis don't work.

 

Installation

I ran the install .exe, and accepted the defaults, and chose IID/PWS as the web server to install a connector for.

The installation instructions stated that I could see the JRun server on it's own port (ie http://myserver:8081). I never managed to get this to work.

 

Web server

IIS4.0

 

Installation

The first thing I had to do to get anything to work was to go into the Microsoft Management Console and set up the filter for JRun. I would have imagined that this would be done by the install program, but nevermind.

Select the properties tag of the site you want to get JRun working for, Chose "ISAPI filters" from the tab frame, chose Add, call the filter anything and select jrun.dll in your /scripts directory.

This should now allow you to run, for example: http://myserver/servlet/HelloWorldServlet. Horray. This works, because all web server requests are now checked through jrun.dll. jrun.dll is set up to look for /servlet/ directories, and filters them out and runs them itself.

You also need to set up the following Application mappings, choose the "Home Directory". Select the "configuration" button, and add application mappings for .shtml, .wasp and .jrun, all map to jrun.dll.

My .shtml file looks like this:

<servletcode=HelloWorldServlet>
</servlet>

This will launch the HelloWorldServlet from any web server directory.

.jrun files map directly to the servlet .class files, so from anywhere on the web server, you should be able to enter http://myserver/anywhere/HelloWorldServlet.jrun and it will launch

I found it slightly confusing that the actual servlets have to live deep in the Jrun application tree:

Z:\Program Files\JRun\2.2\jsm-default\services\jse\servlets

And have messed about with 'multi-homing' which allowed me to map the servlets back to a /servlet directory, but this got even more confusing (and didn't work too great), so I stopped.

 

 

Database

JDBC:ODBC

sun.jdbc.odbc.JdbcOdbcDriver comes with the JDK, so I didn't have to do anything. For testing I just messed around with the ODBC datasources I had already set up.

 

 

WASP

Installation

 

I unpacked the source files into Z:\Program Files\JRun\2.2\jsm-default\services\jse\servlets, and compiled them there.

 

Compilation

 

In order to get the debug to work with input parameters (see later), I made a small fix to org\wasp\engine\servlet.java, moving line 121:

 Debug.init(config);

up the code to line 77, this means the debug is initialised before it is called first time.

I had to add z:\Program Files\JRun\2.2\lib\jrun.jar;z:\Program Files\JRun\2.2\lib\jrunadmin\swing.jar; to my CLASSPATH (in VC, this is in Z:\Program Files\VisualCafe11\Bin\sc.ini).

I created a new project in VC, and added all java files in the wasp tree to it.

There was one error because one of the .javas is a test of the Oracle JDBC driver (would be nice ...) but it can safely be ignored.

Configuration

You have to tell WASP where its templates live and what the predefined data sources are. That's done in the JRun file jrun/2.2/jsm-default/services/jse/properties/servlets.properties. I added the lines

servlet.wasp.args=filePath=z:\\www\\,errorPage=wasp\\error.html,daoFoo=uk.co.paneris.Foo,debugFile=services\\jse\\logs\\wasp.log,debugLevel=9
servlet.wasp.code=org.wasp.engine.Servlet
servlet.wasp.preload=true

You can try and do this using the gui administration interface, but it's very buggy, and you are best off changing the config files.

This tells JRun that wasp is an alias for the servlet org.wasp.engine.Servlet with the given arguments filePath. Also it sets up a very useful debug file.

It will look for templates in z:\www; and throw out z:\www\wasp\error.html if an error occurs. My error file simply said "<h1>Error</h1>. I imagine that you can actually get good error information back, but I don't know how yet.

To get JRun to pass .wasp files through WASP you add the line

  *.wasp=wasp
to jrun/2.2/jsm-default/services/jse/properties/rules.properties. It's possible also to run it from a /servlet/wasp URL, much like /cgi-bin/..., but WASP doesn't react very sensibly to that.

Building Something

Here is my test page z:\www\wasp\hello.wasp:

  <HTML>
  <BODY>

  <tl:DATA name="FooName">
  <tl:INPUT name="method">Bar</tl:INPUT>
  <P>It's &BAR;</P>
  </tl:DATA>

  </BODY>
  </HTML>
This means ``Ask for the data access object which registered itself at WASP startup with name FooName'' (which my test DAO Foo does). ``Call its daoBar method to get the result set. Show the column named bar from each row.'' (The &BAR; has to be in capitals.)

Here is the source for

Foo, shamelessly borrowing from his JDBCTest example:

This goes in Z:\Program Files\JRun\2.2\jsm-default\services\jse\servlets\uk\co\paneris, and should compile without difficulty.

  package uk.co.paneris;

  import org.wasp.data.*;
  import org.wasp.engine.*;
  import java.util.*;
  import javax.servlet.*;
  import java.sql.*;

  public class Foo extends DataAccessObject {

    private Statement s;

    public String getName() { return "FooName"; }

    public void init(ServletConfig config) {
      try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

        Connection conn = DriverManager.getConnection("jdbc:odbc:iglu");
        s = conn.createStatement();
      }
      catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException();
      }

      DataRegistry.getInstance().registerDataAccessObject(this);
    }

    public boolean initialized() { return true; }

    public RowResultSet daoBar(Hashtable h, Request r, MarkupNode m) {
      try {
        return new SqlRowResultSet(s.executeQuery("SELECT tablename FROM datadictionarytables"));
      }
      catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException();
      }
    }
  }

Running It

You need to sort out your JRun classpath to include swing, in:

Z:\Program Files\JRun\2.2\jsm-default\properties\jsm.properties

change java.args line so it reads:

java.args=-noasyncgc -mx32m -cp classes;..\\classes;..\\lib\\jrun.jar;..\\examples\\jni;..\\lib\\jrunadmin\\swing.jar  

Now you can start JRun.

Z:\Program Files\JRun2\2.2\jsm-default\services\jse\logs\error.log

will let you know weather everything is starting up correctly. It should look something like:

Wed Dec 02 14:40:56 GMT 1998: JRun Library v2.2.1 build 1
Wed Dec 02 14:40:56 GMT 1998: JRun Properties Dir: z:\program files\JRun\2.2\jsm-default\services\jse\properties

If this has no errors, should should be able to look at:

Z:\Program Files\JRun\2.2\jsm-default\services\jse\logs\wasp.log, which should look something like:

Debugging started
initializing the WASP...
Creating TagletRegistry
Registering taglet: once
Registering taglet: param
Registering taglet: cycle
Registering taglet: block
Registering taglet: session
Registering taglet: foreach
Registering taglet: switch Registering taglet: data
Creating DataRegistry
Registering taglet: input
The WASP is using CLASSPATH=classes;..\classes;..\lib\jrun.jar;..\examples\jni;..\lib\jrunadmin\swing.jar;z:\program files\JRun\2.2\jre\1.1\lib\rt.jar;z:\program files\JRun\2.2\jre\1.1\lib\i18n.jar;z:\program files\JRun\2.2\jre\1.1\lib\classes.zip;z:\program files\JRun\2.2\jre\1.1\classes
Started PageCage()
Registering DataAccessObject: FooName,uk.co.paneris.Foo@25ad77
1 DAOs in hash: 2468934
WASP initialized
If things look good here, open your browser, and load hello.wasp, if this doesn't work, come back to the debug file and see what happened.