Zero code coverage with jacoco with tomcat - jacoco

I'm trying to get the code coverage information for an application running in tomcat. I started with tomcat adding the following java arguments as below:
-javaagent:C:/Users/angel/Desktop/CodeCoverage/jacoco-0.7.5.201505241946/lib/jacocoagent.jar=destfile=C:\Users\angel\Desktop\Code\new\jacoco.exec,append=true,includes=myapp.*
I could see the jacoco.exec generated, but it's not getting updated even after I stop Tomcat.
I also tried the below option, getting code coverage information using tcp:
-javaagent:C:/Users/angel/Desktop/CodeCoverage/jacoco-0.7.5.201505241946/lib/jacocoagent.jar=destfile=C:\Users\angel\Desktop\Code\jacoco.exec,append=true,jmx=true,includes=myapp.*
But still no update on the coverage information even after stopping tomcat. Please suggest me to get this done.
Thanks a lot

I myself figured out the issue.
I just removed the myapp.* in the includes and just put a * and it solved my problem. I have given as below:
-javaagent:C:/Users/angel/Desktop/CodeCoverage/jacoco-0.7.5.201505241946/lib/jacocoagent.jar=destfile=C:\Users\angel\Desktop\Code\new\jacoco.exec,append=true,output=tcpserver,address=localhost,port=36320,includes=*
Thanks
Angel

Related

How exactly does the WiX 'Service Install' work internally?

I have a problem with a web service that is installed and started with a .msi that is created with the WiX toolset.
The service can be installed and started on all the machines I tested so far (shown as running in the Services Manager) but on some machines it is not reachable (for example via a browser) and not shown in the list of listening ports on that machine (displayed with 'netstat -a').
I am trying to figure out what's going wrong but I am not really familiar with web service development and configuration. It's a third party service, thus I don't know how it works internally.
A good starting point for me would be to find out, what exactly happens when a service is installed and started during the execution of the .msi-file.
Maybe I could try to tackle the problem on a lower level then.
Below is my code in the ServiceInstall-Element:
<ServiceInstall
Id="ServiceID"
Type="ownProcess"
Vital="yes"
Name="ServiceName"
DisplayName="ServiceDisplayName"
Description="Lorem Ipsum"
Start="auto"
Account="LocalSystem"
ErrorControl="normal"
Interactive="no"
Arguments="action=run">
</ServiceInstall>
The argument is important - without it, the service won't start or run.
Maybe someone else encounterd the same or a similar problem and can help me out.
Thanks already in advance - each hint is appreciated.
EDIT I (15.04.18):
As it might be a problem with the specific service, I will add some further information here:
It's a third party software called CryptoLicensing:
http://www.ssware.com/cryptolicensing/cryptolicensing_net.htm
Part of this software is that specific program, that serves as a License Server and does the license registration, for example in a customer's network.
The service can be run as a Windows application or installed and run as a Windows service. In both cases it should be listening on a (pre-)specified port on the installed machine.
Whenever I start the .exe as an application, everything works as intended. The service is reachable (for example with the browser) and can be accessed from other machines in the network.
When the .exe is installed and started as a service, it does not work as intended on every machine. For example if I install and start the service on my laptop, it is shown as running in the Services Manager, but is not reachable on its assigned URL (not even on the localhost) nor is the specific port displayed in the active listening ports, for example with 'netstat -a'.
The service itself starts without any error messages and does not log any errors or exceptions as it seems to be running without any problems.
I contacted the vendor, but sometimes he doesn't reply quickly and he is not very specific in his replies.
Before asking the question I assumed that it was a problem with the Windows user rights and the WiX installer but during the discussion here I had the feeling that it might a problem with the service itself.
I hope this 'new' piece of information helps in isolating and location the problem.
Thanks to everyone who helped so far!
Hopefully not stating the obvious here, but WiX doesn't do much except populate the ServiceInstall table in the MSI file, so this is about why Windows Installer won't start the service. ServiceInstall table:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa371637(v=vs.85).aspx
Also, this isn't really about ServiceInstall - it's probably about the ServiceControl element in your WiX source, but it's not clear whether that's how you're starting it or if you're starting it manually later on. That does make a difference. What is the error message and where are you getting it, and is it a 1920 or 1921 error (in the context of ServiceControl).
The main reason a service will start on one system but not another is missing dependencies. If your service is C++ based (the post doesn't say) then there are probably dependencies on C runtimes, UCRT runtimes, MFC or ATL runtimes and so on.
First: are you sure this service is intended to run as LocalSystem? (MSDN, SO).
Second: did you check the event logs in detail for anything obvious? If the service is good you should find a hint at least. Something to start with. I find that I sometimes miss the actual logs in the event viewer because it is so "crowded". My take on it: empty the log and stop and restart the service.
Something locking / blocking: If the service installs and runs OK I would suspect other factors such as firewalls (hardware & software), security software in general (anti-virus, malware scanners), network configuration issues (proxies, WINS, DNS and all the complexities involved in networking). Is the service trying to reach an UNC path?
Diverse Machines: What are the target machines? Are they virtual, are they physical, are they test machines, are they operative SOE machines in corporate networks? Are they the same OS version and edition?
Further Ideas: It is not quite related, but maybe skim this list of suggestions for debugging from another answer (I am not sure why it was down-voted, I think it is an OK list to inspire debugging ideas): Windows Application Startup Error Exception code: 0xe0434352 (maybe just skim the bolded words for ideas - Recommended).
sc.exe: And finally, perhaps check the sc.exe tool (Service Control) and see if it can provide you with some useful information for debugging.
sc.exe in the context of killing hung services (sample use).
sc.exe from MSDN
Some further links:
Windows Services Frequently Asked Questions (FAQ). Content seems to be up to date - at face value at least. These guys claim to be experts on services. I have no idea who they are.
Essential Tools for Windows Services: SC.EXE
Run Service Control (sc.exe) command on secure port
After almost 20 months we finally (and accidentally) found a solution to the problem! For the few machines, on which the service did not run properly, setting the NoInteractiveServices value in the registry to 0 did the trick. A value of 1 (which is default) means that no service is allowed to run interactively, regardless of whether it has the SERVICE_INTERACTIVE_PROCESS property. More information on Interactive Services.
I am not completely satisfied with the solution, because on all the other machines NoInteractiveServices is set to 1 AND the service runs properly anyway. However, on the machines where the service did not run interactively this solution worked for us. Thus I will accept this as an answer.
If anyone has more information on this issue and can explain why this works, feel free to
add them - I would be very interested!

ActiveMQ Error in CF9 to CF11 Migration

Please forgive me since I'm rather new to this, but I'll try to explain the situation as best as I can.
The current system is running on ColdFusion 9 and ActiveMQ 5.3.1. We are trying to upgrade the system to ColdFusion 11 and I'm running into some issues. In ColdFusion 9 ActiveMQ appears to run fine on Beta and Production (we also have a local and alpha environment) however in ColdFusion 11 I get the following error: http://puu.sh/gVp1L/d77453416f.png This happens in the /CFIDE/adminapi/eventgateway.cfc:204 which of course is a file that has been abstracted to not be readable.
I have tried the following:
Three different ActiveMQ servers
Two different installs of CF11
Going step by step through the eventgateway api
When I manually try to start the Gateway Instance in CFIDE, it goes to a white page, and nothing shows up in the eventgateway log. The only error I've managed to see was actually in CF9 and it was:
Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory
I'm assuming that's just a goofy ActiveMQ install locally though. I did some googling on this error and it says that I might be missing a .jar file within ActiveMQ, but when I view the /lib directory I can see the file they claim must be missing. Within CF9, I can actually see errors in the eventgateway log, but like I said, I get a white screen and nothing happens in CF11.
Any ideas?
Thanks,
Nick
This was due to the activemq.jar not being including in the cfusion/lib folder for CF11, but was for CF9.

How to debug production setup for java?

I am currently working on a web-app. Basically deployed as .war file on production enviornment. The server is tomcat7.
Since the code is written in java. There are ocassional log statements on server side.
If I am given an issue to resolve, I do not have a duplicate data-set / subset of data , as like production. So the problem that I face, is replicating the scenario , in case of testing.
Since this is production enviornment, attaching a remote debugger , would mean that the functionality would halt/ when I am stepping through break points, So I am not able to debug remotely.
so, currently, the only visiblity I have with regards to the behavior of the system is, The code base, and the log statements in code.
How Do you suggest I debug the server side code without restarting the application.
Any insight in this matter would be appreciated.
Thank you.
As you cannot attach a remote debugger in production there is no other way to debug your code other than the logs and matching the line number in your code.
1) You could ask for the sample scenarios which caused the issue and try to reproduce it in your development environment with debugger attached.
2) You could fine tune the log level to DEBUG mode to catch more useful logs.
3) Check various logs like application log, server log, access log, etc
3) You could ask for the test data which has caused the issue and try the same in dev environment.
Ideally you need a mock production environment with minimum mock data so that you could attach your debugger and step into the code.
Otherwise it would be time consuming and impossible to reproduce the production issues.

Having trouble using AS3 Webservice

AS3 Webservice
I'm using this library to connect to a database where I store and retrieve files that my program uses. When I test it locally, it works fine, but when I put it online it has trouble connecting, I ran some debugs inside the library and after "DESCRIPTION LOADED" is traced, nothing happens. Also I'm not really sure where to run traces to see what the problem is exactly, I just removed the comments on some traces that were already there.
So to recap, when I run my program offline(locally) it runs fine, it connects, sends and receives no problem. Once online, it doesn't connect it doesn't even run the traces I have in the OperationSuccessful or OperationFailure functions.
So I'm wondering if anyone has been using this library successfully and could maybe share some tips or code that will help me, thank you!
EDIT
We seemed to have solved our problem with this method without using that third party webservice library.
I am going to assume a few things here.
1) the data server is not on the same domain.
2) the server with the data is open and not blocked by the firewall.
You need a crossdomain.xml file on the server with the data allowing the domain where the swf is located.
Something like this.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain = "*"/>
</cross-domain-policy>

How do I debug mod_wsgi/django/apache/wget timeout

I have a web service running through django/apache/mod_wsgi that I am trying to debug -- it takes a long time to run server-side, but with certain parameters it just times out. I've tried doing a straight up wget on the URI, and using urllib2. I get the following error from wget:
Read error (Connection timed out) in headers
Meanwhile, urllib2 returns nothing at all -- it seems to be erroring silently. I've tried increasing the Timeout directive in my apache config, but that doesn't seem to help. The service runs fine with different parameters. How should I debug this? Where is the timeout coming from if not apache?
Chances are the problem is in you services code. Make sure your services code completes executing and returns to apache before trying to debug apache.
I would suggest that you trace through the services code adding output statements. Be sure to add a ouput statement just before your code returns to mod_wsgi (the last line of the function that mod_wsgi calls.) Chances are what you will see is the code hanging in a particular spot. That is all the debug statements prior to that spot in the code will appear, none of the output statements after that spot will appear.
If you don't want to add debug statement try using a debugger to step through the code.
Another option is to use the django development server and see if the timeout occurs when running without apache. However, since the development server is single threaded your code won't hang if the problem your dealing with is a concurrency related bug.