Splunk AppDynamics

ClassCastException in agent log

JohnGregg
Path Finder

I'm using 4.5.5.

I created an exit point to track calls to java.sql.Connection.isValid() but it doesn't work.  Since then I've been seeing this error in the agent logs:

[Log files redacted]

Any suggestions?

thanks

^ Post edited by @Ryan.Paredez to remove log files. Please do not share or attach log files to community posts for security and privacy reasons.

Labels (1)
Tags (1)
0 Karma

markvanber
Explorer

Casting is the process of type conversion, which is in Java very common because its a statically typed language. Type Casting only works when the casted object follows an is a relationship to the type you are trying to cast to. ClassCastException is a runtime exception raised in Java when you try to improperly cast a class from one type to another. It's thrown to indicate that the code has attempted to cast an object to a related class, but of which it is not an instance. It is good practice to guard any explicit casts with an instanceof check first:

if (myApple instanceof Fruit) {
Fruit myFruit = (Fruit)myApple;
}

In general, that's what a cast means: it tells the compiler that even though this assignment might fail, you're pretty certain that it won't. In exchange for allowing the code to compile, you assume the risk of a run-time exception.

Here are some basic rules to keep in mind when casting variables:

  • Casting an object from a sub class to a super class doesn't require an explicit cast.
  • Casting an object from a super class to a sub class requires an explicit cast.
  • The compiler will not allow casts to unrelated types.

Even when the code compiles without issue, an exception may be thrown at run time if the object being cast is not actually an instance of that class . This will result in the run time exception ClassCastException.

JohnGregg
Path Finder

@Ryan.ParedezThere is no way for someone to solve this problem without seeing the log message.

0 Karma
Get Updates on the Splunk Community!

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...

Getting Started with Splunk Artificial Intelligence, Insights for Nonprofits, and ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Splunk Observability Cloud’s AI Assistant in Action Series: Identifying Unknown ...

Agentic AI powers the Splunk AI Assistant within the Splunk Observability Cloud interface to help you quickly ...