Personal tools

LaszloWithJrun

From OpenLaszlo

Contents

How do I deploy Laszlo apps using the JRun application server?

These instructions were originally posted by Doug Hughes on the http://www.openlaszlo.org/pipermail/laszlo-dev/2005-January/000495.html OpenLaszlo mailing list]. They were also published to his Blog

Disclaimer

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!

Configure JRun

  • Download / Install JRun
  • Download and extract the Laszlo 3 beta 1 core files. I did to F:\downloads\Laszlo Core 3b1\. The extraction created a tree of folders under lps-3.0b1-core. One of these folders is \lps-3.0b1.
  • 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.
  • Open the folder C:\JRun4\servers\Laszlo and create a new folder called "Laszlo-war" under it
  • Delete the default-ear folder.
  • Copy the contents of \lps-3.0b1 to C:\JRun4\servers\Laszlo\Laszlo-war
  • 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>
  • Find and copy the file xerces.jar into C:\JRun4\servers\Laszlo\Laszlo-war\lib. 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.
  • Open C:\JRun4\bin
  • Copy jvm.config to jvm.config_Laszlo
  • 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!
  • 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.
  • 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
  • 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:\jrun4\bin. 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.
  • 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.)
  • 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:

  • Run the Web Server Configuration Tool. This will open a small window listing all your current configurations.
  • Click Add…
  • In the new window select the JRun server to connect to. In this case "Laszlo".
  • 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.
  • Do not check Configure web server for ColdFusion MX applications.
  • Click advanced.
  • Click the Use Application Mappings radio button. Type in .lzx (to the right of the add button) and click add.
  • Click ok.
  • 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.
  • 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:\JRun\servers\Laszlo\Laszlo-war.
  • Place any .lzx files you need into the C:\JRun\servers\Laszlo\Laszlo-war directory. You can now access them via http://yourservername.com/Laszlo-war/yourfile.lzx and all will work! Woo hoo!

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