Debug Flex & Java Together in Flex Builder 2

I recently conducted an eSeminar on building enterprise applications with Flex Builder and Flex Data Services. You can view the recording of that presentation at: http://seminars.breezecentral.com/p24622178/

In my session I promised that I would formally document the process for debugging Flex & Java together in Flex Builder. So finally, here is that documentation.

If you haven’t already done so, the first thing you will need to do is install Flex Builder 2 as an Eclipse Plugin and Flex Data Services with integrated JRun. You can get these products on the Adobe website. I use FDS with JRun for this example, but you could easily use Tomcat or any other app server. A few steps may change slightly, but the general concepts would be the same.

Now just follow along.

1) Start Flex Builder & Flex Data Services

2) Create a new Flex Project in Flex Builder

2.1) Specify that the application will use Flex Data Services and that the application should be compiled on the server

2.2) Click Next
2.3) Locate the root folder of your FDS samples application; mine is E:\fds2\jrun4\servers\default\samples
2.4) Change the root URL to be the URL to the samples application; mine is http://localhost:8700/samples/

2.5) Click Next
2.4) Lets name the project crm
2.5) Uncheck the “Use default location” box
2.6) Specify the Folder as <your_fds_samples_application>\dataservice\crm for instance mine is: E:\fds2\jrun4\servers\default\samples\dataservice\crm
2.7) Specify the Main application file as mini.mxml

2.8) Select Finish

3) Test everything by right-clicking on the mini.mxml file in the Eclipse Navigator, then Run As -> Flex Application

3.1) Your browser should load the mini application and look like:

4) Now back to Flex Builder where we will create another new project, but this time a Java Project
4.1) Name the project samples_server
4.2) Create the project from existing source, specifying the WEB-INF folder of the samples application, in my case: E:\fds2\jrun4\servers\default\samples\WEB-INF

4.3) Select Next
4.4) Go to the Libraries tab and select “Add External JARs”

4.5) Select the jrun.jar file located in <your_fds_install>\jrun4\lib

4.6) Also add the flex-services.jar located in <your_fds_install>\jrun4\servers\lib

4.7) Select Finish

5) Setup Java Debugging
5.1) Shutdown Flex Data Services
5.2) In the Eclipse Navigator browse to the src/samples.crm/EmployeeDAO.java class
5.3) Right-click on the EmployeeDAO.java file and select Debug As -> Debug…

5.4) Select Java_Application then New
5.5) Specify the name as “JRun_Debug”
5.6) Check the box “Include libraries when searching for a main class”
5.7) Enter the Main class: jrunx.kernel.JRun

5.8) Select the Arguments tab and enter “-start default” for the program arguments and “-Xms32m -Xmx384m -Dsun.io.useCanonCaches=false” for the VM arguments
5.9) Select the Apply button
5.10) Select the Debug button
5.11) Insure that Flex Data Services started

6) Set a breakpoint in EmployeeDAO.java in the findEmployeesByCompany method

7) Set a breakpoint in mini.mxml in the fill function

8) Right-click on mini.mxml in the Eclipse Navigator and select Debug As -> Flex Application

9) You should hit the breakpoint in the mini Flex application, then select Resume in the debugger

10) You should hit the breakpoint in the Java backend

11) Now jump up and down with joy saying “I can actually debug web applications!”

I hope this is helpful for you. It’s sure helped me figure out just where things in my applications were going wrong.

-James

  • Sunil

    James,
    can i demonstrate the above example directly on the flex builder 2. Is it must to use flex builder2 pulgin and eclipse to ccreate java project.

    sunil

  • James Ward

    You will need Flex Builder 2 installed as an Eclipse plugin.

    -James

  • Tony

    Hi James,

    Thanks for your good guideline.

    I noticed a couple of things so let me leave some comments.

    * Need to boot up FDS (JRun) before doing step 3.

    * Make sure your flash player is a debug version of flash player 9.0 before doing step 8.
    Otherwise, eclipse warns you as follows.
    ———————————————
    C:\WINDOWS\system32\Macromed\Flash\Flash9.ocx

    Flex Builder cannot locate the required debug version of the Flash Player. You may need to install the debug version of Flash Player 9.0 or reinstall Flex Builder. Do you want to try to debug with the current version?
    ———————————————
    Even though you click ‘YES’, you will end up in NON-debug mode.

    A debug version of flash player 9.0 is at the following link.
    http://www.adobe.com/support/flashplayer/downloads.html

    See u at Dev Night in Japan.

    -Tony

  • Pingback: Mike Morearty’s blog » Blog Archive » Simultaneously debug client-side Flex and server-side Java()

  • Valerio

    How to configure eclipse with tomcat in step 4.5 – 4.6 and 5?

    Thanks for your help,
    Valerio

  • James Ward
  • Christina

    Hi James,

    i have a problem, maybe you can help me.
    I have in my eclipse already a J2EE Project with a JSP frontend. My job is it to try using flex as frontend instead of JSP. My first question is

    Can i create a project in eclipse that understands Java and flex together, so i can debug it together? Is that possible? Or do i have to create ti different project, and if i do that, how can they communicate? I have in the same workspace my Project the “Flex Client FDS” and then the other “Java Project”. How can i communicate from flex client(one project) to java methods(other Project)?? I am positive that adobe has a solution for that. I already know how the remoteobject works, but in that case i had to export my java project as a jar file. I dont believe this is the only way it works.

    Here you explained very nice, how it works with Jrun, but i have to use Tomcat for my work.

    How can I configure eclipse with tomcat in step 4.5 – 4.6 and 5? The resources above cant help me further.

    please help me

    thank you

  • Hi James,

    Yes, this is pretty exciting, but I am having one small problem. I can’t seem to get any variable info in Eclipse’s variable view, once I’m stopped at the Java breakpoint.

    I don’t know much Java, or much about using Eclipse with Java, but based on my experience with debugging MXML files, I would think that I would click on one of the lines in the debug view. I see a whole lot of threads up there, most of which say that they are running, so I assume that all of these are still running and are not the thread that I have stopped for debugging.

    You can see a screen shot of what I’m seeing in the debug view here:

    http://www.brightworks.com/temp/debug_view.jpg

    I’ve tried selecting the various items at the bottom of the list – in case one of them is a stopped process – but nothing that I have done has caused anything to appear in the variable view.

    I assume that I’m simply not aware of something simple. Can you tell me what it is?

    Thanks,

    Douglas

  • Hi James – a continuation of my previous post – never mind – it’s working now – I don’t know why it didn’t work before but it’s not worth trying to figure *that* out. BTW, thanks for this post. I think that being able to debug in Java is going to be very helpful to me! – Douglas

  • Hi James,

    Is there any way to “debug” Adobe’s Java code? I’d like to do this in order to see how things work – not to search for bugs. For example, in the Use The Data Management Service tutorial that uses an ActionScript adapter I’m curious as to what happens in the Java after the button’s click event calls ds.submit(). I suspect that there’s a Java DataService class that corresponds to the mx.data.DataService class… If so, it’s packed away in a .jar file somewhere, I suspect… Obviously, I’m groping in the dark… Can you offer any pointers on how/whether I can step through such code?

    Thanks,

    Douglas

  • Hi All,

    James hasn’t gotten to answering my question yet so I thought that I’d answer it myself. I asked Christophe Conraets the same question at a recent seminar here in Boston. The answer is simple. Adobe doesn’t provide source code for its FDS java classes, just compiled code. So, no, we can’t step through that code. :-)

    Douglas

  • James Ward

    Hi Douglas. Sorry. :( Thanks for getting a response and posting it here.

  • Martin

    Hello James,

    I did exactly what is said but i have an Exception “Cannot invoke getter or setter (setURL) as operation unless jmx.invoke.getters property is set” when i try to debug “EmployeeDAO” class.

    Thank you,
    Martin

  • Michael

    Hi James,

    After I did step 5.11, I got the following error in the Console.

    *****************************************************************************
    Starting Macromedia JRun 4.0 (Build 106363), default server
    [1]java.lang.NoSuchMethodException: setURL
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.forbidInvokeGetterSetter(Unknown Source)
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.invoke(Unknown Source)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(Unknown Source)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
    at jrunx.kernel.JRun.startServer(JRun.java:574)
    at jrunx.kernel.JRun.(JRun.java:493)
    at jrunx.kernel.JRun$1.run(JRun.java:346)
    at java.security.AccessController.doPrivileged(Native Method)
    at jrunx.kernel.JRun.start(JRun.java:343)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at jrunx.kernel.JRun.invoke(JRun.java:180)
    at jrunx.kernel.JRun.main(JRun.java:168)
    [0]javax.management.ReflectionException: Cannot invoke getter or setter (setURL) as operation unless jmx.invoke.getters property is set
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.forbidInvokeGetterSetter(Unknown Source)
    at com.sun.jmx.mbeanserver.StandardMetaDataImpl.invoke(Unknown Source)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(Unknown Source)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
    at jrunx.kernel.JRun.startServer(JRun.java:574)
    at jrunx.kernel.JRun.(JRun.java:493)
    at jrunx.kernel.JRun$1.run(JRun.java:346)
    at java.security.AccessController.doPrivileged(Native Method)
    at jrunx.kernel.JRun.start(JRun.java:343)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at jrunx.kernel.JRun.invoke(JRun.java:180)
    at jrunx.kernel.JRun.main(JRun.java:168)
    Caused by: java.lang.NoSuchMethodException: setURL
    … 16 more
    ********************************************************************************

    Anyone has any idea about this error? Thanks.

    Michael

  • James Ward

    Martin & Michael,

    What JVM are you guys using? I’ve tested this with Sun’s JDK 1.4.2.

    -James

  • Michael

    Hi James,

    I am using JDK 1.5.0. Thanks.

    Michael

  • James Ward

    Check out:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4975578

    Are you using the JRun that ships with FDS? I never saw this error when using the JRun that ships with FDS and Sun JDK 1.5.

  • Michael

    James,

    Thanks for your reply. I do use the JRun that ships with FDS. I also checked the link out. But I have no idea about that.
    ****************************************************************
    Work Around

    Set the system property jmx.invoke.getters to a non-empty value, as the exception message suggests.
    xxxxx@xxxxx 2004-01-10
    *********************************************************************
    Where and how to set that? Thanks.

  • James Ward

    Michael,

    Step 5.8 describes setting VM arguments. So in addition to the arguments specified there, try to add an argument like:
    -Djmx.invoke.getters=true

    I don’t know if that will work and I haven’t been able to recreate this problem yet. If that doesn’t work I’ll dig a bit deeper.

    Alternatively you could use FDS with Tomcat or JBoss. If you want to give that a try, this blog may help:
    http://weblogs.macromedia.com/dharfleet/archives/2006/08/debugging_flex.cfm

    -James

  • Michael

    James,

    Thank you very much for your help. Now it’s working in debug mode after adding -Djmx.invoke.getters=true

    But the interesting thing is that if I start the Integrated Flex Server and open a browser and then type http://localhost:8700/samples/dataservice/crm/mini.mxml in the address bar to run it. I get an error popup. It says: Error Send failed. If I press ‘OK’ button, then there is no any information pulled out from the database. Any thoughts?

    Thanks.
    Michael

  • James Ward

    Interesting… Sounds like it can’t make an RTMP connection. Can you see if there are any errors on JRun startup?

  • Michael

    I do see there are some errors on JRun startup. The below is the messages on JRun startup.

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

    Starting Macromedia JRun 4.0 (Build 106363), default server
    Flex OEM License for JRun enabled
    10/30 10:15:04 warning Unable to open C:\fds2\jrun4/lib/license.properties
    10/30 10:15:05 info JRun Naming Service listening on *:2907
    10/30 10:15:05 info No JDBC data sources have been configured for this server (s
    ee jrun-resources.xml)
    10/30 10:15:05 info JRun Web Server listening on *:8700
    10/30 10:15:05 info Deploying web application “Flex Default Web Application” fro
    m: file:/C:/fds2/jrun4/servers/default/default-war/
    10/30 10:15:05 user JSPServlet: init
    10/30 10:15:06 info Deploying web application “Flex Data Services” from: file:/C
    :/fds2/jrun4/servers/default/flex/
    10/30 10:15:06 user JSPServlet: init
    10/30 10:15:06 user FlexMxmlServlet: init
    10/30 10:15:06 INFO Loading configuration file C:\fds2\jrun4\servers\default\fle
    x\WEB-INF\flex\flex-webtier-config.xml
    10/30 10:15:07 INFO Loading configuration file C:\fds2\jrun4\servers\default\fle
    x\WEB-INF\flex\flex-config.xml
    10/30 10:15:07 user FlexMxmlServlet: Starting Adobe Flex Web Tier Compiler
    10/30 10:15:07 user FlexMxmlServlet: Adobe Flex Web Tier Compiler Build: 143451
    10/30 10:15:07 user MessageBrokerServlet: init
    10/30 10:15:07 user FlexSwfServlet: init
    10/30 10:15:07 user FlexInternalServlet: init
    10/30 10:15:08 info Deploying web application “Flex Admin Web Application” from:
    file:/C:/fds2/jrun4/servers/default/flex-admin/
    10/30 10:15:08 user JSPServlet: init
    10/30 10:15:08 user MessageBrokerServlet: init
    10/30 10:15:08 info Deploying web application “Flex Data Services Samples” from:
    file:/C:/fds2/jrun4/servers/default/samples/
    10/30 10:15:08 user JSPServlet: init
    10/30 10:15:09 user FlexMxmlServlet: init
    10/30 10:15:09 INFO Loading configuration file C:\fds2\jrun4\servers\default\sam
    ples\WEB-INF\flex\flex-webtier-config.xml
    10/30 10:15:09 INFO Loading configuration file C:\fds2\jrun4\servers\default\sam
    ples\WEB-INF\flex\flex-config.xml
    10/30 10:15:09 user FlexMxmlServlet: Starting Adobe Flex Web Tier Compiler
    10/30 10:15:09 user FlexMxmlServlet: Adobe Flex Web Tier Compiler Build: 143451
    10/30 10:15:09 user MessageBrokerServlet: init
    10/30 10:15:10 error Could not pre-load servlet: MessageBrokerServlet
    [2]java.lang.UnsupportedClassVersionError: samples/crm/CompanyAssembler (Unsuppo
    rted major.minor version 49.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at jrunx.util.JRunURLClassLoader.defineClass(JRunURLClassLoader.java:188
    )
    at jrunx.util.JRunURLClassLoader.findClass(JRunURLClassLoader.java:153)
    at jrunx.util.JRunURLClassLoader.loadFromLoadClass(JRunURLClassLoader.ja
    va:117)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:81)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:70)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at flex.messaging.util.ClassUtil.createClass(ClassUtil.java:52)
    at flex.messaging.factories.JavaFactory$JavaFactoryInstance.getInstanceC
    lass(JavaFactory.java:244)
    at flex.messaging.factories.JavaFactory$JavaFactoryInstance.createInstan
    ce(JavaFactory.java:251)
    at flex.messaging.factories.JavaFactory.createFactoryInstance(JavaFactor
    y.java:93)
    at flex.messaging.FactoryDestination.getFactoryInstance(FactoryDestinati
    on.java:76)
    at flex.data.adapters.JavaAdapter.validateInstanceSettings(JavaAdapter.j
    ava:139)
    at flex.data.adapters.JavaAdapter.setSettings(JavaAdapter.java:123)
    at flex.messaging.Destination.createAdapter(Destination.java:279)
    at flex.messaging.Destination.initDestination(Destination.java:103)
    at flex.messaging.FactoryDestination.initDestination(FactoryDestination.
    java:58)
    at flex.data.DataService.createDestination(DataService.java:90)
    at flex.messaging.services.AbstractService.createDestinations(AbstractSe
    rvice.java:82)
    at flex.messaging.config.MessagingConfiguration.createServices(Messaging
    Configuration.java:187)
    at flex.messaging.config.MessagingConfiguration.configureBroker(Messagin
    gConfiguration.java:84)
    at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:10
    5)
    at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.
    java:1200)
    at jrun.servlet.WebApplicationService.preloadServlets(WebApplicationServ
    ice.java:791)
    at jrun.servlet.WebApplicationService.postStart(WebApplicationService.ja
    va:293)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:711)

    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerServi
    ce.java:242)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:430)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerServi
    ce.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:891)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java
    :230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.j
    ava:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    [1]flex.messaging.config.ConfigurationException: Error instantiating application
    scoped instance of type ‘samples.crm.CompanyAssembler’ for destination ‘crm.com
    pany’.
    at flex.messaging.factories.JavaFactory.createFactoryInstance(JavaFactor
    y.java:117)
    at flex.messaging.FactoryDestination.getFactoryInstance(FactoryDestinati
    on.java:76)
    at flex.data.adapters.JavaAdapter.validateInstanceSettings(JavaAdapter.j
    ava:139)
    at flex.data.adapters.JavaAdapter.setSettings(JavaAdapter.java:123)
    at flex.messaging.Destination.createAdapter(Destination.java:279)
    at flex.messaging.Destination.initDestination(Destination.java:103)
    at flex.messaging.FactoryDestination.initDestination(FactoryDestination.
    java:58)
    at flex.data.DataService.createDestination(DataService.java:90)
    at flex.messaging.services.AbstractService.createDestinations(AbstractSe
    rvice.java:82)
    at flex.messaging.config.MessagingConfiguration.createServices(Messaging
    Configuration.java:187)
    at flex.messaging.config.MessagingConfiguration.configureBroker(Messagin
    gConfiguration.java:84)
    at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:10
    5)
    at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.
    java:1200)
    at jrun.servlet.WebApplicationService.preloadServlets(WebApplicationServ
    ice.java:791)
    at jrun.servlet.WebApplicationService.postStart(WebApplicationService.ja
    va:293)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:711)

    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerServi
    ce.java:242)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:430)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerServi
    ce.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:891)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java
    :230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.j
    ava:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    [0]flex.messaging.config.ConfigurationException: Unable to create service ‘flex.
    data.DataService’ for ‘data-service’ due to the following error: Error instantia
    ting application scoped instance of type ‘samples.crm.CompanyAssembler’ for dest
    ination ‘crm.company’..
    at flex.messaging.config.MessagingConfiguration.createServices(Messaging
    Configuration.java:202)
    at flex.messaging.config.MessagingConfiguration.configureBroker(Messagin
    gConfiguration.java:84)
    at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:10
    5)
    at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.
    java:1200)
    at jrun.servlet.WebApplicationService.preloadServlets(WebApplicationServ
    ice.java:791)
    at jrun.servlet.WebApplicationService.postStart(WebApplicationService.ja
    va:293)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:711)

    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerServi
    ce.java:242)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:430)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerServi
    ce.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:891)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java
    :230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.j
    ava:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

    10/30 10:15:10 user FlexSwfServlet: init
    10/30 10:15:10 user FlexInternalServlet: init
    10/30 10:15:10 info Deploying enterprise application “JRun 4.0 Internal J2EE Com
    ponents” from: file:/C:/fds2/jrun4/lib/jrun-comp.ear
    10/30 10:15:10 info Deploying EJB “JRunSQLInvoker” from: file:/C:/fds2/jrun4/lib
    /jrun-comp.ear
    Server default ready (startup time: 8 seconds)

  • James Ward

    The sample app was compiled with JDK 1.4 and should work fine in 1.5. It looks like somehow you may actually be starting JRun with a pre 1.4 JVM. At step 5.7 go to the JRE tab and verify that it is using either a 1.4 or 1.5 Sun JVM.

  • Michael

    I checked it. The JRE tab is using Runtime JRE: Project JRE (jre1.5.0_07).

    I tried to run JRun_Debug in Eclipse to start JRun and then open a browser and type http://localhost:8700/samples/dataservice/crm/mini.mxml in the address bar to run it. Perfect! Everything is fine.

    In some how, the startup of Integrated Flex Server has some errors. But I just don’t where.

    Thanks.

  • Hi James,

    Good news. The problem is fixed.

    I think you are right. Somehow I may actually be starting JRun with a pre 1.4 JVM.

    I found a jvm.config file in C:\fds2\jrun4\bin folder, it has java.home=C:/fds2/UninstallerData/jre

    I guess the jvm in this folder is version 1.4, it causes the errors I have seen. Once I change it to java.home=C:/Program Files/Java/jdk1.5.0_07, and run again. Everything is fine. Cheers.

    Thanks.
    Michael

  • xavier

    Hi James,

    Thank you very much for your help.
    I am useing Tomcat for my work, my server-side java stop at breadpoint where I set,
    but the debug current instruction pointer is not shown, although the bebug window shows the linenum where I stop.

    how can I highlight the current line where I set the breadpoint?

    Xavier

  • Hi James,

    Any chance you could be persuaded to add Tomcat-specific instructions?

    As far as I can see the following sections would have to be divided into JRun & Tomcat subsections:
    4.5
    5.1
    5.5
    5.7
    5.8
    5.11

    The feline-lovers of the world would be most grateful… :-)

    Douglas

  • A point worth noting, as you move on to applying this in real (non-sample) projects…

    When trying to set up Java debugging for other projects, it’s important that the folder specified in step 2.6 not be the base folder of you webApp. Put another way, it shouldn’t be the folder that contains the WEB-INF folder. If it is, Eclipse will complain about overlapping workspaces when you go to set up your Java project (which uses the WEB-INF folder as its primary folder).

    Here’s how I structured my folders. I created a folder at the root level of my webApp, right next to WEB-INF and META-INF. I called it “app” but you could call it anything. Then I put everything that had been at the root level into it except the WEB-INF and META-INF folders. End result: 3 folders at root level. To my surprise the webApp (the Cairngorm Store example) worked without further tinkering!

    James: I wonder if it would be worth editing your post and explaining this. I can understand that you probably don’t want to make the post any more complex than it already is. You could end up with a book: “Debugging Your Flex Apps” or some such. :-) On the other hand, chances of people finding this burried in these extensive comments are rather small…

    And for those who _have_ found this: Happy debugging!

    Douglas McCarroll

  • hi all

    my name is sandeep , i am working on a web application with html as front end and jsp pages, now i am very much interested to design the UI part in flex builder 2, can i change the UI part only with the existing html code, as i am calling/forwarding some jsp pages ie for login page after entering username/password and on clicking submit button i am calling a jsp page, so like all the other pages, so i tried with flex as front end but could not make it. can u suggest me with an code/example,

    thanks
    sandeep.kumarappa@datafarminc.com

  • Adam

    Hi there,

    Thank you, nice example. I’m using fds + hibernate + mysql on XP.

    I spent some time trying to see polish characters in my app running “standard” jrun(database, conncection set to utf-8). Without success.
    I was really suprised when I started jrun from eclipse and all the encoding problems disappeared.

    Could someone give me an explanation why this happened.

    thanks,

    Adam

  • Hi Adam,

    I have no idea why that would happen, but I would recommend using Tomcat or JBoss instead of JRun.

    -James

  • Pingback: diogomoura┬┤s » links for 2007-10-03()

  • Alex O.

    Is it too much to ask for a new version of this article using Flex Builder 3 and BlazeDS ? (I am not lazy, I am newbie)

  • Hi Alex,

    I think that’s a great idea for an article. Unfortunately I won’t have time to write it any time soon. If you are interested in writing it let me know (jaward at adobe dot com) and I can get it published on the Adobe Developer Center.

    -James

  • Savan Patel

    Hi James,

    Thanks for the post.

    I have a problem setting up the debug mode. I use Eclipse 3.2, FB as plugin and Apache Tomcat 5.5.x as server.

    My problem is, when I reach at step 3, and try to run my flex application I get following error:
    ” Unknown Configuration Variable ‘compiler.keep- as3-metadata’ ”

    Please help me out to resolve the error. Hope to see some positive feedback.

    Thanks & Regards,
    Savan

  • Hi Savan,

    Are you using Flex 2 or Flex 3?

    -James

  • Savan Patel

    Hi James,

    Thanks for a quick response :)
    Yes, I use Flex 2.0

    Regards,
    Savan

  • Savan,

    I think you need to be using Flex 3 to keep the as3 metadata.

    -James

  • Savan Patel

    Hi James,

    Thanks for the reply, I will try out it today. I will post again about the results using Flex 3 once I am done with it.

    Regards,
    Savan

  • Savan Patel

    Hi James,

    Sorry for being late :)

    Had gone through some upgradation problems, but did not had any luck with it and I have to uninstall Flex 3 and install Flex 2 again.

    Problem after installing FB 2: when I tried to open Eclipse workspace it threw some error related to version conflicts at time of server startup and server publishing for the web module! (Reason is classfiles and might be have changed )

    So yet not able to find out, whats wrong and specially where :)

    Just for Knowledge purpose: Can you please guide me any links for java-flex application upgradation , it would be great help :)

    Once I am done I will again try out the steps for Flex 2 and Flex 3.

    Thanks & Regards,
    Savan

  • Pingback: LightRIA » Blog Archive » ??Blazeds?????()

  • Hi Savan,

    I’m sorry that you had problems with the upgrade. Did you install Flex Builder 2 before installing FB 3? Were you installing as an Eclipse plugin? If so did you try installing into a fresh Eclipse Classic install?

    Also you might want to check out: http://flex.org/java

    -James

  • savan

    upgrading to FB3.

    Here are the steps I followed and problem details:

    First I deleted the flex prject from Eclipse workspace (Don’t delete content under workspace)

    Secondly I closed the running instance of Eclipse and Uninstalled the FB 2 as an Eclipse Plugin

    Third step was to install FB3 as an Eclipse Plugin

    Last one was to create Flex Data Service project which refers same java code from the workspace

    Now the problem is:

    What actually happens is, FB3 creates more default packages then Fb2, it also updates the classfiles. (Even though classfile comparision shows it has same content, but version number might have changed with the new build)

    SO every time I try to publish the server or run the server it refuses to do so.

    In the whole process I have not changed the Eclipse workspace or tried newer version of Eclipse. I will go through the link shared by you, but let me know if it is mandatory step.

    Thanks & regards,
    Savan

  • savan

    Hi James,

    Sorry for being so late :) You need not to be sorry. I might have performed something wrong.

    I followed the above steps while migrating to FB3. Since my last post I was so busy that could not catch up with you for the same topic.

    Still I haven’t been able to manage time to check the debug mode setup with FB3 code. But I will surely write back to you once I get time for that.

    Thanks very much for your guidance and help,
    Savan

  • naresh

    Hi James
    I saw your application with java.
    I done java project with servlets,jsp,netbeans,tomcat,mysql.
    I intrested to work with flex and java for my project.
    what are the steps to work with flex& java.
    which reqirement i have to use.
    Please give me reply.
    If any URLS for that information reply me.

  • Hi ,

    Great post..
    I found out how to get java development capablities in flex builder using WTP.
    You can find a post on my blog here

    http://techmytongue.blogspot.com/2008/08/how-to-set-up-flex-builder-for-java.html

  • Awesome! Thanks Venkat!

    -James

  • Brad

    good article James, thanks.
    Along with using the inbuild debugger in flex and java , something can also be developed for java like the Runtime Flex tracer. It makes tracing easy while running applications in production. You can check it working on this link http://askmeflash.com/applications/9/runtime-flex-tracer-and-debugger

  • Kapil

    Hi James,
    I am very new in Flex. Could you please help to provide any article in which it described step by step configured Flex with Java in Flash Builder 4.5 using Weblogic as application server.