How to debug Flex application under maven - apache-flex

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.

Related

Batch File: Wait until multiple dotnet run commands are finished before launching browser shortcut

I have a batch file that executes:
start cmd /k dotnet run -p projectName
For two separate projects and then launches a shortcut link to the angular project in browser. The only (semi) problem is that the shortcut launches before the dotnet run commands have finished and so the browser believes the site cannot be reached until the dotnet run commands are complete.
I'm trying to not launch the shortcut link until both projects have finished executing the dotnet run command so the "This site can't be reached" dialog never shows up. I don't personally mind it, but it's rather confusing to anyone thinking the application should just open without the need for a reload.
EDIT:
The projects I'm running are a .NET Core Web API & .NET Core (Angular) Web App. The angular app get's compiled and served via dotnet run, but both projects need to remain running in order to listen to their specific ports. And the shortcut link executed at the end of the batch file is just to open the browser at localhost:AngularPort#. I understand a desktop app would have probably been the way to go from the start but for v2, the plan is to host in azure and allow customers to access the site as well instead of just being an internal app.
I found a solution on npm with a package called 'wait-on' which in my case will wait until an http(s) request on that url returns a response with a status code in the 200 range before completing. There's a whole other assortment of use-cases with this package but I only needed it for that.
Here's a link to the package if anyone else runs into this problem:
https://www.npmjs.com/package/wait-on
Edit:
Honestly this was only a problem because the laptop I needed to put the application on didn't have the best CPU stats, so it got hung up trying to serve a local api and angular application simultaneously.

No symbols when attaching debugger to manually launched IISExpress instance

I've got a scenario where I want to launch a locally hosted service via IISExpress through the command line, and then debug it with Visual Studio. The problem comes when I attach a debugger to the IISExpress process, however, as it doesn't appear to be loading the symbols from my service's components.
The service is operational. I added some traces to verify that my local components are being run by the service. I just can't hit a break point.
Some information about my situation:
This is with Visual Studio 2015.
I'm using the /path option from IISExpress.exe, launching with minimum configuration possible.
This is an ASP.NET Web Api application.
Sometimes when the debugger attaches it shows the underlying dependencies (my assemblies), but I'm unable to load symbols from them as VS doesn't recognize the .pdb's I have on disc for them.
I found the application.config files for both my service and a service that was set up by Visual Studio. The files are configured differently, but they don't appear to be meaningfully different.
Most of the service's components are release builds and are deployed without symbols. One assembly is a debug build and does contain symbols.
The compilation tag's debug attribute seemed to have no effect on my ability to debug.
The idea here is to be able to pull a build from our build pipeline with a testing tool and load components from a local development project.
I discovered the problem after taking a closer look at the Debug -> Processes panel. It turns out that when IISExpress was initially being launched it was selecting the Native debugger by default instead of the Managed (4.6, 4.5, 4.0) debugger.
I installed and used EnvDTE80 to elect for which debugging engine I would like to attach with and everything worked like a charm!

Debugger not active when compile with maven

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 ;)

Switch from consumer application to WCF (servicestack) by debugging in Visual Studio

I am developing one product and there are 4 separate projects, in that I have developed one EXE project and WCF and I have done switching in debugging mode by attaching WCF project in process of debugging client of EXE and it has worked.
But when I transfer my WCF to servicestack then I could not able switch between them.
I am running my EXE project and and attached my WCF(servicestack) project to process
JsonServiceClient client = new JsonServiceClient("MYServiceURL");
RESTWCF.ServiceModel.Perfmon objBalPerformanceDataProperties = MakeObjectForServiceStackToInsertData();
var res = client.Post<RESTWCF.ServiceModel.Perfmon>("/perfmon", objBalPerformanceDataProperties);
When I click F11 on client.post I could not able to switch in WCF project, I think you can make sense of my problem.
Give me some solution of this problem so I can debug my code of WCF project (to find error :) in that)
Thanks.
You can only debug one host project at a time.
If you want to test the server set the ServiceStack project to be Start-up Host and press F5 to start debugging the ServiceStack host. Put a break-point at the start of the service you want to hit.
You can then just Run (i.e. without debugging) the client application which if everything is configured correctly, it should hit your breakpoint.
To make sure you're debugging the service correctly, instead of running the client first try calling the web service via a url, e.g:
http://localhost/MyServiceUrl/perfmon
If it hits the break-point you set, then all is well and you can run the client application as mentioned above.
Also it's a good idea to include ServiceStack's debbuging symbols, i.e. it's *.pdb files in the same folder as it's *.dll's - as it helps with debugging.
Note: WCF has nothing to do with ServiceStack - In a lot of cases that's considered an insult :-)

SpringSource Tool Suite (STS): How to run server and Java project through the IDE?

I'm using the latest version of SpringSource Tool Suite (STS). I have set up a Java project. My code has an Ant build file that packages a WAR. I have Tomcat 6.0.24 installed locally on my Mac 10.6.3. Can someone point me to how I deploy my project onto the server from the IDE and as such, set up debugging with breakpoints?
Thanks, - Dave
Here is what you need to do:
Open up the servers view inside of STS.
Create a new Tomcat instance, and point it to your locally installed Tomcat. (Alternatively, you can use the pre-installed tcServer instance, which is essentially Tomcat with a few extra things like Spring Insight).
Right-click on your project and select Configure -> Convert to Faceted Form...
In the dialog that comes up, choose Dynamic Web Module
Now, you should be able to drag and drop your project onto the server instance.
After that, right-click on the server instance and select "Debug"
You can find more detailed instructions here:
http://www.ibm.com/developerworks/library/os-eclipse-tomcat/index.html

Resources