Tag Archives: reflex

java.lang.reflect.InvocationTargetException

java.lang.reflect.InvocationTargetException

Bad writing

The cause of the bug:
in the service layer, the value passed in by the public list findbyproperty (string propertyname, object value) {} method service of Dao layer is a value of string type, so an error is reported;

Modification:
rewrite the object type of Dao layer to string type to fix the bug.

Class file for com.sun.beans.introspect.propertyinfo not found

  The following error occurred when executing Maven install:

  Find the error in the code:

	
	PropertyDescriptor pd = null;
	try { 
             pd = new PropertyDescriptor(fields[j].getName(),entity.getClass()); 
         }catch (IntrospectionException e1) {
               e1.printStackTrace(); 
     }
     Method getMethod = pd.getReadMethod();

It turns out that we are creating a propertydescriptor   This is to get the get method of the entity class to read the value in the object. We find the construction method of this class

Previously, we encountered that the com.sun jar could not be loaded. For example, the previous Base64 was also under com.sun, and it could not be loaded every time it was started

How to solve: introduce this class:

import org.springframework.beans.BeanUtils;

	PropertyDescriptor pd = null;
	/*
	 * try {
     *      pd = new  PropertyDescriptor(fields[j].getName(),entity.getClass()); 
     *     }catch (IntrospectionException e1) {
     *       e1.printStackTrace();
     *      }
	 */
					 
     pd=BeanUtils.getPropertyDescriptor(entity.getClass(),fields[j].getName()); 
	 Method getMethod = pd.getReadMethod();

Hope to help you