The amazing adventures of Doug Hughes

See JRun Run Laszlo

If you haven’t heard of Laszlo, you might be interested in knowing that it’s a free, open source server which generates flash and is similar in nature to Flex. Unfortunately, it didn’t seem like it would run on JRun.

Well, seeing as its open source, I downloaded it and started trying to figure out why it didn’t work. After about two weeks of screwing around with it, I figured out a sequence of steps to get Laszlo up and running under JRun.

The steps below have been reproduced successfully on two separate machines. Another coworker of mine was not able to get this to work and I wasn’t able to help him resolve it. Please, if you try this, know that your mileage may vary! On top of that, remember that JRun is not (yet) a supported deployment platform for Laszlo! I will not be held accountable for what you do, or the results of what you do, with this (or any other) information!

Without further ado, here are the instructions I came up with. Please contribute any additional information in the comments section, if you have any.

  1. Download / Install JRun
  2. Download and extract the Laszlo 3 beta 1 core files. I did to F:downloadsLaszlo Core 3b1. The extraction created a tree of folders under lps-3.0b1-core. One of these folders is lps-3.0b1.
  3. Create a new JRun server named “Laszlo”. Don’t start it. Take note of the HTTP port used. You’ll need to know this later.
  4. Open the folder C:JRun4serversLaszlo and create a new folder called “Laszlo-war” under it
  5. Delete the default-ear folder.
  6. Copy the contents of lps-3.0b1 to C:JRun4serversLaszloLaszlo-war
  7. Under Laszlo-war, open the WEB-INF folder and create a new file named jrun-web.xml. Put the following content into this file and save it:
<!DOCTYPE jrun-web-app PUBLIC "-/Macromedia, Inc./DTD jrun-web 1.0/EN" "http://www.macromedia.com/dtd/jrun-web.dtd">
<jrun-web-app>
<load-system-classes-first>false</load-system-classes-first>
</jrun-web-app>
  1. Find and copy the file xerces.jar into C:JRun4serversLaszloLaszlo-warlib. I found the one I’m using in the source code distribution. I understand that Laszlo can be rather picky about this. I suggest getting the one from the source download.
  2. Open C:JRun4bin
  3. Copy jvm.config to jvm.config_Laszlo
  4. Edit jvm.config_Laszlo in notepad. If you’re using ColdFusion on JRun delete any reference to any ColdFusion or cfusion (and its related settings). For me this was:
    • Remove: -Xbootclasspath/a:”{application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/webchartsJava2D.jar”
    • Remote everything after the “=” on the java.library.path= line.
    • Three paths with cfusion in them from the class path.
    • You may have others. Get rid of them!
  5. Make these additional changes to the jvm.config_Laszlo file:
    • Add {application.home}/servers/Laszlo/Laszlo-war/WEB-INF/lib as the FIRST entry on the java.class.path line of jvm.config_Laszlo.
    • Then, move the {application.home}/lib from the end of the line to the second element.
  6. My jvm.config_Laszlo ended up looking like as follows. Note, that some lines are shown wrapping. These are not line breaks. Also note, don’t just copy and paste this. Use this as a reference for your file. I broke another server by just copying this. Just make the changes suggested above and use this as a reference.
# VM configuration
#
# Where to find JVM, if {java.home}/jre exists then that JVM is used
# if not then it must be the path to the JRE itself
java.home=C:/JRun4/jre
#
# If no java.home is specified a VM is located by looking in these places in this
# order:
#
# 1) bin directory for java.dll (windows) or lib/<ARCH>/libjava.so (unix)
# 2) ../jre
# 3) registry (windows only)
# 4) JAVA_HOME env var plus jre (ie $JAVA_HOME/jre)
#
# Arguments to VM
java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=128m -XX:+UseParallelGC
#
# commas will be converted to platform specific separator and the result will be passed
# as -Djava.ext.dirs= to the VM
java.ext.dirs={jre.home}/lib/ext
#
# where to find shared libraries
java.library.path=
system.path.first=false
#
# set the current working directory - useful for Windows to control
# the default search path used when loading DLLs since it comes
# before system directory, windows directory and PATH
java.user.dir={application.home}/../lib
# JVM classpath
java.class.path={application.home}/servers/Laszlo/Laszlo-war/WEB-INF/lib,{application.home}/lib,{application.home}/servers/lib,{application.home}/servers/lib
  1. To use the config file you just created, you will need to create a window service and tell it to use the config file. To do this, open a command prompt and go to c:jrun4bin. Type:
    jrunsvc -install Laszlo "Laszlo" "Laszlo" -config jvm.config_Laszlo
    

    This will install the Laszlo server as a service. When the service starts up it will use the config file we just created.

  2. Start the Laszlo service from the services control panel. Note, you actually need to not start Laszlo from the JRun interface. For it to work correctly you must use the services control panel. (I think.)
  3. Navigate to http://localhost:8101/Laszlo-war/index.html (Note, use the HTTP port you noted when we got started and created the server).

Hooking into IIS

To hook Laslo into IIS via JRun follow these instructions:

  1. Run the Web Server Configuration Tool. This will open a small window listing all your current configurations.
  2. Click Add
  3. In the new window select the JRun server to connect to. In this case “Laszlo”.
  4. Select the IIS website to connect to from the drop down list. Note: I was able to get both CF and Laszlo to run via different JRun instances on the same IIS entry.
  5. Do not check Configure web server for ColdFusion MX applications.
  6. Click advanced.
  7. Click the Use Application Mappings radio button. Type in .lzx (to the right of the add button) and click add.
  8. Click ok.
  9. Click ok again. You’ve now configured IIS to send requests for lzx files to JRun and Laszlo for processing. There’s a gotcha, though. Laszlo doesn’t quite work correctly with IIS.
  10. To correctly complete the configuration open the IIS admin and find the site you just connected JRun to. Add a virtual directory in the root of the site named Laszlo-war. Map this to C:JRunserversLaszloLaszlo-war.
  11. Place any .lzx files you need into the C:JRunserversLaszloLaszlo-war directory. You can now access them via http://yourservername.com/Laszlo-war/yourfile.lzx and all will work! Woo hoo!

I will see what I can find out about how .lzx work so they can be placed right into your webroot.

Comments on: "See JRun Run Laszlo" (7)

  1. Thanks for this info! Running Laszlo 3.0b1 with JRun 4 on Mac OSX 10.3.8 with Java 1.4.2 now 🙂 Had some troubles finding xerces.jar because it doesn’t come with the core distribution but only with the source. so this was also quite helpful:

    &quot;- JRun does not come with xerces.jar, it uses something else in its place.
    Copy xerces.jar from the lps-3.0b1-src3rdpartyjing-20030619bin directory
    to the JRunServersLaszloLaszlo-warWEB-INFlib folder. Because you set
    the load-system-classes-first to false in the jrun-web.xml, JRun will load
    this first and get past the first big problem that ususaly crops up with
    JRun.&quot;

    Like

  2. Doug Hughes said:

    Thijs, I’m very glad I could help someone!! There’s a wiki at http://openlaszlo.org/wiki/LaszloWithJrun. I’m sure it would benifit some people if you were to add some of your own notes and experiances.

    Like

  3. Does anyone know how to get JRun to handle .lzo files via its Apache Connector?

    I get this error:
    &quot;JRun will not accept request. Check JRun web server configuration and JRun mappings on JRun server.&quot;

    How and where do I edit said files?

    Like

  4. Michael said:

    Have you ever tried this setup with the 3.0 final release and the JRun provided with cfmx 7 (with coldusion intergrated instance management)??

    I’m getting strange errors, and I just can’t find a way to get it correct… :-S

    Thanks in advance for any help!

    Like

  5. Doug Hughes said:

    Michael – I havn’t tried the offical version 3 on JRun. To be honest, I haven’t had much of a chance to even USE Laszlo since getting it running.

    Sorry!

    Like

  6. Michael said:

    No problem, hopefully Laszlo can have a look at it :)…

    Like

  7. first, although i haven’t tried this, some people might find it helpful.

    you can try to connect the jrun server running laszlo to apache using a similar method as with coldfusion. in the httpd.conf file, add these lines:

    LoadModule jrun_module &quot;C:/JRun4/lib/wsconfig/1/mod_jrun20.so&quot;
    &lt;IfModule mod_jrun20.c&gt;
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ssl false
    JRunConfig Ignoresuffixmap false
    JRunConfig Serverstore &quot;C:/JRun4/lib/wsconfig/1/jrunserver.store&quot;
    #change the bootstrap port based on server settings#
    JRunConfig Bootstrap 127.0.0.1:51020
    #JRunConfig Errorurl &lt;optionally redirect to this URL on errors&gt;
    #JRunConfig ProxyRetryInterval 600
    #JRunConfig ConnectTimeout 15
    #JRunConfig RecvTimeout 300
    #JRunConfig SendTimeout 15
    AddHandler jrun-handler .jsp .lzx
    &lt;/IfModule&gt;

    If you are hooking more than 1 JRun server to Apache, I think you need make some adjustments to the &quot;serverstore&quot; directory (i think make a dir called &quot;2&quot;). macromedia has an article about this relating to running multiple coldufion server instances on jrun, but i can’t remember the url.

    also, you might want to change the context root for LPS to &quot;/&quot; from &quot;Laszlo-war&quot;, but remember that only one web app can have the / root.

    i’m having a problem where jrun will run the .lzx app with mixed success, but on startup i get this error:
    error Could not pre-load servlet: JSPServlet
    follows by some java stack trace info.

    Can anyone help?

    Like

Comments are closed.

Tag Cloud