zoeminghong / coders-dream-works Goto Github PK
View Code? Open in Web Editor NEW分享高品质内容
Home Page: https://github.com/zoeminghong/Coders-Dream-Works
License: Apache License 2.0
分享高品质内容
Home Page: https://github.com/zoeminghong/Coders-Dream-Works
License: Apache License 2.0
使用动态代理的方式实例化接口,在获取bean对象的时候出现bean对象类型转换错误
java
ClassLoader(类加载器)不同导致requiredType.isAssignableFrom(bean.getClass())
中的requiredType与实际的类对象不是同一个指针。发现requiredType是使用restartClassLoader进行加载,而实际的类是使用appClassLoader进行加载。
去除restartClassLoader加载器,该加载器是Springboot中的devtools依赖包中的,所以去除该依赖包就可以了。
restartClassLoader
根据http://www.jianshu.com/p/63691220f81f进行处理,出现了java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType问题
java
返现这个问题直接调用下面的方法导致
(Class<E>) (((ParameterizedType) this.getClass().getGenericInterfaces()[0]).getActualTypeArguments()[0]);
由于使用了代理类,所以this是代理对象,而实际需要的是当前类的对象。
if (Proxy.class.isAssignableFrom(this.getClass())) {
return (Class<E>) (((ParameterizedType) this.getClass().getInterfaces()[0].getGenericInterfaces()[0]).getActualTypeArguments()[0]);
} else {
return (Class<E>) (((ParameterizedType) this.getClass().getGenericInterfaces()[0]).getActualTypeArguments()[0]);
}
java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_14f7ee5.Offline 错误
java
缺少jacoco依赖
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<version>0.7.6.201602180812</version>
<classifier>runtime</classifier>
</dependency>
调用http请求,长时间没有数据返回,报Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server
java
调用接口是没有正常response,由于服务器的网络等等问题导致
提供稳定的运行环境
com.netflix.zuul.exception.ZuulException: Forwarding error
java
leak
Caused by: java.net.SocketTimeoutException: Read timed out
Caused by: java.lang.RuntimeException: java.net.SocketTimeoutException: Read timed out
Caused by: com.netflix.client.ClientException: null
com.netflix.zuul.exception.ZuulException: Forwarding error
java
zuul.read-timeout
时间偏小
zuul.read-timeout=12000
存在一些接口的default方法、正常实例化对象、特殊处理等场景
java
存在一些接口的default方法、正常实例化对象、特殊处理等场景
if (!method.getDeclaringClass().isInterface() && !method.isDefault()) {
// This proxy is class and method has not impl
return method.invoke(this, args);
} else if (method.isDefault()) {
// This proxy is interface but method has impl
return getMethodHandle(method).bindTo(proxy)
.invokeWithArguments(args);
} else {
// This proxy is interface
return run(method, args);
}
联系如下issue一起看
#1
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
无法注册到注册中心
java
注册中心的账号密码错误
更改账号密码
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.