Debugger not active when compile with maven - apache-flex

here is my question :
When I build my swf by FlashBuilder, my debugger is active (access via context menu), and I got my logs in the flashlogs.txt.
BUT when I build my swf with maven (flexmojos-maven-plugin), even if I put <debug>true</debug> in the configuration, I hadn't any logs and can't active the debug in the flash application.
Any idea why ?
Informations :
I need to be able to access the debugger and have the trace in the flashlogs.txt without compiling and launching via FlashBuilder.
=> It's for some tester who don't have to access to the sources, just launching the application and testing it

Once you built your swf with Maven, you need to deploy it on your web server.
Example: c:\java\tomcat\webapps\myapp (depending of your back-end)
Then in Flash Builder, in the Flex Build Path configuration for your project, you have to set the output folder to the target folder where you have your web server pick up the SWF you are building.
Set the Output folder URL to point to the context that launches the SWF and you should be good to go.
Example: http://localhost:8080/myapp
And of course be sure to compile with debug mode ;)

Related

Eclipse Indigo and Maven : Unable to find src/main/java in dynamic web project

I've been using Eclipse indigo with m2e and m2e-wtp installed.
I created a dynamic web project using m2e by selecting maven-archetype-webapp. Now the problem is, I could not see src/main/java, src/test/java and src/test/resources in the created structure. Here is a snap of the project.
I stumble around and found this link. I created required directories on file system. Now the question is ideally where should I add "Source Folder" for each directories(src/main/java, src/test/java and src/test/resources)? Should I add them under "Java Resources" or somewhere else?
Thanks
That's exactly how we do it.
src/main/java, src/test/java and src/test/resources
under java resources -> new source folder
Don't forget to add your src/main/java path and the maven dependencies to the deployment assembly of your project if you want to run the web app from eclipse via tomcat.
EDIT
Concerning Eclipse Deployment:
If the project is already facetted as a Dynamic Web Project like yours, you'll need to add a Server in the Server view (We use Tomcat 7 and reference a local tomcat copy in the server setup)
Then you add the web projeect to the server (add/remove on the server)
In the project properties you'll need to add the src/main/resources and src/main/java folders to your deployment assembly as well as the maven dependencies.
We also use a src/main/webapp folder instead of the webcontent folder that is automatically created. This holds the web resources, WEB-INF and views and will be added to the deployment assembly as well and mapped to the root path '/'
Now you'll run an install on your app and then select 'run on server'
Just after the creation of a web application based on the archetype 'maven-archetype-webapp', it is perfectly possible to run the wep application in making usage of 'run as' on Tomcat (by example). You have right to a jsp page, index.jsp.
But if you want like many others create a servlet then you have a problem. The build path of the projects references 'src/main/java' and 'src/test/java' but the directories do net exist yet. I don't know why they forgot to create the directories (within the archetype)...
To correct the problem, you 'simply' have to create the missing directories (from the explorer) and then from Eclipse do a right-click on the project name and then click on 'Maven' and then 'Update Project'. If you create the directories this way you will see that the source directories (src/main/java and src/test/java will appear again).
Then create a new servlet (by example) in src/main/java and deploy the application again. Everyting will work this time.

Deploying to a server and remote debugging with FlashDevelop?

Is there any way to automatically deploy to a server after I build a flex app, and then debug using the remote url ?
This is totally possible in FlashBuilder, but I am highly hoping that it can be done in FD as well.
You can script any action you want in a batch file and then go to Project->Properties->Build->Post-build-command and enter your batch file execution line.
To jump to a debug URL after compiling, just go into Project->Properties->Output, select "Open document" and type your URL.
If you deploy a debug version of your SWF, you can start FlashDevelop debugger for remote debugging (see Debug menu) and then navigate to the online page where your SWF resides.

How to debug Flex application under maven

I develop Flex-Java applications which is running under Apache Tomcat. I use Flex Builder plug-in for Eclipse as my IDE. My application consists of several libraries and modules. I manage all of them as a small maven (flex-mojos) projects.
Does anybody can share some ideas how to setup robust debuging enviroment?
I use Maven & Flexmojos from the command line and the Flash builder 4 plugin inside of Eclipse. In my project I also have a Java/BlazeDS backend I like to debug at the same time as the Flex client on occasion.
Here's what I do:
1) I used cargo to startup an instance of my Java backend that DOES NOT have the SWF or HTML wrapper in it.
2) I've created a "Web Application" debug launch configuration where the launch URL just points to a file (e.g. "/path/to/my/flash-builder/bin/myapp-wrapper.html").
3) When I launch this debug configuration from within Eclipse the Flex debugger Just Works. As soon as a stop point it opened the Flex Debugger perspective automatically opens.
By launching a debug configuration directly from Eclipse I don't have to rebuild and redeploy a WAR file after each change made to the Flex app. In fact, after I shut down the Flex client I just leave the Java server running and reconnect with the next debugging launch.
In order debug the Java side, I start the application server with the JVM debugger command line arguments and launch a Remote Java Debugger debug launch configuration. Eclipse has no problem running both debuggers at the same time.
The only problem with this setup happens when I need to run the Flex web app from an http:// URL (for example to get flashvars to retrieve URL query parameters). In this case it is a long round-trip to get maven to created the WAR and deploy it, then to launch the debugger...after every Flex client source edit. I posted a question on how to make that case better (http://stackoverflow.com/questions/4426053/quickly-debug-flex-java-web-application-from-eclipse).
This is an area of interest to me so let me know what you are looking for and I can probably help more.

Production application referencing development directories

I am building a web application with .NET 3.5. I have several class library projects being referenced by my web forms.
I am deploying using a web setup installer.
When I install the application and hit the opening page, I get null pointer exceptions to some (not all) of the objects in my class library. Looking at the stack trace reveals that something somewhere is looking for a directory that exists only on my development machine.
When I do IISRESET, the errors vanish.
Does anyone have any idea why my application (web.config is compiled with debug="false") is attempting to look for things on my local dev machine?
My active build is set to release.
Thanks.
Did all the .dll's you used in your site get published with your code? If not make sure they are placed in by the installer, and the web config is not hard coded to look for references.
Open Visual Studio, look at the References folder and check to see if any of those references are pointing to the file(s) in your DEV machine. If so, I suggest you add a new folder to your app (i.e. Assemblies) and add all the dlls your application references in that folder.
After that, make sure all the references in your project are pointing to the dlls in the Assemblies folder and not some folder that only exists in your DEV machine.

Is there a better way to work with Flex Builder and the AMF Gateway?

I'm using Flex Builder 3 to connect to a bunch of back-end code via the AMF gateway. Another developer packaged up all the AMF Gateway code into a war file. Here's my development process:
Deploy most recent AMF-gateway.war file into local jboss server
War file gets unpacked into [jboss]/server/tmp/deploy/tmp23241AMF-gateway-exp.war/
Run Flex Builder. Point application project at AMF Gateway tmp folder in 3 places (Flex server root folder, Flex build output folder, Flex compiler 'additional arguments' (pointing to location of services-config.xml).
This setup means that whenever you start a debug session in Flex Builder, it dumps working versions of the files into the AMF-gateway folder on the jboss server (which is aliased as /AMF-gateway). The thing is, every time I restart jboss or deploy an updated AMF-gateway.war file, it gets unpacked into a new temp folder with a new name, and I need to change all the references in the Flex project. This happens several times a day, and it's annoying. Can I streamline this configuration? I tried using an alias to that folder -- figuring I could script the change -- but Flex Builder didn't seem to like it.
If I remember correctly, you can create a directory in JBoss that the server will treat as an exploded war file. I don't have a copy of JBoss handy to check, but I remember creating a directory such as "context-name.war" and being able to develop against that. So instead of copying your packaged .war file to the deploy directory, you could unzip it directly to that directory. If I remember correctly JBoss will monitor the web.xml file for changes and if it's overwritten it will redeploy the context.
Instead of using an XML approach: (i.e. SOAP/WSDL/REST), try using AMF to port to a different gateway such as C# to the database directly.
http://specialmoves.com/labs/code/flash-data-transfer-using-fluorinefx

Resources