Steven Erat's Blog Steven Erat Photography
 
 
Viewing By Entry
 
 

TalkingTree  Flex Samples on Tomcat

 

I re-ghosted a Windows box today, so I decided to set up Macromedia Flex with Apache Tomcat. Shooting from the hip, I just unzipped the Flex samples.war file into Tomcat's webapps directory with all the other web applications. Initially excited to see if everything would just work right out of the box with no further configurations, I launched the Flex Samples Explorer application. The application compiled, and the main Explorer interface loaded. However, the Hello World mini-app, which is the first one to load by default, threw a pop-up alert for:

HTTPService Fault
Internal Server Error

A quick look at {Tomcat}/webapps/samples/WEB-INF/flex/logs/flex.log revealed a somewhat unhelpful message in the log because Flex debugging features were not enabled. The message, repeated once for every time I clicked on a mini-app in the Explorer, was:

ERROR %%500%%Internal Server Error

Well, I needed more to go on than that, so I stopped Tomcat, and edited the flex-config.xml file to turn all debugging features on, such as keep-generated-swfs, keep-generated-as, etc..., and I changed the log levels from INFO to DEBUG. Restarting Tomcat and requesting the Flex Explorer app had no effect on the initial problem, and of course I was again presented with the HTTPService Fault.

Another examination of the flex.log revealed a great deal of very useful information. Specifically, this message:

ERROR -- GET status: 500, reason: Internal Server Error, target: http://localhost:8080/samples/explorer/formatsource.jsp?url=quicktour/Hello.mxml

Ok, so the Explorer Hello World mini-app was trying to load the example source file in the source tab, and it was trying to use an HTTP call to a jsp to get that source. I copied the URL from the log and entered it in the browser. With all the debugging features turned on in flex-config.xml, I was presented with a very helpful error message and a stack trace. The error message went so far as to tell me *exactly* what the problem was, and *exactly* how to solve it. It turns out that Tomcat couldn't find a compiler for the jsp file, as shown in this Flex error message:

Requested page cannot be displayed

An unexpected error occurred that prevented /samples/explorer/formatsource.jsp from being displayed.

Unable to compile class for JSP No Java compiler was found to compile the generated source for the JSP. This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK to the common/lib directory of the Tomcat server, followed by a Tomcat restart. If using an alternate Java compiler, please check its installation and access path.

Technical Information: HTTP Status Code: 500 Exception Type: class org.apache.jasper.JasperException Servlet Name: jsp

Exception org.apache.jasper.JasperException Unable to compile class for JSP

No Java compiler was found to compile the generated source for the JSP. This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK to the common/lib directory of the Tomcat server, followed by a Tomcat restart. If using an alternate Java compiler, please check its installation and access path.

Following the instructions in the error message, I copied my {JAVA_HOME}/lib/tools.jar to {Tomcat}/common/lib/tools.jar. I restarted Tomcat, requested the Flex Examples application again, and voila everything worked like a champ. These verbose, debug error messages from Flex are going to make working with a J2EE application a whole lot easier!!

With the Flex Samples Explorer working now, an examination of flex.log showed great debug information about the GET request and response. Here's the complete GET request/response pair from Hello.mxml that was outputted to flex.log while flex-config.xml was configured for maximal debugging:

04/01 21:54:52 INFO -- GET status: 200, reason: OK, target: http://localhost:8080/samples/explorer/formatsource.jsp?url=quicktour/Hello.mxml
04/01 21:55:17 INFO -- GET : http://localhost:8080/samples/explorer/formatsource.jsp?url=data/WebServiceDemo.mxml
04/01 21:55:17 INFO -- Cookie in request: domain = localhost path = /samples name = JSESSIONID value = 57E43E5F8AF069706E5B3CD9FDE4B20E
04/01 21:55:17 INFO -- Header in request: accept : */*
04/01 21:55:17 INFO -- Header in request: x-flash-version : 7,0,19,0 04/01 21:55:17 INFO -- Header in request: content-type : application/x-www-form-urlencoded
04/01 21:55:17 INFO -- Header in request: flex-http-service : true
04/01 21:55:17 INFO -- Header in request: user-agent : Mozilla/4.0
04/01 21:55:17 INFO -- Header in request: connection : Keep-Alive
04/01 21:55:17 INFO -- Header in request: cache-control : no-cache
04/01 21:55:18 INFO -- Cookie in response: domain = localhost path = /samples name = JSESSIONID value = 57E43E5F8AF069706E5B3CD9FDE4B20E
04/01 21:55:18 INFO -- Header in response: Content-Type : text/html;charset=utf-8
04/01 21:55:18 INFO -- Header in response: Date : Fri, 02 Apr 2004 02:55:18 GMT
04/01 21:55:18 INFO -- Header in response: Server : Apache-Coyote/1.1
04/01 21:55:18 INFO -- Begin GET response --
04/01 21:55:18 INFO
{snip}The Hello.mxml source was here in the log{/snip}
04/01 21:55:19 DEBUG keep generated SWFs = true
04/01 21:55:19 INFO -- End GET response --

The Flex troubleshooting process is significantly facilitated by the wide range and depth of debug settings built into Flex.

Flex Debugging Resources:

 


Comments

Hello,
Unfortunately all the links pointing to Macromedia are currently broken. Can you please point me to their current location. Thanks.

-Douglass


Fixed the Flex links. Thanks.


I met the same problem
thanks for sharing


I too am getting a similar error, but here i am not using Tomcat. I am using Flex 1.5 with JRun and i had to create a HTTP names services which gives me this error. Can you please explain. There are two instance where on the first it works correctly and on the sencond it shows a message "HTTPService fault: internal server error"

I am adding the log file details of both.

Works well
**********************************************
12/07 14:07:52 INFO -- GET : http://localhost:8700/samples/explorer/formatsourc..." target="_blank">http://localhost:8700/samples/explorer/formatsourc...
12/07 14:07:52 INFO -- Cookie in request: domain = 'localhost', path = '/', client name = 'JSESSIONID', endpoint name = 'JSESSIONID', value = 'f030b19253e6I$A8$EDA'
12/07 14:07:52 INFO -- Header in request: Content-Type : application/x-www-form-urlencoded
12/07 14:07:52 INFO -- Header in request: User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
12/07 14:07:52 INFO -- Header in request: flex-http-service : true
12/07 14:07:52 INFO -- Header in request: Connection : Keep-Alive
12/07 14:07:52 INFO -- Header in request: Cache-Control : no-cache
12/07 14:07:52 INFO -- Header in request: x-flash-version : 8,0,22,0
12/07 14:07:52 INFO -- Header in request: Accept : */*
12/07 14:07:52 INFO -- Cookie in response: domain = 'localhost', path = '/', client name = 'JSESSIONID', endpoint name = 'JSESSIONID', value = 'f030b19253e6I$A8$EDA
12/07 14:07:52 INFO -- Header in response: Date : Wed, 07 Dec 2005 19:07:52 GMT
12/07 14:07:52 INFO -- Header in response: Content-Type : text/html; charset=utf-8
12/07 14:07:52 INFO -- Header in response: Server : JRun Web Server
12/07 14:07:52 INFO -- Begin GET response --
12/07 14:07:52 INFO


12/07 14:07:52 INFO -- End GET response --
12/07 14:07:52 INFO -- GET status: 200, reason: OK, target: http://localhost:8700/samples/explorer/formatsource.jsp?url=clientprofile/clientprofile.mxml
****************************************************


****************************************************
One with error (HTTPService fault: internal server error)

12/07 13:55:49 INFO -- GET : http://localhost:8700/samples/oag/oagsource.jsp?ur..." target="_blank">http://localhost:8700/samples/oag/oagsource.jsp?ur...
12/07 13:55:49 INFO -- Cookie in request: domain = 'localhost', path = '/', client name = 'JSESSIONID', endpoint name = 'JSESSIONID', value = 'f030b19253e6I$A8$EDA'
12/07 13:55:49 INFO -- Header in request: Content-Type : application/x-www-form-urlencoded
12/07 13:55:49 INFO -- Header in request: User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
12/07 13:55:49 INFO -- Header in request: flex-http-service : true
12/07 13:55:49 INFO -- Header in request: Connection : Keep-Alive
12/07 13:55:49 INFO -- Header in request: Cache-Control : no-cache
12/07 13:55:49 INFO -- Header in request: x-flash-version : 8,0,22,0
12/07 13:55:49 INFO -- Header in request: Accept : */*
12/07 13:55:50 ERROR %%500%%Internal Server Error
12/07 13:55:50 INFO -- Cookie in response: domain = 'localhost', path = '/', client name = 'JSESSIONID', endpoint name = 'JSESSIONID', value = 'f030b19253e6I$A8$EDA
12/07 13:55:50 INFO -- Header in response: Date : Wed, 07 Dec 2005 18:55:50 GMT
12/07 13:55:50 INFO -- Header in response: Content-Language : en-US
12/07 13:55:50 INFO -- Header in response: Server : JRun Web Server
12/07 13:55:50 INFO -- Begin GET response --
12/07 13:55:50 INFO JRun Servlet Error500 Internal Server Error
Internal Server Error

12/07 13:55:50 INFO -- End GET response --
12/07 13:55:50 ERROR -- GET status: 500, reason: Internal Server Error, target: http://localhost:8700/samples/oag/oagsource.jsp?url=clientprofile/clientprofile.mxml

****************************************************


 

 

Calendar

 
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Search This Site

 
This is an exact search only

topics

 
adobe blogging coldfusion computer technology events flex java learning linux mac os x macromedia meetup new england odds & ends outdoors personal photos photoshop science travel video

About This Site

 
Adobe Alumni & Community Professional. Expert in ColdFusion, Flex, LCDS, Photoshop, Lightroom. Linux RHCE. Follow Me!. For my photography check out Boston Portrait Photographer.

Speaker at CF.Objective(): Automated UI Testing with CFSelenium, MXUnit, ANT, and JenkinsCI

Adobe Community Professional (ACP)
Red Hat Linux Certified Engineer

Recent Entries

 
Automated System Testing for ..
Could not find ColdFusion com..
No April Fools: Selenium Ship..

Recent Comments

 
Posted By Steven Erat:
Jim, and anyone else that may attend, if you would like the full slide deck and my demo project files BEFORE the conference, please reply as a comment ...

Posted By Jim Priest:
Can't wait for this one!!

Posted By iPhone Repair:
It appears there are so many people have issue with their iPhone & iPod Touch screens dropped and cracked. It happened to me also when u haven't got a ...

recently played

 
Mr. Brightside
by The Killers
on Hot Fuss
Get Hot Fuss by The Killers on Amazon

now playing, a plug-in for itunes

Categories

 
RSS Adobe (34)
RSS Bicycling (9)
RSS Blogging (39)
RSS Books (13)
RSS Breeze (13)
RSS CFMX Podcasts (10)
RSS ColdFusion (437)
RSS Computer Technology (51)
RSS Events (26)
RSS Flex (20)
RSS Gadgets (11)
RSS HiTech Industry (16)
RSS Java (26)
RSS Learning (57)
RSS Linux (70)
RSS Mac OS X (23)
RSS Macromedia (27)
RSS Meetup (35)
RSS New England (62)
RSS Odds & Ends (25)
RSS Outdoors (32)
RSS Personal (29)
RSS Photos (111)
RSS Photoshop (29)
RSS Podcasts (18)
RSS Rants (19)
RSS Restaurants (8)
RSS Science (34)
RSS Spain (16)
RSS Travel (42)
RSS Twitter (10)
RSS Video (20)
RSS Webcam (3)
RSS Writing (10)

RSS

 


Add to Google
Add to My Yahoo!

Credits and Stuff

 
BlogCFC - Free ColdFusion Powered Blog Software


 
 
blog | photos | flickr | referers | webcam | stats | about | contact
 
Copyright © 2012 Steven Erat. All rights reserved.
This is a personal weblog. The opinions expressed here represent my own and not those of my employer