« Did You Hear the News? | Main | A Little Info on the Proxy in 1.5 »

J2EE Application Server Support in Flex

Before the deluge of Max, Zorn, Flex and AS3 postings, let me slip a few thoughts out on J2EE application server support. The below won't even be applicable to the 2.0 alpha, since there isn't a server in alpha quite yet. You'll have to wait until the enterprise offering is in alpha to start thinking about the below. So for now this is simply some lovin for all the 1.5 customers.

I often see questions on support for different J2EE application servers. I spent time on both ColdFusion and Flex trying to get various app servers to work correctly, so I've been interested in this subject.

The first thing to do is to see if your app server is supported. You can see the list of supported servers here. If your app server is in the support app server list, then nothing else should be needed! We have QA'd these app servers and we'll answer support questions on these servers. The only time you may need something else is if you are running on ATG Dynamo, which is available via hotfix.

If your app server isn't supported, make sure to search blogs and flexcoders for known issues, as the few issues that are known have been discussed in multiple places. For instance, JBoss is not officially supported but is often asked about. The only issue I've heard about is answered in this message and in other places.

To expand on the JBoss support issue, something that has come up many times, make sure to turn off the unified class loading behavior for the Flex web applications. You can do this by setting loader-repository in jboss-app, as shown here.

I've generally seen things work for unsupported app servers. Flex is written without any native code, and it doesn't interact with the J2EE APIs too much.

The areas that should be looked out for on unsupported app servers:

a. loading of classes- class loading within Java can be tricky, and even trickier to diagnose. If you see a strange ClassCastException or problems on startup, it could be a class loading issue. We've tried to separate Flex from the rest of the app server via our own class loader, which is why most of the jars are in a "jars" directory rather than in "WEB-INF/lib". There's not much that can be done about this issue by yourself, if you do think something is wrong. You can try copying jars from your app server to the "jars" directory or vise versa, but that's really not recommended, as you're likely to break something else. If you're using the samples server, you can also try replacing or removing the axis.jar from WEB-INF/lib, since this jar has caused problems at certain points.

b. webtier compilation- one of the places we interact with the servlet API is through compilation on server. If you don't see SWFs being compiled correctly but can compile them correctly with mxmlc, then this is the problem. I haven't heard of any problems like this that we haven't fixed, but if you suspect a problem, I would compile with mxmlc and place the SWF on the server. You'll miss out on some things if you do this (JSP tag library, ease of development, etc) but it may allow you to work with an unsupported app server.

c. data services- this refers to using RemoteObject or using WebService and HTTPService with the proxy. It's another place where we interact with the app server through the servlet API. It's hard to diagnose this problem if it's occurring with RemoteObject, but for WebService and HTTPService you can set noProxy to true on the tag to determine whether this is the problem. If you are using HTTPService and having problems receiving data, try setting "flex.addFormParameters" to true as a JVM setting. Other than that, you'll have to set noProxy to true or email on flexcoders for help.

d. data service security- if you're using RemoteObject custom authentication, make sure that your app server is supported. See "resources/security/CustomLoginCommand" within your Flex installation for information on setting up custom authentication on an unsupported app server.

The above are the major areas of concern for using Flex with a given unsupported app server. Again, in general I've seen things work fine for unsupported app servers. It is also often hard to tell if a problem is really an issue just on a given app server, but the above can help narrow down the areas where problems could arise.

Comments (2)

Hi Brian,

Could I consider JOnAS as a supported Application Server due to the fact that it uses a Tomcat servlet container?

Thanks in advance for your help.

Hi Carlos, you'd have to ask Flex support or Flex sales about this, but my guess would be that JOnAS would still be considered unsupported.