<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ClassCastException in agent log in Splunk AppDynamics</title>
    <link>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720736#M2182</link>
    <description>&lt;P&gt;Casting is the process of type conversion, which is in Java very common because its a statically typed language. &lt;A href="http://net-informations.com/java/basics/casting.htm" target="_self" rel="nofollow noopener noreferrer"&gt;Type Casting&lt;/A&gt; 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:&lt;/P&gt;&lt;P&gt;if (myApple instanceof Fruit) {&lt;BR /&gt;Fruit myFruit = (Fruit)myApple;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Here are some basic rules to keep in mind when casting variables:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Casting an object from a sub class to a super class doesn't require an explicit cast.&lt;/LI&gt;&lt;LI&gt;Casting an object from a super class to a sub class requires an explicit cast.&lt;/LI&gt;&lt;LI&gt;The compiler will not allow casts to unrelated types.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Mar 2022 06:24:26 GMT</pubDate>
    <dc:creator>markvanber</dc:creator>
    <dc:date>2022-03-15T06:24:26Z</dc:date>
    <item>
      <title>ClassCastException in agent log</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720734#M2180</link>
      <description>&lt;P&gt;I'm using 4.5.5.&lt;/P&gt;

&lt;P&gt;I created an exit point to track calls to java.sql.Connection.isValid() but it doesn't work.&amp;nbsp; Since then I've been seeing this error in the agent logs:&lt;/P&gt;

&lt;P&gt;[Log files redacted]&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;

&lt;P&gt;^ Post edited by&amp;nbsp;&lt;A href="https://community.appdynamics.com/t5/user/viewprofilepage/user-id/142051"&gt;@Ryan.Paredez&lt;/A&gt;&amp;nbsp;to remove log files. Please do not share or attach log files to community posts for security and privacy reasons.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 18:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720734#M2180</guid>
      <dc:creator>JohnGregg</dc:creator>
      <dc:date>2020-04-16T18:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: ClassCastException in agent log</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720735#M2181</link>
      <description>&lt;P&gt;&lt;A href="https://community.appdynamics.com/t5/user/viewprofilepage/user-id/142051"&gt;@Ryan.Paredez&lt;/A&gt;There is no way for someone to solve this problem without seeing the log message.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 18:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720735#M2181</guid>
      <dc:creator>JohnGregg</dc:creator>
      <dc:date>2020-04-21T18:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: ClassCastException in agent log</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720736#M2182</link>
      <description>&lt;P&gt;Casting is the process of type conversion, which is in Java very common because its a statically typed language. &lt;A href="http://net-informations.com/java/basics/casting.htm" target="_self" rel="nofollow noopener noreferrer"&gt;Type Casting&lt;/A&gt; 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:&lt;/P&gt;&lt;P&gt;if (myApple instanceof Fruit) {&lt;BR /&gt;Fruit myFruit = (Fruit)myApple;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Here are some basic rules to keep in mind when casting variables:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Casting an object from a sub class to a super class doesn't require an explicit cast.&lt;/LI&gt;&lt;LI&gt;Casting an object from a super class to a sub class requires an explicit cast.&lt;/LI&gt;&lt;LI&gt;The compiler will not allow casts to unrelated types.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 06:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/ClassCastException-in-agent-log/m-p/720736#M2182</guid>
      <dc:creator>markvanber</dc:creator>
      <dc:date>2022-03-15T06:24:26Z</dc:date>
    </item>
  </channel>
</rss>

