hengyunabc / xdiamond Goto Github PK
View Code? Open in Web Editor NEW全局配置中心
全局配置中心
如题所示
rt
[WARNING]
java.lang.ClassNotFoundException: io.github.xdiamond.example.ClientExampleMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:36 min
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'metricRegistry' is defined
比如项目中用到了redis,线上环境redis是有密码的,但是测试环境没有密码,应该怎么配呢?谢谢。
Struts1 +spring3+hibernate3 这种项目支持吗?
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'projectVersion' in string value "${projectVersion}"
有些用户在编绎时,不能通过。发现是 crash.cli 并没有引入。可能是某些maven仓库同步出错了。
<dependency>
<groupId>org.crashub</groupId>
<artifactId>crash.cli</artifactId>
<version>1.3.1</version>
</dependency>
在官方的maven仓库里是通过crash.embed.spring
直接引入了的。
<dependency>
<groupId>org.crashub</groupId>
<artifactId>crash.embed.spring</artifactId>
<version>1.3.1</version>
[ERROR] io.github.xdiamond.client.XDiamondConfig - load xdiamond config from server error! test|captcha|1.0|product
java.util.concurrent.TimeoutException: null
at io.netty.util.concurrent.AbstractFuture.get(AbstractFuture.java:49)
at io.github.xdiamond.client.XDiamondConfig.init(XDiamondConfig.java:127)
[INFO] io.github.xdiamond.client.net.XDiamondClient - Reconnecting to 10.0.0.97:8804
[INFO] io.github.xdiamond.client.net.XDiamondClient - connection to 10.0.0.97:8804 success.
[WARN] org.springframework.context.annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xDiamondConfig' defined in class path resource [spring-context-springboot-example.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
spring-xdiamond配置文件的注入方式如下:
@SpringBootApplication()
@EnableScheduling
@ImportResource("classpath:spring-xdiamond-springboot.xml")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
我想将xdiamond.server.ip,port等参数通过application.properties配置,可以吗?
因为项目中由dev,product等等多套环境,每次上线都需要手动替换spring-xdiamond的配置IP,好麻烦啊!
求教!
if (bBackOffRetryInterval) {
currentRetryInterval = retryIntervalSeconds * (1 << currentRetryTimes);
}
当currentRetryTimes=29时候
currentRetryInterval未负值
权限控制:
权限控制是参考gitlab来做的,把开发者区分的develop, master, owner级别,只能对应级别的开发者才可以看到对应级别的profile的配置。
不过有这样的需求,提供只读权限。比如某些开发人员可以查看线上的配置,但是他不能修改。
`
void channelUnregistered(final ChannelHandlerContext ctx) {
currentRetryTimes++;
if (currentRetryTimes > maxRetryTimes) {
return;
}
int currentRetryInterval = retryIntervalSeconds;
if (bBackOffRetryInterval) {
// 注意currentRetryInterval 可能会溢出
currentRetryInterval = retryIntervalSeconds * (currentRetryTimes >= 30 ? 1 << 30 : 1 << currentRetryTimes);
if (currentRetryInterval <= 0) {
currentRetryInterval = maxRetryIntervalSeconds;
}
}
if (currentRetryInterval > maxRetryIntervalSeconds) {
currentRetryInterval = maxRetryIntervalSeconds;
}
logger.info("Waiting for " + currentRetryInterval + "s to reconnect");
final EventLoop loop = ctx.channel().eventLoop();
loop.schedule(new Runnable() {
@Override
public void run() {
logger.info("Reconnecting to {}:{}", serverAddress, port);
configureBootstrap(new Bootstrap(), loop).connect().addListener(new FutureListener<Void>() {
@Override
public void operationComplete(Future<Void> future) throws Exception {
if (!future.isSuccess()) {
logger.error("can not connection to {}:{}", serverAddress, port, future.cause());
} else {
logger.info("connection to {}:{} success.", serverAddress, port);
}
}
});
}
}, currentRetryInterval, TimeUnit.SECONDS);
}
`
这里首次断开后,只会重连一次吗? 如果这次也连不上,后面就不做任何处理了。。。
研究了下spring的 @JmsListener
的实现代码,发现实现BeanPostProcessor
接口,在postProcessAfterInitialization
函数里处理才是正确的做法。
工程里面有几处依赖包问题导致无法编译
org.springframework:spring:jar:2.5.6.SEC03 (对应源文件CacheConfig)
javax.servlet.api:servlet-api:2.4 (对应源文件WebConfigurer)
系统中毒重装后密码都没了,现在登不进去了,咋整?
删除掉这一行,避免启动时要连网下载:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd">
否则会抛出异常:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.sf.ehcache.CacheManager]: Factory method 'cacheManager' threw exception; nested exception is net.sf.ehcache.CacheException: Error configuring from input stream. Initial cause was http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd
不支持集群吗? 单点故障怎么办?
参考: http://stackoverflow.com/questions/1000183/reliable-file-renameto-alternative-on-windows
完善在windows下保存配置到 .xdiamond
目录下面的逻辑。
使用 Files.move()
函数:
http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#move
如题!
试了一下客户端高级配置:bSyncToSystemProperties,发现源码中对于这个属性是这样解析的:
if (!StringUtils.isEmpty(bSyncToSystemProperties)) { bSyncToSystemProperties = helper.replacePlaceholders(bSyncToSystemProperties, properties); xDiamondConfig.setbSyncToSystemProperties(Boolean.getBoolean(bSyncToSystemProperties)); }
在spring中这样配置:
<bean id="xDiamondConfig" class="io.github.xdiamond.client.spring.XDiamondConfigFactoryBean"> ... <property name="bSyncToSystemProperties" value="true" /> </bean>
这样写属性注入失败(实际并没有拿到true,而是null),Boolean.getBoolean(name)方法是从环境变量中获取value,而实际是直接注入了值"true",这里似乎应该改为Boolean.valueOf(),是我使用有误还是?
不过还是要说,xdiamond很好很强大 :)
参考了作者的 https://github.com/hengyunabc/xdiamond/wiki/%E6%94%AF%E6%8C%81spring-boot%E9%87%8C%E7%9A%84@ConfigurationProperties 里面的xml配置,想做个java config配置,使用@bean实例化XDiamondConfigFactoryBean,但是读取命令行参数时总是失败。比如--xdiamond.serverHost=127.0.0.1,这个参数要应用到XDiamondConfigFactoryBean的serverHost属性,但是总是为空,请问是什么引起的,该怎么解决这个问题?谢谢
https://github.com/alibaba/fastjson/wiki/%E5%BE%AA%E7%8E%AF%E5%BC%95%E7%94%A8
否则有可能,xdiamond client不支持$ref
这样子的语法,就会报错。fastjson的坑。。
windows下xdiamond服务端启动的时候,会在目录下C:\Users\Administrator.xdiamond不断生成以config前缀的临时文件,如:config8560528275070450078.tmp。
你们有什么解决方案吗?
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project xdiamond-server: Compilation failure: Compilation failure:
[ERROR] xdiamond/xdiamond-server/src/main/java/io/github/xdiamond/web/crash/CRaSHConnector.java:[35,25] 程序包org.crsh.cli.impl不存在
[ERROR] xdiamond/xdiamond-server/src/main/java/io/github/xdiamond/web/crash/CRaSHConnector.java:[36,36] 程序包org.crsh.cli.impl.completion不存在
[ERROR] xdiamond/xdiamond-server/src/main/java/io/github/xdiamond/web/crash/CRaSHConnector.java:[37,24] 程序包org.crsh.cli.spi不存在
[ERROR] xdiamond/xdiamond-server/src/main/java/io/github/xdiamond/web/crash/CRaSHConnector.java:[198,13] 找不到符号
[ERROR] 符号: 类 CompletionMatch
[ERROR] 位置: 类 io.github.xdiamond.web.crash.CRaSHConnector
[ERROR] xdiamond/xdiamond-server/src/main/java/io/github/xdiamond/web/crash/CRaSHConnector.java:[199,13] 找不到符号
[ERROR] 符号: 类 Completion
[ERROR] 位置: 类 io.github.xdiamond.web.crash.CRaSHConnector
[ERROR] xdiamond/xdiamond-server/src/main/java/io/github/xdiamond/web/crash/CRaSHConnector.java:[200,13] 找不到符号
[ERROR] 符号: 类 Delimiter
[ERROR] 位置: 类 io.github.xdiamond.web.crash.CRaSHConnector
[ERROR] -> [Help 1]
非常感谢使用xdiamond的用户。
如果可以的话,请在留言里写上你们使用的公司名(不方便的话,可以匿名),接入的项目数量等,这对于开发者一说,是很大的鼓励!非常感谢!
增加用户的时候,为什么会增加一个用户组?
删除用户组的时候,数据库数据删除的不够干净。关联数据无法删除
默认验证是ldap,默认选中是在js里面控制的吗?
没有找到在哪里,能指点一下吗?
import org.crsh.cli.impl.Delimiter;
import org.crsh.cli.impl.completion.CompletionMatch;
import org.crsh.cli.spi.Completion;
这三个引入报错,The import org.crsh.cli cannot be resolved
org.mybatis.spring.mapper.MapperFactoryBean - Error while adding the mapper 'interface io.github.xdiamond.persistence.ProjectMapper' to configuration.
org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.cache.CacheException: Could not instantiate cache implementation (class io.github.hengyunabc.mybatis.FacadeCache). Cause: java.lang.reflect.InvocationTargetException
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:164) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:71) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:651) ~[mybatis-3.2.7.jar:3.2.7]
同一个dubbo service,可能有多个group,然后不同的group给不同的用户使用。
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.