对于NoNodeAvailableExceptionNoneoftheconfigurednodesareavailable感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于Annotati
对于NoNodeAvailableException None of the configured nodes are available感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher、Apache Camel Rest DSL DirectConsumerNotAvailableException、cocos2d-x 3.3连接Xcode9编译时报错:call to unavailable function system not available on ios、configured nodes are available(ES5.4.2)的宝贵知识。
本文目录一览:- NoNodeAvailableException None of the configured nodes are available
- AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher
- Apache Camel Rest DSL DirectConsumerNotAvailableException
- cocos2d-x 3.3连接Xcode9编译时报错:call to unavailable function system not available on ios
- configured nodes are available(ES5.4.2)
NoNodeAvailableException None of the configured nodes are available
前提:
docker 镜像 elasticsearch 5.5.2
spring data elasticsearch 2.0.0.M6
config 部分代码
@Configuration
public class ElasticsearchConfiguration implements FactoryBean<TransportClient>, InitializingBean, DisposableBean {
private static final Logger logger = LoggerFactory.getLogger(ElasticsearchConfiguration.class);
/**
* 连接节点地址,可配置多地址
*/
private String clusterNodes = "127.0.0.1:9300";
/**
* 此处为默认的名称
*/
private String clusterName = "elasticsearch";
private TransportClient client;
@Override
public void destroy() throws Exception {
try {
logger.info("Closing elasticSearch client");
if (client != null) {
client.close();
}
} catch (final Exception e) {
logger.error("Error closing ElasticSearch client: ", e);
}
}
@Override
public TransportClient getObject() throws Exception {
return client;
}
@Override
public Class<?> getObjectType() {
return TransportClient.class;
}
@Override
public void afterPropertiesSet() throws Exception {
buildClient();
}
/**
* 构建client
*/
protected void buildClient() {
try {
TransportClient transportClient = new PreBuiltTransportClient(settings());
if (!"".equals(clusterNodes)) {
for (String nodes : clusterNodes.split(",")) {
String InetSocket[] = nodes.split(":");
String Address = InetSocket[0];
Integer port = Integer.valueOf(InetSocket[1]);
transportClient.addTransportAddress(new
InetSocketTransportAddress(InetAddress.getByName(Address), port));
}
client = transportClient;
}
} catch (UnknownHostException e) {
logger.error(e.getMessage());
}
}
/**
* 初始化默认的client
*/
private Settings settings() {
Settings settings = Settings.builder()
.put("cluster.name", clusterName)
.build();
return settings;
}
}
application 主函数程序启动后抛出异常,http://localhost:9200 / 地址访问正常,索引创建正常,网上查询了很多资料无果,最终判断为 9300 接口公共网络无法访问。
docker restart 重新启动服务,TransportClient 终于访问正常
AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher
報錯:
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [beans.xml]; nested exception is java.lang.IllegalStateException: Context namespace element ''annotation-config'' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher
大意:SPRING的注解配置解析器只能在JDK1.5或更高版本使用,我的ECLIPSE 默认的是1.8,我使用的SPRING版本是2.5,总之就是1.8的JDK太高了,SPRING 支持不了。
前提是:你在Spring容器里面配置了,annotation-driven来启用事务
<!-- 配置事务管理器,统一管理session Factory的事务 -->
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 启用事务注解 -->
<tx:annotation-driven
transaction-manager="txManager" />
解决:项目右键--》BUILD PATH--》Config Build Path--》Libraries-->Jre System Library--》Edit--》配置1.7的就OK 啦!
Apache Camel Rest DSL DirectConsumerNotAvailableException
如何解决Apache Camel Rest DSL DirectConsumerNotAvailableException?
我已经使用Servlet和Spring XML通过Springboot设置了Apache Camel REST API。我正在使用JBoss EAP通过war文件部署API。以下是我引用的网站:
https://camel.apache.org/manual/latest/rest-dsl.html
代码成功构建和部署。但是,当我尝试访问端点URL( http:// localhost:8080 / camel-rest-cxfrs-jaxrs / api / customers?country = abc)时,出现以下异常:
对/ camel-rest-cxfrs-jaxrs / api / customers的异常处理请求: org.apache.camel.CamelExecutionException:发生在 在交易所执行:Exchange [ID-localhost-
在 org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1846) 在 org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:713) 在 org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:515) 在 org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:511) 在 org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:338) 在org.test.MyServlet.doGet(MyServlet.java:50)
由以下原因引起:org.apache.camel.component.direct.DirectConsumerNotAvailableException:在终结点上没有可用的使用者:direct:// start。交换[ID-localhost-
我错过了什么,还是设置错误?
下面是我的文件结构和源代码:
文件结构:
jboss-camel-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring.xsd">
<beanid="helloBean"/>
<camelContext id="camelContext-0476f574-9dab-47b1-89dd-e87e0c6ba735" xmlns="http://camel.apache.org/schema/spring">
<restConfiguration component="servlet" bindingMode="auto"/>
<rest path="/api/customers">
<get>
<route>
<from uri="direct:start"/>
<to uri="direct:start"/>
</route>
</get>
<post>
<route>
<to uri="file:output/customers"/>
</route>
</post>
</rest>
<rest path="/customers">
<delete uri="{id}">
<to uri="bean:helloBean?method=delete(${header.id})"/>
</delete>
</rest>
<rest path="/getapi">
<get uri="/search?country={country}">
<to uri="bean:helloBean?method=byCountry(${header.country})"/>
</get>
</rest>
</camelContext>
</beans>
MyServlet.java
@WebServlet(name = "HttpServiceServlet",urlPatterns = { "/*" },loadOnStartup = 1)
public class MyServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
@Resource(name = "java:jboss/camel/context/spring-context")
private CamelContext camelContext = new DefaultCamelContext();
@Override
protected void doGet(HttpServletRequest req,HttpServletResponse res) throws servletexception,IOException {
try {
camelContext.start();
} catch (Exception e) {
// Todo Auto-generated catch block
e.printstacktrace();
}
String name = req.getParameter("country");
ServletoutputStream out = res.getoutputStream();
ProducerTemplate producer = camelContext.createProducerTemplate();
String result = producer.requestBody("direct:start",name,String.class);
out.print(result);
//camelContext.stop();
}
}
MyBean.java
public class MyBean {
public String sayHello(String message) {
return "Hello " + message;
}
public String delete(String id) {
return "Deleted Customer = " + id;
}
public String byCountry(String countryName) {
System.out.println("Hello World " + countryName);
return "Hello World";
}
}
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
cocos2d-x 3.3连接Xcode9编译时报错:call to unavailable function system not available on ios
一个cocos2d-x 3.3的项目,使用Xcode8.3.2正常编译。
但是连接Xcode9 beta编译时报错:call to unavailable function system not available on ios
原因是iOS11已经将system删除,需要将报错的代码AssetsManager.cpp的第683行system(command.c_str());
修改为:popen(), "r");
这样项目就可以正常编译了。
Cocos2dx官网尚未给出解决方案,目前这个解决方案暂时还没发现问题。
configured nodes are available(ES5.4.2)
configured nodes are available: [{#transport#-1}{bw8KrojBQKebBQHa_82Pug}{10.37.122.168}{10.37.122.168:9300}]]
1.可能端口问题,客户端端口默认为9300
2.浏览器访问 http://10.37.122.168:9200/ ,查看cluster_name是否与客户端配置的一致。不一致需要修改 elasticsearch-2.3.2/config/elasticsearch.yml 配置中的cluster_name值。
3.如果服务器ip变更了,可能需要重启es服务。
4.服务端版本与项目中jar包版本不一致
今天的关于NoNodeAvailableException None of the configured nodes are available的分享已经结束,谢谢您的关注,如果想了解更多关于AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher、Apache Camel Rest DSL DirectConsumerNotAvailableException、cocos2d-x 3.3连接Xcode9编译时报错:call to unavailable function system not available on ios、configured nodes are available(ES5.4.2)的相关知识,请在本站进行查询。
本文标签: