博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Exception: javax.naming.NoInitialContextException
阅读量:6706 次
发布时间:2019-06-25

本文共 1203 字,大约阅读时间需要 4 分钟。

If you try to use Camel without  using code something like this

CamelContext context =
new
DefaultCamelContext();
context.addRoutes(
new
MyRouteBuilder());
 
context.start();

You might get an exception like this

[java] Caused by: javax.naming.NoInitialContextException: Need to specify
class
name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
[java]     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
645
)
[java]     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:
247
)
[java]     at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:
284
)
[java]     at javax.naming.InitialContext.lookup(InitialContext.java:
351
)
[java]     at org.apache.camel.impl.JndiRegistry.lookup(JndiRegistry.java:
51
)

This is because if you are not using Spring then the default  implementation uses .

A simple workaround for this is to specify a JNDI provider. An easy fix is to create a file called jndi.properties on the classpath and give it this content...

java.naming.factory.initial = org.apache.camel.util.jndi.CamelInitialContextFactory

转载于:https://www.cnblogs.com/karmapeng/p/7573366.html

你可能感兴趣的文章
Kurento安装与入门05——One to many video call
查看>>
[deviceone开发]-cnodejs论坛移动端App
查看>>
智能指针shared_ptr(effective modern c++笔记)
查看>>
Failed to validate a newly established connection异常
查看>>
关联对象 AssociatedObject 完全解析
查看>>
POST 后台404错误
查看>>
Ubuntu 解压zip文件名乱码问题解决
查看>>
动态规划
查看>>
Hibernate的延迟加载
查看>>
IE中input标签密码框与文本框宽度不一样问题
查看>>
【系统架构师修炼之道】(10):绪论——系统架构师的定义与职业素质
查看>>
Uber 开源地理可视化工具 Ketoper.gl,加速数据处理
查看>>
NSDate格式化小例
查看>>
运维不容错过的4个关键指标!
查看>>
spring 基础
查看>>
商品详情页上拉查看详情
查看>>
Kubernetes DNS服务简介
查看>>
windbg调试堆破坏
查看>>
How to Install CMS Made Simple v2.2 on LAMP in CentOS 7.2
查看>>
新IT铺路 智慧出行时代来了!
查看>>