Greg's Blog

helping me remember what I figure out

Setting Up Additional Instances

| Comments

This assumes that you already have Apache, JRun and one instance up and running. Basically it’s a short (check)list:

  1. create the instance using the JRun Administrator
  2. edit the Apache httpd.conf file and add a new virtual host, restart the web server and test virtual host (see listing 1)
    1. if developing locally you may need to edit your hosts file to reflect the server/host name
  3. copy the default CFusion-ear installation over into the {install path}\JRun4\servers\{instance name}\
  4. delete the default-ear (why they [cfusion and default] share the same root context, which causes conflicts)
  5. start the instance, which will now deploy the CFusion-ear (I prefer the command line over the JMC: {path to JRun}>jrun -start yourInstanceName)
  6. Back to the JMC and remove/un-deploy the Flash Remoting EAR (aka flashgateway.ear) from J2EE components>>Enterprise Applications
  7. Still in the JMC, make a note of the Proxy Port (e.g. 51002), check that Proxy Service is running (on Apache this has a tendency to be set to initialised the first time you fire up JRun, so just click start for the Proxy Service action)
  8. create a folder in {install path}\JRun4\lib\wsconfig (e.g. vh2, but it can be whatever you like)
  9. Add the lines from Listing 2 to your virtual host config, changing the Bootstrap port to reflect the Proxy Service port you just recorded (See Listing 3 for complete listing)
  10. restart apache
  11. restart JRun
  12. test cfml page with code in listing 4, which should reflect the newly created instance name
  13. Next create a separate jvm.config file, where we’ll substitute all references to default cfusion instance with our instance name (listing 5)
  14. Stop and then re-start the JRun instance with the following command: {install path}\JRun4\bin>jrun -start -config {you jvm.config file name} {your instance name}
  15. test this by reviewing the System Information on the CF Administrator the Java Class Path should contain references to your instances server path.
Listing 1

<VirtualHost *>
ServerAdmin yourName@yourDomain.com
DocumentRoot {Path to webroot}/www/{your website folder}/
ServerName www.yourDomain.com
ErrorLog logs/yourDomain.com-error_log
CustomLog logs/yourDomain.com-access_log common
</VirtualHost>

Listing 2

JRunConfig Serverstore “{install path}/JRun4/lib/wsconfig/vh2/jrunserver.store”
JRunConfig Bootstrap 127.0.0.1:51002

Listing 3

<VirtualHost *>
ServerAdmin yourName@yourDomain.com
DocumentRoot {Path to webroot}/www/{your website folder}/
ServerName www.yourDomain.com
ErrorLog logs/yourDomain.com-error_log
CustomLog logs/yourDomain.com-access_log common
JRunConfig Serverstore “{install path}/JRun4/lib/wsconfig/vh2/jrunserver.store”
JRunConfig Bootstrap 127.0.0.1:51002
</VirtualHost>

Listing 4

<cfscript>
jr = CreateObject(“java”,”jrunx.kernel.JRun”);
servername = jr.getServerName();
writeOutput(”

JRun Server Name: ” & servername & ”

”);
</cfscript>

Listing 5

Replace the instance name highlighted in bold with your instance name

#
# 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={Install path}/JRun4/runtime/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//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 -Xbootclasspath/a:”{application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/webchartsJava2D.jar” -XX:MaxPermSize=128m -XX:+UseParallelGC -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS

#
# 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={application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib,{application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/jintegra/bin,{application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/jintegra/bin/international,{application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/_nti40/bin
system.path.first=false

# JVM classpath
java.class.path={application.home}/servers/lib,{application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/cfusion.jar,{application.home}/servers/{yourInstanceName}/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib,{application.home}/lib/jrun.jar,{application.home}/lib