You’ve added an extra level of abstraction by calling the method with reflection. The reflection layer wraps any exception in an InvocationTargetException
, which lets you tell the difference between an exception actually caused by a failure in the reflection call (maybe your argument list wasn’t valid, for example) and a failure within the method called.
Just unwrap the cause within the InvocationTargetException
and you’ll get to the original one.
Related Posts:
- How can I solve “java.lang.NoClassDefFoundError”?
- How to fix java.net.SocketException: Broken pipe?
- What is a StackOverflowError?
- What is reflection and why is it useful?
- How can I safely create a nested directory in Python?
- What is the proper way to handle a NumberFormatException when it is expected?
- Exception in thread “main” java.util.NoSuchElementException
- What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?
- How can I safely create a nested directory in Python?
- JavaFX – Exception in Application start method?
- JavaFX – Exception in Application start method? [duplicate]
- Given final block not properly padded
- What is an AssertionError? In which case should I throw it from my own code?
- EOFException – how to handle?
- Can I catch multiple Java exceptions in the same catch clause?
- Exception in thread “main” java.util.NoSuchElementException: No line found
- java.net.MalformedURLException: no protocol
- “NoClassDefFoundError: Could not initialize class” error
- unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
- Exception in thread “main” java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0)
- “NoClassDefFoundError: Could not initialize class” error
- “NoClassDefFoundError: Could not initialize class” error
- Why do I get an UnsupportedOperationException when trying to remove an element from a List?
- Why do I get “Exception; must be caught or declared to be thrown” when I try to compile my Java code?
- What is difference between Errors and Exceptions?
- Causes of getting a java.lang.VerifyError
- How to create a custom exception type in Java?
- Implementation of Vector in C++
- java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES)
- Exception in thread “main” java.lang.ArithmeticException: / by zero
- Java can’t find file when running through Eclipse
- Java Reflection – Object is not an instance of declaring class
- How to create a generic array in Java?
- Instantiating object of type parameter
- MVC5 / C# – Cannot perform runtime binding on a null reference
- FXML Load exception
- Reflection generic get field value
- StringIndexOutOfBoundsException String index out of range: 0
- java.net.SocketException: Network is unreachable: connect
- java.lang.ClassNotFoundException:com.mysql.jdbc.Driver [duplicate]
- Connection Java – MySQL : Public Key Retrieval is not allowed
- Why is a ConcurrentModificationException thrown and how to debug it
- Throwing multiple exceptions in Java
- java.lang.ArrayIndexOutOfBoundsException: 0
- Official reasons for “Software caused connection abort: socket write error”
- How can I read a text file in Android?
- Exception is never thrown in body of corresponding try statement
- How can I catch all the exceptions that will be thrown through reading and writing a file?
- How can I convert IPV6 address to IPV4 address?
- Spring Boot – Unable to resolve Whitelabel Error Page
- What causes a java.lang.StackOverflowError
- JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState
- Why is this code throwing an InvalidOperationException?
- How to encrypt String in Java
- A long bigger than Long.MAX_VALUE
- How to capitalize the first letter of a String in Java?
- Scanner vs. BufferedReader
- Control an Arduino with Java
- Meaning of *= in Java
- Raw use of parameterized class
- :: (double colon) operator in Java 8
- What does ‘0’ do in Java?
- java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
- Service will not start: error 1067: the process terminated unexpectedly
- What’s the advantage of load() vs get() in Hibernate?
- What Java ORM do you prefer, and why?
- Always Round UP a Double
- Using Enum values as String literals
- How to change a package name in Eclipse?
- Are arrays passed by value or passed by reference in Java?
- What is the difference between the HashMap and Map objects in Java?
- How do I get “Press any key to continue” to work in my Java code?
- What does “?” mean in Java? [duplicate]
- How can I get the current stack trace in Java?
- java.util.zip.ZipException: error in opening zip file
- paint() and repaint() in Java
- Good Hash Function for Strings
- Error – Illegal static declaration in inner class
- Unreachable statement compile error in Java
- java.lang.ArrayIndexOutOfBoundsException: 4 Error
- error: incompatible types: char cannot be converted to String – Java
- Exception in thread “main” java.lang.reflect.InvocationTargetException
- mongoDB, connection refused
- Displaying Image in Java
- Median of Medians in Java
- Java: Custom Buttons in showInputDialog
- Invalid signature file digest for Manifest main attributes exception while trying to run jar file
- JAVA + try catch(FileNotFoundException e) going in catch(Exception e)?
- Using a do-while loop to check a User’s input in Java
- What is the proper annotation since @SpringApplicationConfiguration, @WebIntegration, is deprecated in Spring Boot Framework?
- How to write a test class to test my code?
- How do I exit a while loop in Java?
- Java String import
- Good way to encapsulate Integer.parseInt()
- Why int[] a = new int[1] instead of just int a?
- getOutputStream() has already been called for this response
- ArrayList of int array in java
- Pass object by reference in Java
- What is object serialization?
- How do I use StringUtils in Java?