FusionReactor Blog - News and expert analysis for Java APM users.

Maven Surefire Stack Trace Problem

For some months we have been having problems with maven-surefire-plugin showing very strange exception stack traces.

After some searching, I found out that maven-surefire-plugin has a trimStackTrace configuration option which is set to true by default. See http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#trimStackTrace

I have no idea who thought that removing part of the stack trace would be a good idea, but it’s caused us no end of problems. Especially with rare/random test failures as we don’t get the full stack trace to see what really failed.

To change this ‘feature’ you simply define surefire configuration in your pom.xml. E.g.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <trimStackTrace>false</trimStackTrace>
    </configuration>
</plugin>

You should also be aware that maven-failsafe-plugin has the exact same option. The trimStackTrace is also set to true by default. See https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html

You can disable this by adding the same configuration to the failsafe plugin. E.g.

<configuration>
    <trimStackTrace>false</trimStackTrace>
</configuration>

Asynchronous Transactions

FusionReactor is able to track asynchronous requests made with several different libraries, examples of which include:

  • Redisson
  • MongoDB
  • Kafka Java Clients
  • OkHttp
  • Apache HttpClient

How FusionReactor Displays this Information

The response to the asynchronous request is tracked with ‘Callback’ as the subflavour. This is attached as a linked transaction (indicated by the small linked chain icon) and can be viewed by clicking the drop down arrow on the request transaction. The callback transaction is also posted to the history list as a Root Transaction.

Some important things to note with asynchronous transactions:

  • The callback may be attached to the request after the request has already finished
  • The callback is usually tracked on a different thread than the request
  • The actual time taken to perform the request is tracked on the response
An example of asynchronous transactions in FusionReactor. This is a Redis GET command using the Redisson Java Client, triggered by a WebRequest to a JSP file.

FusionReactor: Use it every day to solve knotty problems or help guide tuning efforts

“Use it every day to solve knotty problems or help guide tuning efforts”

What do you like best?

Helps find issues quickly, easily, and safely; supporting complex or simple setups equally well. While its largest user base may be ColdFusion, it can be used to monitor any java application or application server, which I have done many times. And new features are added every few months making it ever-more capable. Finally, the company behind the product has shown rock-solid support for any issues I’ve seen brought to them for over 15 years

What do you dislike?

Some might quibble with the (low) cost, compared to free options, but it does so much more than those–and indeed more than many costing far more.

Recommendations to others considering the product:

Certainly give the free trial a go. It was just updated recently to allow up to 3 servers, so you can see how easily it installs, how readily it helps you see what’s really going on, and even across monitoring of multiple servers (including dynamic containers like Docker).

What problems are you solving with the product? What benefits have you realized?

Finding reasons for crashes, being warned of crashes; finding what’s going on now, or went on in the past; finding reasons for slow request, slow queries; finding all this and more for a single server or across a cluster of them

Start your free trial on up to 3 servers

See this review on G2

Great Java performance monitoring tool

Automated Root Cause Analysis. Provide deep level insight (source code, scope variables, stack traces) whenever a problem, such as an exception or thread latency occurs. Snapshots are triggered automatically.

What do you dislike?

I do not like the Enterprise Dashboard, for monitoring multiple servers in a single window

Recommendations to others considering the product:

Great monitoring tool

What problems are you solving with the product? What benefits have you realized?

The agent enables FusionReactor to instrument any information which is available within the Java container, including CPU, memory, thread information (stack traces) and JD

Read full review on G2

Stat free Fusionreactor trial

FusionReactor Is Perfect for CFML Troubleshooting

FusionReactor Is Perfect for CFML Troubleshooting

“FusionReactor Is Perfect for CFML Troubleshooting”

What do you like best?

Being able to troubleshoot long-running web requests and SQL queries. Having access to the actual SQL that was generated is extremely helpful in diagnosing problems. Finally, enabling code test coverage is a fantastic edition for developers!

What do you dislike?

It’s a little pricey, but for most organizations where performance matters, it is well worth it.

Recommendations to others considering the product:

If you’re having issues with slow CFML requests, I definitely recommend giving FusionReactor a try. The interface is intuitive and the support staff is very responsive and willing to help train you how to use the software to optimize your web applications.

What problems are you solving with the product? What benefits have you realized?

As a developer, I am able to quickly view requests that take too long to run so I can decide whether I need to either optimize my CFML code or make adjustments to the database server (adding indexes, etc). For my clients, I can quickly see the JVM health of their production servers and diagnose any possible memory leaks or performance bottlenecks.

Start your free FusionReactor trial

See full review on G2

Amazing account manager service

What do you like best?

Andy McAuliffe answered my original query and persevered with a really positive outcome for the company. He regularly followed up with me to ask how things were going and to check if we had any issues.

What do you dislike?

I am not in the technical team so cannot answer this fully but from what i understand this was easy to set up

What problems are you solving with the product? What benefits have you realized?

I am not in the technical team so cannot answer this fully but from what i understand this was easy to set up

See full review on G2

Start free FusionReactor trial

Microservice support in FusionReactor 8.2.0

In FusionReactor 8.2.0 we have added support for the Java application Frameworks okHTML, Spring Boot and Micronaut.  This brings the list of supported Java application frameworks to; Spring framework, Spring Boot, okHTML, Micronaut, Struts 2, Play, Vaadin, JSF, Vertx, Grizzly and Jersey.

In this blog, we look at why Microservices are beneficial to organizations, things to consider when using microservices and how different Microservices are tracked in FusionReactor.

Why tracking Microservices is important?

Software architecture using Microservices divides a system into a number of smaller and simpler services. These services are independent of each other and typically communicate with each other through REST calls. These independent services can use different languages, Frameworks and environments making the infrastructure very flexible.

Using Microservices breaks down the monolithic applications you currently run into more maintainable apps. While initially converting applications to Microservices can be time-consuming the long term benefits are definitely worth it in most cases.

There are many benefits to using a Microservice-based architecture, with the 5 biggest benefits being

Building and maintaining your environment is quicker and easier

 As the code of a service is smaller and less complex, creating the base functionality required for the application a very simple process. Often a template can be created and reused so bootstrapping a new service takes minutes.

You are not limited to a specific language or Framework and do not have to worry about the libraries or databases used in this service being incompatible with libraries or databases of a separate service.

Structured around the needs of an organisation, not a speciality in a particular language

With Monolithic projects, it is common that one team will own and manage the development of an entire project. Any work required for this product must be done by a single team, which can quickly cause delays in features being available.

Microservices, on the other hand, can be developed by an engineer of any team. If additional functionality is required, rather than adding to an additional project they simply create a new service to supply the functionality they require.

Improved reliability and speed of bug resolution 

The large and more complex the applications are, the harder it is to track down issues. Having smaller and simpler apps means that writing automated and manual testing is more simple; often most unit tests can be autogenerated to some extent from your IDE.

Finding any issues is a quick process as there are hopefully no large functions that try to do too much in a single function.

Infinitely scalable

There is nothing worse than being limited to how and if you can scale your application. With a large application where you may have complex dependencies and threading models, scaling will be difficult to configure and sometimes impossible.

If all you have is a series of small apps that communicate with each other to access information, there are no dependency concerns. If the way you are currently scaling is no longer the best solution switching to a new approach has very little risk

It’s perfect for SCRUM

Scrum promotes Cross-functional small teams where any member of the team can do every required task. It does not matter if these teams are in the same location or other sides of the world.

When every developer is working on the same application and often the same module of the application it can get messy, but if everything is independent of the components around it you can be truly cross-functional and not get in each other’s way.

Considerations when using Microservices

When using microservices you can gain a lot, but there are certain things you should keep in mind when implementing Microservices in your infrastructure.

Documentation is vital

When you have hundreds of potential APIs that are running, knowing the available routes for each API and the restrictions in place for that route is something that must be documented.

When creating routes, naming conventions and versioning of APIs must be carefully thought out to keep the service simple and understandable. A route should have one task only and if a change is needed a new version should be created.

Automation is key

Automated testing and deploys will make or break a Microservice-based architecture. 

If new services are being created regularly and being worked on constantly, having unit tests capable the individual functions and integration tests to ensure the connectivity into the API is critical to ensuring the stability of your application.

Keeping your services on the most up to date version of the code as you scale up your environment can quickly become a challenge. At this point, having a staging environment and auto deployments to keep your services up to date becomes a priority.

Transparency is a must

Finding issues within microservices is a challenge, with the code being split into so many smaller components.

If a user reports an issue in your application, knowing exactly which service has an issue is not simple. In order to find these issues, you need to be able to see the traffic running on your server and any the reason for any errors that are occurring. 

You could use logs for this, but the best way to track your Microservice deployment is with an Application Performance Monitor (APM). An APM will give you metrics on the server traffic and tools to help you track down the root cause of errors.

Tracked framework examples

Spring Boot

Spring boot is the most commonly used framework in Java, it makes developing applications from web apps, to complex APIs very simple with it’s structured MVC layout. It’s JDBC extraction makes integrating with SQL and NoSQL DBs simple and it’s simple testability add ons that make automated testing quick and simple.

In FusionReactor Spring boot your request will be deconstructed into it their individual controller and hibernate calls.

In our example, we see a call to add an item to a shopping cart. We can see the addToCart method being called within the CartController and the individual JDBC calls made during the execution, as well as the final redirect call.

In the details of our request, we get a breakdown of each action in the execution of our request.

For requests with errors the full stack and an EventSnapshot is captured to get you to the root of your issue quickly

Micronaut

First Introduced in May 2018, Micronaut is a fairly new framework to be introduced to Java. It allows users to build scalable and performant applications in Java, Kotlin or Groovy. With its reactive HTTP server and client capabilities, efficient compile-time injection and well thought out features for microservice development. It is perfect for applications where heavier MVC frameworks are not an option.

With Mirconaut, the request and response are tracked as two different transactions. When the response transaction is complete the response object will be linked to the request object. For each transaction, you see the status code, protocol and request URL.

In each transaction, you see Headers and Cookies. Unfortunately, JSON tracking is not currently available for Micronaut, this is something we are working on but as of yet have not been able to implement.

OkHTTP

okHTTP is a popular alternative to the Apache HTTP Client for making HTTP / HTTPS calls from within your Java application. It is efficient with HTTP and HTTP2 clients, with advanced connection pooling and the ability to recover from common connection problems.

okHTTP request, you will see that each HTTP call is tracked as its own transaction. The transaction has a parent of the Web Request that contained the okHTTP call.

In the request we track any JSON data send and received in the response, as well as the headers and cookies of the request.

ColdFusion Class Checker

FusionReactor is used to monitor many ColdFusion servers but our support team keeps seeing an issue that FusionReactor cannot solve.

This issue is that some of the ColdFusion classes, for the template cache, become corrupt.  This corruption isn’t caused by ColdFusion itself but when users or Windows Updates shut down the running instance.  If ColdFusion is in the middle of a class compilation operation when the shutdown occurs then ColdFusion leaves the half written file on disk.

These corrupt files can also occur due to file system issues, especially if the ColdFusion directory is stored on a network share.

When our support team is working with customers with 15,000+ ColdFusion classes in their template cache directory ( e.g /opt/coldfusion9/wwwroot/WEB-INF/cfclasses/ ) and attempting to track down a specific issue in the template cache, there is no simple solution to find the offending file.

We decided to write a tool to track down where these issues were so that we didn’t have to wipe out the complete template cache.

The ColdFusion Class Checker will scan the directory and ensure that all the class files can be successfully parsed.

Usage

usage: java -jar cfclasschecker.jar

ColdFusion Class Checker.
This tool is designed to find issues with template cache directory.
 -d,--directory <arg>   the directory to scan.
 -h,--help              help
 -v,--verbose           verbose

Copyright © 2016-2019 Intergral GmbH. All rights reserved.

Download

Download : https://intergral-dl.s3-us-west-1.amazonaws.com/ColdFusion/Tools/cfclasschecker.jar

Example

Here is a quick example of how to run the tool and how errors are shown.

$ java -jar cfclasschecker.jar -d /opt/coldfusion9/wwwroot/WEB-INF/cfclasses/<br>ERROR : /opt/coldfusion9/wwwroot/WEB-INF/cfclasses/cfpostNumericMetricFloat2ecfm551476648.class is INVALID
$

This shows 1 invalid class file in the coldfusion9 cfclasses directory that.   You can simply delete this file and ColdFusion will generate the class again next time it needs too.

What’s new in 8.2

FusionReactor 8.2 has now been released; this release has been modelled around user feedback.

what is LDAP?

Lightweight Directory Access Protocol (LDAP) is a client/server protocol used to access and manage directory information. It reads and edits directories over IP networks and runs directly over TCP/IP using simple string formats for data transfer. It was originally developed as a front end to X.500 Directory Access Protocol.

LDAP tends to be used by larger enterprises, Government and Education sectors, but anyone can use it. 

What it means for FusionReactor users that already use LDAP / Active Directory  is the ability to have multiple logins and roles. So in a nutshell; no more sharing passwords with your colleagues.

Spring Boot is now one of the most popular Java Frameworks

As more developers are adopting the use of microservices we have taken a long look at which ones we support. It makes sense to support the most popular. In recent years the growth of Spring Boot has been incredible and it was therefore a no brainer to ensure that we fully support it.

We have been supporting both the Spring Framework and Play frameworks for a number of years.

okHTTP is a faster alternative to HTTPClient

okHTTP is better for HTTP 2.0 calls and many frameworks are moving to this. okHTTP is faster than HTTPClient as it only supports the new standards. Once again many of our FR clients have asked us to look at finding a faster alternative to HTTPClient and we believe okhttP is the answer.

Micronaut is a new java framework

Micronaut is a modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications. Just like Grizzly, Jersey and Spring Boot, Micronaut makes writing microservices really easy. Micronaut’s Cloud support is built right in, including support for common discovery services, distributed tracing tools, and cloud runtimes.

FR Sponsor key CF events

Event season is nearly here and this year we are sponsoring ColdFusion events both in Europe and across the pond. We are Platinum Sponsor of CF Summit in Las Vegas  1st and 2nd October then the Silver sponsor of CF Camp 17th and 18th October; in Munich. 

Moving to November we are Innovator Sponsor at Velocity in Berlin.  For anyone wanting tickets; use the voucher code FusionReactor25 and get 25% off your Gold, Silver or Bronze passes – this could save you some serious money!

On Day one highlights

Matthew Clemente discusses building a CF docker swarm and Eric Peterson looks at utilizing reusable code through Coldbox modules. Bruno Zagay looks forward to the Super Bowl and explains how you should prepare for extra traffic.

Day 2 highlights

FusionReactor CEO David Tattersall explains how you can find performance issues in your CF code. Watch our good friend Charlie Arehart tell you how to get started with CF Docker containers.

As more CF developers look for cloud integration Brian Klass takes a look at AWS and how you control it.

There’s lots going on at CF Camp. Once Again Charlie Arehart makes a guest appearance as he takes a detailed look at monitoring solutions for CF and Lucee.

If you’re suffering performance and stability problems, there’s no substitute for having SOME kind of monitoring in place. But there are quite a variety of monitoring solutions available for ColdFusion and Lucee. How do you choose? (Or are they “all the same”? No!)

Brad Wood takes a look at solving common problems with common solutions using design patterns.

How unique is the problem you’re coding for right now? What’s the chance it’s been solved hundreds, maybe thousands of times? Is your solution the best way? You’ve no doubt heard other developers talk about using “design patterns”. These are reusable solutions to the problems that we all face as developers. The best thing is that most patterns can carry over from one language to another. It’s a great idea to familiarize yourself with these common solutions so you identify them and know when you plug them into your apps.