Skip to content

ColdFusion / JBoss Issue – “class file has wrong version 49.0, should be 48.0″

While playing with a Remote Proxy example in ColdSpring 2 tonight in my previously mentioned CF9/JBoss setup I ran into the error below:

"Error","http-127.0.0.1-8080-2","01/05/12","22:39:39","coldspring-remote-example","coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler: /home/andrew/cfdev/jboss-5.0.1.GA/server/devserver/deploy/cfusion.ear/cfusion.war/WEB-INF/cfusion/stubs/WS-316894903/coldfusion/xml/rpc/CFCInvocationException.java:10: cannot access java.rmi.RemoteException bad class file: /usr/java/jdk1.6.0_26/jre/lib/rt.jar(java/rmi/RemoteException.class) class file has wrong version 49.0, should be 48.0 Please remove or make sure it appears in the correct subdirectory of the classpath. public class CFCInvocationException  extends org.apache.axis.AxisFault  implements java.io.Serializable {        ^ 1 error . The specific sequence of files included or processed is: /home/andrew/cfdev/jboss-5.0.1.GA/server/devserver/deploy/cfusion.ear/cfusion.war/examples/quickstart/remote/index.cfm, line: 20 "
coldfusion.server.ServiceRuntimeException: coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler: /home/andrew/cfdev/jboss-5.0.1.GA/server/devserver/deploy/cfusion.ear/cfusion.war/WEB-INF/cfusion/stubs/WS-316894903/coldfusion/xml/rpc/CFCInvocationException.java:10: cannot access java.rmi.RemoteException
bad class file: /usr/java/jdk1.6.0_26/jre/lib/rt.jar(java/rmi/RemoteException.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class CFCInvocationException  extends org.apache.axis.AxisFault  implements java.io.Serializable {
       ^
1 error
.
  at coldfusion.xml.rpc.XmlRpcServiceImpl.registerWebService(XmlRpcServiceImpl.java:319)
  at coldfusion.xml.rpc.XmlRpcServiceImpl.getWebService(XmlRpcServiceImpl.java:496)
  at coldfusion.xml.rpc.XmlRpcServiceImpl.getWebServiceProxy(XmlRpcServiceImpl.java:450)
  at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:449)
  at cfindex2ecfm1931456168.runPage(/home/andrew/cfdev/jboss-5.0.1.GA/server/devserver/deploy/cfusion.ear/cfusion.war/examples/quickstart/remote/index.cfm:20)
  at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
  at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
  at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722)
  at cfApplication2ecfc135565788$funcONREQUEST.runFunction(/home/andrew/cfdev/jboss-5.0.1.GA/server/devserver/deploy/cfusion.ear/cfusion.war/examples/quickstart/remote/Application.cfc:22)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
  at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
  at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
  at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
  at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
  at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
  at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:88)
  at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:280)
  at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:356)
  at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
  at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
  at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
  at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
  at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
  at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
  at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
  at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
  at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
  at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
  at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
  at coldfusion.CfmServlet.service(CfmServlet.java:200)
  at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
  at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  at java.lang.Thread.run(Thread.java:662)
Caused by: coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler: /home/andrew/cfdev/jboss-5.0.1.GA/server/devserver/deploy/cfusion.ear/cfusion.war/WEB-INF/cfusion/stubs/WS-316894903/coldfusion/xml/rpc/CFCInvocationException.java:10: cannot access java.rmi.RemoteException
bad class file: /usr/java/jdk1.6.0_26/jre/lib/rt.jar(java/rmi/RemoteException.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class CFCInvocationException  extends org.apache.axis.AxisFault  implements java.io.Serializable {
       ^
1 error
.
  at coldfusion.jsp.JavaCompiler.compileClass(JavaCompiler.java:152)
  at coldfusion.xml.rpc.XmlRpcServiceImpl$2.run(XmlRpcServiceImpl.java:294)
  at java.security.AccessController.doPrivileged(Native Method)
  at coldfusion.xml.rpc.XmlRpcServiceImpl.registerWebService(XmlRpcServiceImpl.java:270)
  ... 55 more

I had this example running fine in CF9 on JRun / Windows 7 previously so at first I thought this must be something specific to my JBoss install.

After a bit of searching, I found a post on the Adobe Forms that helped me understand what was going on.

It seems there is a file “tools.jar” in ColdFusion’s WEB-INF/cfusion/lib dir which is incompatible with the JDK I was running (Oracle JDK 1.6.0_26). I replaced this file with the tools.jar from <JAVA_HOME>/lib and restarted my server and the problem went away.

I’m not exactly sure why this file was incorrect in my JBoss install – (the file was 4.9M in size as opposed to 13M in the new version), but I thought I’d share this workaround in case it helps anyone else, or I need to refer to it later.

Tagged , ,

Adobe ColdFusion 9 on JBoss

A long time between blog posts but I thought this was worthy of a quick one.

I’m using Fedora 16 as my workstation at the moment, and because of some difficulties I encountered when running Adobe ColdFusion 9 on JRun, I decided to give JBoss a try.

I downloaded JBoss and CF9 and followed the instructions for Deploying ColdFusion 9 on JBoss Application Server and fairly quickly had a working system.

Then I wanted to patch it with the awesome Unofficial Updater 2 but realised first I needed to install ColdFusion 9 Updater 1 to get to 9.0.1.

After downloading the updater, I attempted to run it against my exploded war, deployed at <JBOSS_HOME>/server/cfusion/deploy/cfusion.ear/cfusion.war however the updater failed to complete, giving the message “Selected EAR/WAR archive is invalid”.

The work around this, I logged into the ColdFusion Administrator, and under the Packaging & Deployment -> J2EE Archives was able to export my current project as a war file, which I could then patch with Updater 1, and redeploy. After that, the Unofficial Updater ran fine, brining me up to the current Hotfix.

I thought I’d share this in case it helps someone down the track, or I need to refer back to it.

Tagged , , , ,

Adobe CS4 and ColdFusion Builder 2 on Linux with Wine

Below is a brief overview of how I was able to get Adobe CS4 and Adobe ColdFusion Builder 2 working (somewhat) on Linux with Wine.  My distro is OpenSUSE 11.4 (64bit) and the wine version is 1.3.12 (running in 32bit mode – export WINEARCH=win32 to ensure it runs in this mode).  Note that I had installed these products in Windows 7 first, and then copied them in to wine.  I believe there are problems with running the installers under wine.

Install winetricks

See http://wiki.winehq.org/winetricks for details

Use winetricks to install dependencies:

  winetricks msxml6 gdiplus gecko vcrun2005 allfonts atmlib

Install CS4

copy c:/Windows/WinSxS to ~/.wine/drive_c/windows/
copy c:/Users/All Users/Application Data/Adobe/ to /.wine/drive_c/users/Public/Application Data/
copy c:/Users/All Users/Application Data/FLEXnet/ to /.wine/drive_c/users/Public/Application Data/

copy c:/Program Files/Adobe to ~/.wine/drive_c/Program Files/
copy c:/Program Files/Common Files/Adobe to ~/.wine/drive_c/Program Files/Common Files/
copy c:/Program Files/Common Files/Macrovision Shared to ~/.wine/drive_c/Program Files/Common Files/

In Windows use regedit registry export

  • HKEY_LOCAL_MACHINE\SOFTWARE\Adobe – save this as adobe.reg
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FLEXnet Licensing Service – save this as flexnet.reg

Back in Linux import these keys:

  wine regedit adobe.reg
  wine regedit flexnet.reg

You should now be able to launch apps as follows:
  cd ~/.wine/drive_c/Program\ Files/Adobe/Adobe\ Photoshop
  wine Photoshop.exe

ColdFusion Builder

On my Windows machine I had  ColdFusion Builder installed as an Eclipse Plugin.  After copying the Adobe stuff as described above, I was able to run ColdFusion builder by taking the following steps.

1. Download & Install the Oracle JDK

2. Copy the eclipse install directory to wine, in my case:

copy C:\eclipse\installs\cfbuilder to ~/.wine/drive_c/eclipse/installs

Now run it as follows:

  cd ~/.wine/drive_c/eclipse/installs/cfbuilder/
  wine eclipse.exe

You may also need to edit the eclipse.ini, in particular to reduce the size of the -Xms argument (perhaps to something like 90m).

I have not tried advanced usage such as debugging, configuring servers, etc.

ISSUES:

  1. When opening any of the apps a dialog appears saying something has crashed.  Dismiss it and you should be able to continue
  2. In ColdFusion Builder when you open an existing file, the editor consists of mostly a grey screen with a tiny editor view.  Double click the file in the tab bar to maximise it and the file will appear correctly.

Credits:

Most of this is a collation of information I found elsewhere – notably:

http://appdb.winehq.org/objectManager.php?sClass=version&iId=14318
http://ubuntuforums.org/showthread.php?t=944034&page=9
http://appdb.winehq.org/appview.php?iVersionId=5523

Managing CF Dependencies with Maven

I’m currently working on integrating some Java components with a ColdFusion app.  As I investigated trying to integrate them it quickly became obvious that I needed some way of managing the various dependencies the Java components required.

As handling Java dependencies is a problem that has already been taken care of by Maven, I began to look at how I could use maven with my CF project to package up my custom CF code, third party CF libraries (eg. Fw/1), and the various Java dependencies.

There has been an option to deploy ColdFusion as a war file since CF7, and that looked like a good place to start.  However to further complicate things I found that I needed to modify the web.xml to add in various servlet filters and listeners.

After searching the web I found a couple of articles from various people who had successfully integrated ColdFusion and Maven:

http://stackoverflow.com/questions/1326154/using-maven-for-coldfusion-project

http://maximporges.blogspot.com/2007/09/build-tools-maven-and-coldfusion.html

These were excellent resources, but didn’t answer all my questions.  The second article listed above hinted at building a war deployment, but there was no example on how to do this.

Eventually I stumbled upon Maven Overlays which the Maven site describes as follows:

“Overlays are used to share common resources across multiple web applications. The dependencies of a WAR project are collected in WEB-INF/lib, except for WAR artifacts which are overlayed on the WAR project itself.”

This sounded like exactly what I was after.  In this case, Adobe CF is the common resource which needs to be “overlayed” on my Custom CF code.

So how could I get this to work?

The first thing I needed to do was to package CF as a WAR.  I did this via the “J2EE Configuration / WAR File” option in ColdFusion installer (I was using Windows, but I assume this option is available on all platforms).

Using the CF installer to create a WAR file

I then needed to get this WAR file into Maven.  We use Artifactory, so I deployed it there.  However if you don’t use Artifactory you can install it into your local repository using the following command:

mvn install:install-file -DgroupId=com.adobe.coldfusion -DartifactId=coldfusion -Dpackaging=war -Dversion=9.0.1 -Dfile=c:/coldfusion/cfusion.war -DgeneratePom=true

Now that ColdFusion is installed, we can use it as a maven artifact.

Next we create a new maven web project:

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

This will create a directory called “my-webapp” with the empty layout.  To add coldfusion to this project, edit the pom.xml file and add coldfusion as a dependency.  Your pom.xml should now look like this:

 
xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd”>
4.0.0
com.mycompany.app
my-webapp 

war 1.0-SNAPSHOT
my-webapp Maven Webapp

http://maven.apache.org

junit
junit
3.8.1
test
 
com.adobe.coldfusion
coldfusion
9.0.1
war
runtime

false 

my-webapp

Now you can build your project with the mvn package command. This will create a war file which can be then deployed to tomcat.

The nice thing about the overlay method is that if you specify resources in your project, they won’t be replaced by those in the dependency. So I use this to ensure my datasources and other coldfusion settings remain customised. To do this, navigate in your project to src/main/webapp/WEB-INF and create a cfusion directory, and a lib directory inside that. Copy into this directory the neo*.xml and *.properties files from a configured CF install which contain your custom modifications.

So my project now looks like this:


.
|-- pom.xml
|-- src
|   |-- main
|   |   |-- java
|   |   |-- resources
|   |   `-- webapp
|   |       |-- META-INF
|   |       |-- WEB-INF
|   |       |   |-- cfusion
|   |       |   |   `-- lib
|   |       |   |       |-- adminconfig.xml
|   |       |   |       |-- license.properties
|   |       |   |       |-- neo-archivedeploy.xml
|   |       |   |       |-- neo-clientstore.xml
|   |       |   |       |-- neo-comobjmap.xml
|   |       |   |       |-- neo-cron.xml
|   |       |   |       |-- neo-datasource.xml
|   |       |   |       |-- neo-debug.xml
|   |       |   |       |-- neo-document.xml
|   |       |   |       |-- neo-document_1.xml
|   |       |   |       |-- neo-dotnet.xml
|   |       |   |       |-- neo-drivers.xml
|   |       |   |       |-- neo-event.xml
|   |       |   |       |-- neo-graphing.xml
|   |       |   |       |-- neo-logging.xml
|   |       |   |       |-- neo-mail.xml
|   |       |   |       |-- neo-metric.xml
|   |       |   |       |-- neo-monitoring.xml
|   |       |   |       |-- neo-probe.xml
|   |       |   |       |-- neo-registry.xml
|   |       |   |       |-- neo-runtime.xml
|   |       |   |       |-- neo-runtime_1.xml
|   |       |   |       |-- neo-search.xml
|   |       |   |       |-- neo-security.xml
|   |       |   |       |-- neo-solr.xml
|   |       |   |       |-- neo-watch.xml
|   |       |   |       |-- neo-xmlrpc.xml
|   |       |   |       `-- password.properties
|   |       |   |-- lib

Any custom cf files you create can go in the webapp dir. Try putting an index.cfm file in there, do another mvn package and redeploy. It should work.

Packaging and re-packaging is a nuisance obviously. I got around this by mapping the “target” dir in tomcat, and then I can just use the mvn war:exploded command when I’ve made any changes, and they should immediately show up in Tomcat. If anyone is interested in more info leave a comment and I’ll post some further infomat.

So that’s a fair bit of hard work. You might be starting to wonder what the point of it all is? Well now I will show you two cool things that will hopefully convince you that this is worth the effort.

Want to change CF engines in your project? No problem. Download railo as a war file from http://www.getrailo.org/. Add it to your maven repository:

mvn install:install-file -DgroupId=org.railo -DartifactId=railo -Dpackaging=war -Dversion=3.1.2.001 -Dfile=c:/Downloads/railo-3.1.2.001.war -DgeneratePom=true

Edit your pom.xml and replace the adobe coldfusion dependency with the railo one:



org.railo
railo
3.1.2.001
war
runtime

false

 

Clean and repackage:


mvn clean
mvn package

You now have a war file containing railo and your custom code. (in case you’re wondering Railo’s datasources and other customisations are kept in WEB-INF/railo/railo-web.xml.cfm).

Finally, you can use maven to manage dependencies like Framework One. To do this, you need to package fw1 as a maven artifact. Here’s one I prepared earlier. Unzip it, cd into the fw1 directory and use the following commands to install it to your repository:


mvn package
mvn install:install-file -DgroupId=org.corfield -DartifactId=fw1 -Dpackaging=jar -Dversion=1.2RC2A -Dfile=fw1-1.2RC2A.jar -DgeneratePom=true

How we can add FW/1 to our project by modifying the pom.xml again. Here’s the new pom.xml

 
xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd”>
4.0.0
com.mycompany.app
my-webapp 

war 1.0-SNAPSHOT
my-webapp Maven Webapp

http://maven.apache.org

junit
junit
3.8.1
test
 
org.railo
railo
3.1.2.001
war
runtime

false 
org.corfield
fw1
1.2RC2A
provided

 
${project.artifactId}

org.apache.maven.plugins
maven-dependency-plugin

unpack 

package
unpack

org.corfield
fw1
1.2RC2A
jar
true
${project.build.directory}/${project.artifactId}
**/*.cfc

**/*.cfc
${project.build.directory}/${project.artifactId}
false

 

 

 

Notice the use of the build plugins here. What that stuff does is to expand the contents of the fw1 jar file – coldfusion won’t read them from the packaged jar file. I also have ensured the jar’ed file does not get copied into WEB-INF/lib by using the “provided” scope in the pom.xml

Now we can repackage as usual:


mvn clean
mvn package

Now we have a war that includes railo and fw/1 which we can now develop with.

One advantage this gives is that if we want to upgrade FW/1, we can install the new version into maven, change our pom.xml to reference the new version and repackage.

I am sure this solution is not for everyone, but if you happen to be using maven anyway for Java you may find this useful. Please feel free to leave any comments, questions below.

Tagged ,

iBatis and ColdFusion

One of my colleagues has been writing Java web apps using Spring, Struts and the iBatis Data Mapper.

A lot of his code would be very useful to use in my ColdFusion apps, so I wanted to find out if there was a way to integrate ColdFusion and iBatis.

Back in July 2006, Charlie Arehart blogged about this possibility however as far as I am aware no-one provided a working solution.

However with the help of Mark Mandel’s Javaloader, and a blog post on integrating ColdFusion and Spring from Kevan Stannard I have been able to put together a demo of iBatis and ColdFusion working together.

My sample app code can be downloaded from http://www.abm.id.au/downloads/cfibatisdemo.zip

To get this to work you need to download a few dependencies:

Once you’ve downloaded these extract them to an appropriate place in your file system (I put them all at c:javadev).  Then update the build.xml in my sample app to reference where you put these libraries.  You should also ensure ant is on your path.

You will also need to set up a sample database and connection to run this demo.  A mysql script is included in the db/ directory of the sample code.

Setting up the database connection is a bit more complicated.  My solution was to set up a datasource using JNDI.  I have ColdFusion 8 installed in a multiserver config so this had to be set up in the JRun Management Console.

The following screenshot shows the settings I used to create this datasource.  Note that I had to change the MySQL Driver Class Name from the default to get it to work with MySQL 5.x.  Also note that you will need to update web/beans.xml to use the correct name you give this datasource.

JNDI Datasource settings

If you are using another server, you will need to check your app server documentation to find out how to set up a JNDI datasource in your environment.

A couple of gotcha’s I found with the JNDI datasource are that if the database is not running when you start the server, it doesn’t seen to initialise the datasource correctly.  Similarly if the database is stopped and restarted, I found you need to restart the JRun server to get things working again.  Obviously this would be a problem in a production environment, and needs further investigation.

Finally to get things up and running you need to install Javaloader into your ColdFusion root directory or create an appropriate mapping.

Then build the sample app by issuing the command following command in the directory where you extracted the sample code:

ant dist

You can then copy the contents of the /dist dir from the sample app over to your ColdFusion server, and run the sample.

Please feel free to leave comments on this post if you have any problems or suggestions.

Tagged

Railo on JBoss (Multi-site configuration)

Earlier this year Sean Corfield blogged about a “multi-web” install of Railo on Tomcat.

I decided to see if I could set up a similar configuration on JBoss 5.1.0 and was able to do it successfully by following Sean’s steps with a few modifications. These modifications are documented below.

My solution also includes some ideas I learnt from this blog post – http://help.shadocms.com/blog/2009/running-railo-and-adobe-coldfusion-on-the-same-context-root-in-jboss.cfm

Firstly, I took a copy of the jboss “web” instance and named it railo, ie:

copy /server/web to /server/railo

This will become our railo server instance.

NB: is the directory where I installed JBoss – in my case c:/jboss/jboss-5.1.0.GA

Now I started following Sean’s instructions. The first issue I ran into was when I came to edit the conf/catalina.properties file. I could not find the JBoss equivalent (there may be one, but I just couldn’t find it). However I found that by putting the Railo JARs into /server/railo/lib this had the same effect.

Next Sean mentioned editing the Tomcat conf/web.xml file. The corresponding JBoss file to edit is:

/server/railo/deployers/jbossweb.deployer/web.xml

At this point we we can start the server and have a look at the server administrator. To do this (on windows at least) go into the command prompt, cd to and run this command:

bin\run -c railo

Once it starts up, you can then browse to http://localhost:8080/railo-context/admin.cfm to view the Railo Server Administrator.

After confirming it runs, stop it again (I just use CTRL-C to stop the JBoss instances – there may be a cleaner way but I am not aware of it).

The next thing in JBoss that differs from the Tomcat instructions is adding your new host definitions. In Tomcat this is done in conf/server.xml, but in JBoss 5.1.0 it is done in /server/railo/conf/bootstrap/profile.xml.

The change I made to this file is shown below:

<!--
 The profile configuration
 This contains required properties:
 The uri to jboss-service.xml.
 The uri to the deployers folder.
 A list of uris to deploy folders. -->
 <bean name="BootstrapProfileFactory">
 <property name="bindingsURI">${jboss.server.home.url}conf/bindingservice.beans</property>
 <property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
 <property name="deployersURI">${jboss.server.home.url}deployers</property>
 <property name="applicationURIs">
 <list elementClass="java.net.URI">
 <value>${jboss.server.home.url}deploy</value>
<span style="color: #ff0000;"> <value>file:///C:/www/railo-deploy</value></span>
 </list>
 </property>
 <property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
 <property name="profileFactory"><inject bean="ProfileFactory" /></property>
 </bean>

Note that this is a URI, so it must include file:/// (this caught me out on my first attempt). How I did this was to create a directory called c:/www/railo-deploy, then in that directory create new directories called web1.war and web2.war

Next (borrowing from the ShadoCMS blog) /server/railo/deploy/jbossweb.sar/server.xml to have two more nodes:

 <Host name="web1.local">
 <Alias>web1.local</Alias>
 </Host>

 <Host name="web2.local">
 <Alias>web2.local</Alias>
 </Host>

The final piece of the puzzle was then to create a web.xml and jboss-web.xml in each of the WEB-INF dirs, ie:

c:/www/railo-deploy/web1.war/WEB-INF/web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
 <display-name>Web App 1</display-name>
 <description>
 Railo Web 1
 </description>
</web-app>

c:/www/railo-deploy/web1.war/WEB-INF/jboss-web.xml
<jboss-web>
<context-root>/</context-root>
<virtual-host>web1.local</virtual-host>
</jboss-web>

c:/www/railo-deploy/web2.war/WEB-INF/web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
 <display-name>Web App 2</display-name>
 <description>
 Railo Web 2
 </description>
</web-app>

c:/www/railo-deploy/web2.war/WEB-INF/jboss-web.xml
<jboss-web>
<context-root>/</context-root>
<virtual-host>web2.local</virtual-host>
</jboss-web>

All going well you should now have a working multi-web setup in JBoss.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 Australia License.

Tagged , ,

Railo 3 on JBoss 5

Railo 3 will not run on JBoss 5 without some modifications, as some of the packaged jars conflict with the jars in Jboss’s classpath.  The error reported is similar to that below:


2009-09-07 20:20:09,354 ERROR [org.jboss.web.tomcat.service.deployers.JBossContextConfig] (main) XML error parsing: context.xml
org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:100)
at org.jboss.web.tomcat.service.deployers.JBossContextConfig.processContextConfig(JBossContextConfig.java:549)
at org.jboss.web.tomcat.service.deployers.JBossContextConfig.init(JBossContextConfig.java:536)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5436)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)

One solution (which seems to work perfectly) is to remove the offending jars from <railo_home>/WEB-INF/lib, as described here:

http://coldshen.com/blog/index.cfm/2008/8/2/Running-Railo-3-beta-on-JBoss-5

An alternative solution, is to create a file named jboss-classloading.xml and place this into <railo_home>/WEB-INF.  The contents of the file should be similar to that shown below:

&lt;classloading xmlns="urn:jboss:classloading:1.0"
name="railo.war"
domain="railo_Domain"
export-all="NON_EMPTY"
import-all="false"&gt;
&lt;/classloading&gt;

More details are available from the JBoss wiki -  http://www.jboss.org/community/wiki/useJBossWebClassLoaderinJBoss5

Tagged , ,