Java初始化PropertyDescriptor类时出现错误。

尝试初始化一个PropertyDescriptor类时出现了一个错误,我通过反射得到了一个类的Field,尝试通过这个属性以及该类的类类型得到该field的get方法。但是tomcat却抛出了一个异常。异常信息如下:
java.beans.IntrospectionException: Method not found: isSerialVersionUID
at java.beans.PropertyDescriptor.(Unknown Source)
at java.beans.PropertyDescriptor.(Unknown Source)
at com.scai.sna.web.controller.BlacklistApplicationController.setBlackImport(BlacklistApplicationController.java:170)
at com.scai.sna.web.controller.BlacklistApplicationController.doImport(BlacklistApplicationController.java:149)
at com.scai.sna.web.controller.BlacklistApplicationController$$FastClassBySpringCGLIB$$7af9d16.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at com.scai.sna.web.controller.BlacklistApplicationController$$EnhancerBySpringCGLIB$$f5ab4b3f.doImport()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.scai.core.web.handler.HandlerExecutionChainWrapper$ControllerXssInterceptor.intercept(HandlerExecutionChainWrapper.java:118)
at com.scai.sna.web.controller.BlacklistApplicationController$$EnhancerByCGLIB$$abc57a15.doImport()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:741)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at com.scai.core.web.annotation.RequestMappingHandlerAdapter$$EnhancerBySpringCGLIB$$7c475d63.handleInternal()
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at com.scai.core.factory.SpringDispatcherServlet.service(SpringDispatcherServlet.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.scai.web.support.filter.FrameworkFilter.doFilter(FrameworkFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

            然后我从网上找到了一个说可以解决该问题的方法。为controller实现一个序列化类,并生成serialVersionUID,但是这个对于我来说似乎并不能解决该问题。错误和上面的一样,希望能够解决这个问题。
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.beans.PropertyDescriptor"错误

List<DivAppRecruitInfo> list2=(List<DivAppRecruitInfo>) JSONArray.toList(JSONArray.fromObject(result), DivAppRecruitInfo.class); 我已经从服务端获取到json格式的字符串数据了,想要把json字符串转化成对象,需要使用JSONObject和JSONArray,网上说要下 commons-beanutils.jar commons-lang.jar commons-collections.jar commons-logging.jar json-lib-2.2.3-jdk15.jar ezmorph-1.0.6.jar。 我都下了,但是运行就报错Caused by: java.lang.NoClassDefFoundError: Failed resolution of: [Ljava/beans/PropertyDescriptor 这是什么意思啊; 请各位有经验的Android开发者帮忙看下,感激不尽,

java IntrospectionException异常

``` new CRPropertyDescriptor("tableData", this.data.getClass()).setI18NName("数据集").setEditorClass(TableDataEditor.class).setRendererClass(TableDataRenderer.class), new CRPropertyDescriptor("dictionary", this.data.getClass()).setI18NName(Inter.getLocText("DS-Dictionary")).setEditorClass(DictionaryEditor.class).setRendererClass(DictionaryRenderer.class) } ``` 同样的两行代码,第一行生成 tabledata 完全没问题,但是第二行生成 dictionary 就会抛出异常,请问出现下面这种错误信息的原因一般都是什么呢?我现在有点不值该从哪下手 ``` Method not found: isDictionary at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:106) at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:70) ```

java 怎么得到字段的泛型

```java public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint> extends RequestMappingHandlerMapping { private final Set<E> endpoints; } ``` 怎么根据属性endpoints得到E的具体类型呢, 已知 endpoints 的 PropertyDescriptor

我用自己maven打的jar包里面的工具包报OGNL错误

错误位置代码: ``` Object o = session.get(Constants.MANAGER_USER); ``` 使用Constants的时候出现错误,急求啊! 错误如下: ``` Key "location" was not found on instance of ognl.MethodFailedException. Introspection information for the class is: {reason=java.beans.PropertyDescriptor[name=reason; propertyType=class java.lang.Throwable; readMethod=public java.lang.Throwable ognl.OgnlException.getReason()], getClass=public final native java.lang.Class java.lang.Object.getClass(), getLocalizedMessage=public java.lang.String java.lang.Throwable.getLocalizedMessage(), cause=java.beans.PropertyDescriptor[name=cause; propertyType=class java.lang.Throwable; readMethod=public synchronized java.lang.Throwable java.lang.Throwable.getCause()], java.lang.Object@20f2097b={public ognl.Evaluation ognl.OgnlException.getEvaluation()=[Ljava.lang.Class;@351d3546, public java.lang.String java.lang.Throwable.getLocalizedMessage()=[Ljava.lang.Class;@2e8d3d8f, public java.lang.String ognl.OgnlException.toString()=[Ljava.lang.Class;@253d3df4, public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)=[Ljava.lang.Class;@376d7802, public java.lang.String java.lang.Throwable.getMessage()=[Ljava.lang.Class;@6b06ccac, public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@2c20f506, public boolean java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@603eafeb, public synchronized java.lang.Throwable java.lang.Throwable.getCause()=[Ljava.lang.Class;@3ccf6686, public void ognl.OgnlException.setEvaluation(ognl.Evaluation)=[Ljava.lang.Class;@6171ae1f, public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])=[Ljava.lang.Class;@4a52fff2, public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()=[Ljava.lang.Class;@5f8640a4, public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable)=[Ljava.lang.Class;@183af684, public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()=[Ljava.lang.Class;@7457b2ca, public java.lang.Throwable ognl.OgnlException.getReason()=[Ljava.lang.Class;@29276edd, public final native java.lang.Class java.lang.Object.getClass()=[Ljava.lang.Class;@4449883d, public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()=[Ljava.lang.Class;@b88c8e6}, getCause=public synchronized java.lang.Throwable java.lang.Throwable.getCause(), evaluation=java.beans.PropertyDescriptor[name=evaluation; propertyType=class ognl.Evaluation; readMethod=public ognl.Evaluation ognl.OgnlException.getEvaluation()], getStackTrace=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(), addSuppressed=public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable), hashCode=public native int java.lang.Object.hashCode(), getSuppressed=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed(), suppressed=java.beans.PropertyDescriptor[name=suppressed; propertyType=class [Ljava.lang.Throwable;; readMethod=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()], stackTrace=java.beans.PropertyDescriptor[name=stackTrace; propertyType=class [Ljava.lang.StackTraceElement;; readMethod=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()], class=java.beans.PropertyDescriptor[name=class; propertyType=class java.lang.Class; readMethod=public final native java.lang.Class java.lang.Object.getClass()], getEvaluation=public ognl.Evaluation ognl.OgnlException.getEvaluation(), localizedMessage=java.beans.PropertyDescriptor[name=localizedMessage; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getLocalizedMessage()], printStackTrace=freemarker.ext.beans.OverloadedMethods@4200fabf, java.lang.Object@71ff185a=freemarker.ext.beans.OverloadedMethods@504335a4, getReason=public java.lang.Throwable ognl.OgnlException.getReason(), initCause=public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable), getMessage=public java.lang.String java.lang.Throwable.getMessage(), message=java.beans.PropertyDescriptor[name=message; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getMessage()], setEvaluation=public void ognl.OgnlException.setEvaluation(ognl.Evaluation), setStackTrace=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]), equals=public boolean java.lang.Object.equals(java.lang.Object), toString=public java.lang.String ognl.OgnlException.toString(), fillInStackTrace=public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()} 2017-07-09 12:02:15,839 [http-apr-8080-exec-6] DEBUG [freemarker.beans] - Key "location" was not found on instance of java.lang.NoSuchFieldError. Introspection information for the class is: {getClass=public final native java.lang.Class java.lang.Object.getClass(), localizedMessage=java.beans.PropertyDescriptor[name=localizedMessage; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getLocalizedMessage()], printStackTrace=freemarker.ext.beans.OverloadedMethods@419b5593, getLocalizedMessage=public java.lang.String java.lang.Throwable.getLocalizedMessage(), java.lang.Object@71ff185a=freemarker.ext.beans.OverloadedMethods@556c0a17, initCause=public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable), cause=java.beans.PropertyDescriptor[name=cause; propertyType=class java.lang.Throwable; readMethod=public synchronized java.lang.Throwable java.lang.Throwable.getCause()], java.lang.Object@20f2097b={public java.lang.String java.lang.Throwable.getLocalizedMessage()=[Ljava.lang.Class;@45a9bb16, public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)=[Ljava.lang.Class;@72b70fee, public java.lang.String java.lang.Throwable.getMessage()=[Ljava.lang.Class;@691bebe6, public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@5c926860, public boolean java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@546b09ef, public synchronized java.lang.Throwable java.lang.Throwable.getCause()=[Ljava.lang.Class;@1ee9b4f3, public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])=[Ljava.lang.Class;@281b2813, public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()=[Ljava.lang.Class;@67858418, public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable)=[Ljava.lang.Class;@6badcd76, public java.lang.String java.lang.Throwable.toString()=[Ljava.lang.Class;@38b0b2dc, public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()=[Ljava.lang.Class;@499a4e69, public final native java.lang.Class java.lang.Object.getClass()=[Ljava.lang.Class;@2f4b606, public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()=[Ljava.lang.Class;@7b70d53}, getMessage=public java.lang.String java.lang.Throwable.getMessage(), message=java.beans.PropertyDescriptor[name=message; propertyType=class java.lang.String; readMethod=public java.lang.String java.lang.Throwable.getMessage()], getCause=public synchronized java.lang.Throwable java.lang.Throwable.getCause(), setStackTrace=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]), getStackTrace=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(), addSuppressed=public final synchronized void java.lang.Throwable.addSuppressed(java.lang.Throwable), hashCode=public native int java.lang.Object.hashCode(), equals=public boolean java.lang.Object.equals(java.lang.Object), toString=public java.lang.String java.lang.Throwable.toString(), getSuppressed=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed(), suppressed=java.beans.PropertyDescriptor[name=suppressed; propertyType=class [Ljava.lang.Throwable;; readMethod=public final synchronized java.lang.Throwable[] java.lang.Throwable.getSuppressed()], stackTrace=java.beans.PropertyDescriptor[name=stackTrace; propertyType=class [Ljava.lang.StackTraceElement;; readMethod=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()], class=java.beans.PropertyDescriptor[name=class; propertyType=class java.lang.Class; readMethod=public final native java.lang.Class java.lang.Object.getClass()], fillInStackTrace=public synchronized java.lang.Throwable java.lang.Throwable.fillInStackTrace()} ```

int apache下PropertyUtils.getWriteMethod()为什么返回null

``` public class A implements java.io.Serializable { private static final long serialVersionUID = 1L; private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } } ``` ``` public static void main(String[] args) { A a = new A(); PropertyDescriptor[] e = PropertyUtils.getPropertyDescriptors(a); System.out.println(e[0].getWriteMethod()); // null } ``` 以上(Integer也一样),为什么使用反射,这个方法返回null,其他类似:String,long,java.util.Date类似的都没有返回null,有研究的前辈指点后生一下,在线等!不胜感激!

javabean报错java.lang.ClassNotFoundException

如题,只是书上的简单例子,三个类放在一个包中,用IntrospectorDemo去解析Colors类,系统提示java.lang.ClassNotFoundException。不知道哪边有问题。 import java.beans.*; public class IntrospectorDemo { public static void main(String[] args) { try{Class<?> c=Class.forName("Colors"); BeanInfo beanInfo=Introspector.getBeanInfo(c); System.out.println("Properties:"); PropertyDescriptor propertyDescriptor[]=beanInfo.getPropertyDescriptors(); for(int i=0;i<propertyDescriptor.length;i++) {System.out.println(propertyDescriptor[i].getName());} System.out.println("Events:"); EventSetDescriptor eventSetDescriptor[]=beanInfo.getEventSetDescriptors(); for(int i=0;i<eventSetDescriptor.length;i++) {System.out.println(eventSetDescriptor[i].getName());} }catch(Exception e) {System.out.println(e);} } } import java.awt.*; import java.awt.event.*; import java.beans.*; import java.io.*; public class ColorsBeanInfo extends SimpleBeanInfo { public PropertyDescriptor[] getPropertyDescriptors() { try{PropertyDescriptor rectangular=new PropertyDescriptor("rectangular",Colors.class); PropertyDescriptor pd[]={rectangular}; return pd; } catch(Exception e) {System.out.println(e);} return null; } } public class Colors extends Canvas implements Serializable{ transient private Color color; private boolean rectangular=false; public Colors() { addMouseListener(new MouseAdapter(){ public void mousePressed(MouseEvent me){change();} }); setSize(200,100); change(); } public boolean getRectangular() {return rectangular;} public void setRectangular(boolean flag) {this.rectangular=flag; repaint();} public void change() {color=randomColor(); repaint();} private Color randomColor() {int r=(int)(255*Math.random()); int g=(int)(255*Math.random()); int b=(int)(255*Math.random()); return new Color(r,g,b); } public void paint(Graphics g) { Dimension d=getSize(); int h=d.height; int w=d.width; g.setColor(color); if(rectangular){g.fillRect(0, 0, w-1, h-1);} else {g.fillOval(0, 0, w-1, h-1);} } }

java.lang.IllegalArgumentException: object is not an instance of declaring class

目的:将目标xml的内容解析到一个java对象里边(xml的各个标签有对应的java类,并且有包含关系)。 ----------------------------------------------------------------------------------- NginxCache配置文件: <?xml version="1.0" encoding="utf-8"?> <nginx-cache> <cacheable> <include> <pattern params="a,b"> XXXAction/getXXX.rdm </pattern> <pattern params="a,b"> XXXBction/getXXX.rdm </pattern> </include> <exclude> <pattern params=""> XXXAction/getXXX.rdm </pattern> <pattern params=""> XXXBction/getXXX.rdm </pattern> </exclude> </cacheable> <cache-evict> <act pattern="XXXAction/addXXX.rdm" params="a,b"> <evict pattern="" methodRef=""> </evict> <evict pattern="" methodRef=""> </evict> </act> <method id="" name="" class="" returnType=""> <param index="1" default="c"></param> <param index="2" value="a"></param> </method> <method id="" name="" class="" returnType=""> <param index="1" default="c"></param> <param index="2" value="a"></param> </method> </cache-evict> </nginx-cache> --------------------------------------------------------------------------------- 对应的java类 --------------------------------------------------------------------------------- 具体设计思路:在解析到某个Element时调用 traverseOneElement(Element element,Object oneObj)方法;//element是遍历到对应的节点,oneObj是这个节点对应的对象。(刚开始只需要传一个确定的根类的对象即可) 在这个方法里遍历这个element的子节点,对每个子节点的element的Name用反射动态的创建对象,然后利用反射动态调用oneObj set方法,将对应的子节点对象set进去,然后,再调用 traverseOneElement(Element child_element,Object child_Obj);这样设计的, 第一次能设置成功,但是到第二次用子对象来get某个属性的时候会报这个错,不知道啥原因,请高手指教!!! ---------------------------------------------------------------------------------- 报错: java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.iwint.rdm.utils.RDMPropertyUtil.getProperty(RDMPropertyUtil.java:60) at com.iwint.rdm.nginxcache.bean.NginxCache.traverseOneElement(NginxCache.java:91) at com.iwint.rdm.nginxcache.bean.NginxCache.main(NginxCache.java:79) ------------------------------------------------------------------------------ package com.iwint.rdm.nginxcache.bean; import java.util.Iterator; import java.util.Map; import org.apache.commons.collections.map.HashedMap; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; import com.iwint.rdm.utils.Dom4jUtil; import com.iwint.rdm.utils.RDMPropertyUtil; /** * @ClassName: NginxCache * @Description: 解析NginxCache.xml用的标签类。 * @author yuanchangyou * @date 2013-9-27 * */ public class NginxCache { private static Map<String,String> classAndBiaoqian; private static NginxCache nginxCache=new NginxCache(); private Cacheable cacheable=new Cacheable(); private CacheEvict cacheEvict=new CacheEvict(); public NginxCache() { } public Cacheable getCacheable() { return cacheable; } public CacheEvict getCacheEvict() { return cacheEvict; } public void setCacheable(Cacheable cacheable) { this.cacheable = cacheable; } public void setCacheEvict(CacheEvict cacheEvict) { this.cacheEvict = cacheEvict; } public static NginxCache parseNginxCache() throws InstantiationException, IllegalAccessException, ClassNotFoundException{ //产生一个解析器对象 SAXReader reader = new SAXReader(); Document document = Dom4jUtil.parse2Document("D:/work/newEclipseWorkSpaces/rdm/src/main/resources/config/NginxCache.xml"); //获取文档的根元素 Element root = document.getRootElement(); NginxCache nginxcache=new NginxCache(); System.out.println(root.getName()); if(root.getName().equals("nginx-cache")) //遍历节点 traverseOneElement(root,nginxcache); return null; } public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException { classAndBiaoqian=new HashedMap(); classAndBiaoqian.put("nginx-cache", NginxCache.class.getName()); classAndBiaoqian.put("cacheable", Cacheable.class.getName()); classAndBiaoqian.put("pattern", UrlIPattern.class.getName()); classAndBiaoqian.put("cache-evict", CacheEvict.class.getName()); classAndBiaoqian.put("nginx-cache", Act.class.getName()); classAndBiaoqian.put("include","include"); classAndBiaoqian.put("exclude", "exclude"); // parseNginxCache(); SAXReader reader = new SAXReader(); Document document = Dom4jUtil.parse2Document("D:/work/newEclipseWorkSpaces/rdm/src/main/resources/config/NginxCache.xml"); //获取文档的根元素 Element root = document.getRootElement(); // NginxCache nginxcache=new NginxCache(); // if(root.getName().equals("nginx-cache")) //遍历根节点 traverseOneElement(root,nginxCache); } public static void traverseOneElement(Element element,Object oneObj) throws InstantiationException, IllegalAccessException, ClassNotFoundException{ // if(element.getName().equals("nginx-cache")){} Object chdil; System.out.println(element.getName()); for( Iterator iter = element.elementIterator(); iter.hasNext();){ Element elmt=(Element) iter.next(); if(elmt.getName().equals("cacheable")||elmt.getName().equals("cache-evict")){ chdil=RDMPropertyUtil.createObjByName(classAndBiaoqian.get(elmt.getName())); RDMPropertyUtil.setProperty(oneObj, elmt.getName(),chdil); Object chidObj=RDMPropertyUtil.getProperty(oneObj, elmt.getName()); traverseOneElement(elmt, chidObj); } else if(elmt.getName().equals("include")||elmt.getName().equals("exclude")||elmt.getName().equals("act")||elmt.getName().equals("method")){ Object newchil=RDMPropertyUtil.getProperty(oneObj,classAndBiaoqian.get(elmt.getName())); traverseOneElement(elmt, newchil); } else if(elmt.getName().equals("pattern")||elmt.getName().equals("param")){ } } } } ---------- package com.iwint.rdm.utils; import java.lang.reflect.Method; import java.lang.reflect.Field; import java.beans.PropertyDescriptor; public class RDMPropertyUtil { public static PropertyDescriptor getPropertyDescriptor(Class clazz, String propertyName) { StringBuffer sb = new StringBuffer(); // 构建一个可变字符串用来构建方法名称 Method setMethod = null; Method getMethod = null; PropertyDescriptor pd = null; try { Field f = clazz.getDeclaredField(propertyName); // 根据字段名来获取字段 if (f != null) { // 构建方法的后缀 String methodEnd = propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); sb.append("set" + methodEnd); // 构建set方法 setMethod = clazz.getDeclaredMethod(sb.toString(), new Class[] { f.getType() }); sb.delete(0, sb.length());// 清空整个可变字符串 sb.append("get" + methodEnd); // 构建get方法 // 构建get 方法 getMethod = clazz.getDeclaredMethod(sb.toString(), new Class[] {}); // 构建一个属性描述器 把对应属性 propertyName 的 get 和 set 方法保存到属性描述器中 pd = new PropertyDescriptor(propertyName, getMethod, setMethod); } } catch (Exception ex) { ex.printStackTrace(); } return pd; } //动态调用obj对象的set方法(propertyName为属性名,value为值) public static void setProperty(Object obj, String propertyName, Object value) throws InstantiationException, IllegalAccessException { if(obj==null){ obj=obj.getClass().newInstance(); } Class clazz = obj.getClass();// 获取对象的类型 PropertyDescriptor pd = getPropertyDescriptor(clazz, propertyName); // 获取 clazz 类型中的 propertyName 的属性描述器 Method setMethod = pd.getWriteMethod();// 从属性描述器中获取 set 方法 try { setMethod.invoke(obj, new Object[] { value });// 调用 set // 方法将传入的value值保存属性中去 } catch (Exception e) { e.printStackTrace(); } } //动态调用obj对象的get方法(propertyName为属性名) public static Object getProperty(Object obj, String propertyName) throws InstantiationException, IllegalAccessException { Class clazz = obj.getClass();// 获取对象的类型 // 获取clazz类型中的propertyName的属性描述器 PropertyDescriptor pd = getPropertyDescriptor(clazz, propertyName); Method getMethod = pd.getReadMethod();// 从属性描述器中获取 get 方法 Object value = null; try { value = getMethod.invoke(clazz, new Object[] {});// 调用方法获取方法的返回值 } catch (Exception e) { e.printStackTrace(); } return value;// 返回值 } //动态创建一个对象,classname 为该类的全名 public static Object createObjByName(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException{ return Class.forName(className).newInstance(); } }

argument type mismatch 参数类型不匹配的问题

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); try { User u = new User(); System.out.println("封装数据前:"+u); //获取表单数据 Map<String,String[]> map = request.getParameterMap(); for (Map.Entry<String, String[]> m : map.entrySet()) { String name = m.getKey(); String[] value = m.getValue(); //创建一属性描述器 PropertyDescriptor pd = new PropertyDescriptor(name,User.class); //得到setter属性 Method setter = pd.getWriteMethod(); if(value.length==1){ setter.invoke(u, value[0]);//给一个值的变量赋值 }else{ setter.invoke(u, (Object)value);//相当于给复选框赋值 } } System.out.println("封装数据后:"+u); } catch (Exception e) { e.printStackTrace(); } } ``` ``` 报错: 封装数据前:User [userName=null, pwd=null, sex=null, hobby=null, city=null] java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at Demon.servlet.servletDemo3.doGet(servletDemo3.java:39) at Demon.servlet.servletDemo3.doPost(servletDemo3.java:80) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) 这个是哪里错了

JAVA Class 获取父类名称

![图片说明](https://img-ask.csdn.net/upload/201810/06/1538805781_836851.png)

java 泛型接口add 拼写出errors 无法进行添加操作

正在学习泛型接口 在底层代码中 insert into web_student_school_name(errors,name)values(?,?) [{}, 四川大学] 拼写出errors 无法进行数据库添加操作 java.sql.SQLException: Unknown column 'errors' in 'field list' Query: insert into web_student_school_name(errors,name)values(?,?) Parameters: [{}, 四川大学] at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:542) at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:599) at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:655) at cn.bangbangjiao.cd.dao.impl.BaseDAO.update(BaseDAO.java:19) at cn.bangbangjiao.cd.dao.impl.GenericDAOImpl.add(GenericDAOImpl.java:73) at bangbangjiao.TestDAOImpl.testschool(TestDAOImpl.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 报错的basedao public class BaseDAO { private QueryRunner queryRunner = new QueryRunner(DBUtil.getdatasouce()); /** * 专门用来执行 update insert delete 这样的sql * @param sql * @param params */ public void update(String sql, Object... params){ try { queryRunner.update(sql, params); } catch (SQLException e) { e.printStackTrace(); } } public <T> T query(String sql, ResultSetHandler<T> rsh, Object... params){ try { return queryRunner.query(sql, rsh, params); } catch (SQLException e) { e.printStackTrace(); } return null; } 下列是add泛型实现 public void add(T t) { StringBuilder insertSql = new StringBuilder("insert into ").append(getTable()).append("("); // values(?, StringBuilder valueSql = new StringBuilder("values("); try { List<Object> params = new ArrayList<>();//专门用来存放数据对应的值,这些值要为sql中的占位符赋值. //>>1.通过javabean的自省机制出去this.clazz中的所有属性对应的get方法 BeanInfo beanInfo = Introspector.getBeanInfo(this.clazz,Object.class); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { //>>2.根据属性的名字往sql上面拼?,并且属性的名字是id的话就不要拼了 String proertyName = propertyDescriptor.getName(); //dir if("id".equals(proertyName)){ continue; } //>>3.得到属性的类型 Class propertyType = propertyDescriptor.getPropertyType();//ProductDir类型 Object value = propertyDescriptor.getReadMethod().invoke(t);//productdir对象 if(propertyType.isAnnotationPresent(Entry.class)){ proertyName = proertyName+"_id"; //dir_id //得到productdir的类型,然后再从该类型上面得到getid方法, 再讲getid方法在productdir对象执行 value = value.getClass().getMethod("getId").invoke(value);//得到dir属性的id值. } insertSql.append(proertyName).append(","); valueSql.append("?,"); //>>3.从t对象中读到响应的属性值 params.add(value); } /* System.out.println(insertSql); System.out.println(valueSql);*/ insertSql.replace(insertSql.length()-1, insertSql.length(), ")");//去掉 valueSql.replace(valueSql.length()-1, valueSql.length(), ")"); insertSql.append(valueSql); System.out.println(insertSql); System.out.println(params); update(insertSql.toString(), params.toArray()); } catch (Exception e) { e.printStackTrace(); } }

如何反射取得一个类中的静态常量?

如何反射取得一个类中的静态常量? 如: [code="java"] public class User { public static final String teacher = "json"; private String id; private String name; ... [/code] 取得teacher 怎么取呢?

jeecg框架问题 急!!!

控制台报错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'templetContext': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'freemarker' defined in URL [file:/I:/apache-tomcat-7.0.67/webapps/jfarm/WEB-INF/classes/org/jeecgframework/web/cgform/common/spring-mvc-cgform.xml]: Initialization of bean failed; nested exception is org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [freemarker.template.Configuration]; nested exception is java.beans.IntrospectionException: type mismatch between read and write methods at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1975) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'freemarker' defined in URL [file:/I:/apache-tomcat-7.0.67/webapps/jfarm/WEB-INF/classes/org/jeecgframework/web/cgform/common/spring-mvc-cgform.xml]: Initialization of bean failed; nested exception is org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [freemarker.template.Configuration]; nested exception is java.beans.IntrospectionException: type mismatch between read and write methods at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:549) at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303) ... 26 more Caused by: org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [freemarker.template.Configuration]; nested exception is java.beans.IntrospectionException: type mismatch between read and write methods at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:262) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:324) at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:331) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1242) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1101) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ... 37 more Caused by: java.beans.IntrospectionException: type mismatch between read and write methods at java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:661) at java.beans.PropertyDescriptor.setReadMethod(PropertyDescriptor.java:257) at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:282) at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:180) at org.springframework.beans.ExtendedBeanInfo.<init>(ExtendedBeanInfo.java:100) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:224) ... 43 more

tomcat启动报错

错误发生环境:tomcat6 web工程是spring+struts2 jdk 是ibm的1.6版本 具体错误信息: 2012-4-11 15:39:27 org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\IBMjava\java\bin;D:\apache-tomcat-6.0.18\bin 2012-4-11 15:39:27 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-82 2012-4-11 15:39:27 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 751 ms 2012-4-11 15:39:27 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 2012-4-11 15:39:27 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.18 2012-4-11 15:39:28 org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() 2012-4-11 15:39:28 org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() log4j:WARN Continuable parsing error 55 and column 23 log4j:WARN 元素类型“log4j:configuration”的内容必须与“(renderer*,appender*,plugin*,(category|logger)*,root?,(categoryFactory|loggerFactory)?)”匹配。 2012-4-11 15:39:30 org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext [ 2012年04月11日-15:39:30 ] [ INFO ] [ org.springframework.web.context.ContextLoader ] Root WebApplicationContext: initialization started [ 2012年04月11日-15:39:30 ] [ INFO ] [ org.springframework.web.context.support.XmlWebApplicationContext ] Refreshing org.springframework.web.context.support.XmlWebApplicationContext@3f143f14: display name [Root WebApplicationContext]; startup date [Wed Apr 11 15:39:30 CST 2012]; root of context hierarchy [ 2012年04月11日-15:39:30 ] [ INFO ] [ org.springframework.beans.factory.xml.XmlBeanDefinitionReader ] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] [ 2012年04月11日-15:39:31 ] [ INFO ] [ org.springframework.web.context.support.XmlWebApplicationContext ] Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@3f143f14]: org.springframework.beans.factory.support.DefaultListableBeanFactory@2e102e1 [ 2012年04月11日-15:39:31 ] [ INFO ] [ org.springframework.beans.factory.support.DefaultListableBeanFactory ] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2e102e1: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,jdbcTemplate,namedParameterJdbcTemplate,simpleJdbcTemplate,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,emailManageDao,noticeDao,emailManageService,noticeService,emailManageAction,noticeAction]; root of factory hierarchy [ 2012年04月11日-15:39:31 ] [ ERROR ] [ org.springframework.web.context.ContextLoader ] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0': Initialization of bean failed; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(AccessController.java:224) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:363) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:600) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.NullPointerException at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144) at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58) at java.beans.PropertyDescriptor.setWriteMethod(PropertyDescriptor.java:111) at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:77) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) ... 37 more 2012-4-11 15:39:31 org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0': Initialization of bean failed; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(AccessController.java:224) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:363) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:600) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.NullPointerException at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144) at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58) at java.beans.PropertyDescriptor.setWriteMethod(PropertyDescriptor.java:111) at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:77) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) ... 37 more 2012-4-11 15:39:31 org.apache.catalina.core.StandardContext start SEVERE: Error listenerStart 2012-4-11 15:39:31 org.apache.catalina.core.StandardContext start SEVERE: Context [/email] startup failed due to previous errors 2012-4-11 15:39:31 org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. 2012-4-11 15:39:31 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-82 log4j:ERROR Failed to flush writer, java.io.IOException: Write error at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:266) at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:343) at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:413) at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:417) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:163) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:263) at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:58) at org.apache.log4j.WriterAppender.writeFooter(WriterAppender.java:353) at org.apache.log4j.WriterAppender.close(WriterAppender.java:204) at org.apache.log4j.AppenderSkeleton.finalize(AppenderSkeleton.java:145) at java.lang.J9VMInternals.runFinalize(J9VMInternals.java:412) 2012-4-11 15:39:31 org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 2012-4-11 15:39:31 org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/46 config=null 2012-4-11 15:39:31 org.apache.catalina.startup.Catalina start INFO: Server startup in 4334 ms

使用json-lib的JSONObject.toBean( )时碰到的日期属性转换的问题

今天碰到这样一个问题: <br />当前台以JSON格式向后台传递数据的时候,对于数据中的日期属性,无法正常转换为相应的Date属性。 <br />JSON数据是这样的: <br />{"birthday":"1980/01/01","name":"testname"} <br /> <br />我要转换成的类是这样的: <br /><pre name="code" class="java">public class Person { private String name; private Date birthday; public void setName(String name) { this.name = name; } public String getName() { return name; } public void setBirthday(Date birthday) { this.birthday = birthday; } public Date getBirthday() { return birthday; } } </pre> <br /> <br />转换的代码是这样的: <br /><pre name="code" class="java">JSONObject jsonPerson = JSONObject.fromObject(personData); //personaData是json串 Person person = (Person)JSONObject.toBean(jsonPerson, Person.class); </pre> <br /> <br />转换时并不抛出例外,而是在日志中打出以下警告信息: <br />Can't transform property 'birthday' from java.lang.String into java.util.Date. Will register a default Morpher <br /> <br />在网上搜了一遍,发现了很多关于进行相反方向转换时的帖子,即使用json-lib将bean转成json串时,日期属性的格式不符合习惯,后来好不容易才找到了这个问题的解决办法,虽然是抄别人的,但也发一贴为以后其他人更容易找到答案出点力,呵呵。废话少说,其实解决方法很简单,把转换代码改成这样: <br /><pre name="code" class="java">JSONObject jsonPerson = JSONObject.fromObject(personData); String[] dateFormats = new String[] {"yyyy/MM/dd"}; JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats)); Person person = (Person)JSONObject.toBean(jsonPerson, Person.class); </pre> <br /> <br />想深究原因的人可以参看json-lib和ezmorpher的相关文档。<br /><strong>问题补充:</strong><br />哈 <br />本来是发帖子的,怎么被系统自动转到问答栏目来了,估计是题目没起好,叫了个“。。。问题”,见笑了。

表单提交的值怎么通过反射赋值给javabean啊?大家看我代码

[code="java"]PropertyDescriptor[] ps = Introspector.getBeanInfo(c).getPropertyDescriptors();//读取所有属性 Map map=request.getParameterMap();//将request提交的值全部取出来 ArrayList list=new ArrayList(map.keySet()); //保存到list for(PropertyDescriptor properdesc : ps){ for(int i=0;i<list.size();i++){ if(properdesc.getName().equals(list.get(i))){//读取javabean属性值的写入方法 Method setter=properdesc.getWriteMethod(); if(setter!=null){ Object value =request.getParameter(list.get(i).toString()); setter.setAccessible(true); setter.invoke(actionInstance,new Object[]{value});//在这里做执行的时候。出现了问题,因为request提交过来的都是String类型,假如我那个属性是int类型。这个时候就会报出参数错误。 } break; } } }[/code] 以上。。各位帮忙解决一下。谢谢了。。本人平日就是伸手党。。没多少分的。。。。

JDK1.8新特性代码如何用1.7来写

小白一个,JDK1.8的新增语法这些还不了解,正在学习 如下是一个转换工具类,用JDK1.7该如何写 ``` public static class Functions{ /**yyyy-MM-dd**/ public static final Function<Object, Object> DateFormat = (Object obj)->{ if(obj!=null){ try{ return new SimpleDateFormat("yyyy-MM-dd").format(obj); }catch(Exception e){ return null; } } return null; }; /**yyyy-MM-dd HH:mm:ss**/ public static final Function<Object, Object> DateTimeFormat = (Object obj)->{ if(obj!=null){ try{ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(obj); }catch(Exception e){ return null; } } return null; }; /**true:是,false:否**/ public static final Function<Object, Object> BooleanDefault = (Object obj)->{ if(Boolean.TRUE.equals(obj)) return "是"; else if(Boolean.FALSE.equals(obj)) return "否"; return null; }; } ``` 这是调用的代码片段。这里的((Function<Object,Object>)v).apply又该如何写 ``` else if(v instanceof Function) cell.put(keyName, ((Function<Object,Object>)v).apply(BeanUtils.getPropertyDescriptor(data.getClass(), fieldName).getReadMethod().invoke(data))); ```

BeanUtils.setProperty为什么不能给设置对象的参数的父类参数赋值

![图片说明](https://img-ask.csdn.net/upload/201901/14/1547464858_341531.jpg) ![图片说明](https://img-ask.csdn.net/upload/201901/14/1547464924_107139.jpg) DevDeviceEntityVo对象中的参数都可以赋值, DevDeviceEntity对象中的赋值都为空这时为什么

C#中GetComponent<T>(),如果T是一个类的话,返回的是类的地址吗,还是一个类

返回的类会影响T本事内容吗?? 官网查的: Object GetComponent ( PropertyDescriptor propertyDescriptor ) B类中的a.i会改变A中的类的i的值,可是这个 GetComponent 不是一个地址形式,为什么会改变呢?? ``` using UnityEngine; using System.Collections; public class B : MonoBehaviour { A a; A a1=new A(); // Use this for initialization void Start () { a = GetComponent<A>(); } // Update is called once per frame void Update () { if (Input.GetKey(KeyCode.A)) { a1.i = 4; } } using UnityEngine; using System.Collections; public class A : MonoBehaviour { public int i; // Use this for initialization void Start () { i = 3; } // Update is called once per frame void Update () { if (i == 4) print("i=4 \n"); } } ```

开发WP8.1应用时,引用using Newtonsoft.Json.Linq;,编译出现错误。

在 System.dll模块中找不到类型System.ComponentModel.PropertyDescriptor。

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

ArrayList源码分析(入门篇)

ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

玩转springboot启动banner定义所得

最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

立即提问
相关内容推荐