你的上下文中,没有jndi服务器位置的位置信息,用jb自动生成一个测试客户端,看人家怎么写的就可以了
解决方案 »
- [急]jsp使用fck在线编辑器出现问题
- 刚学java遇到的问题
- 请问哪位高人能向我推荐几本关于spring,struct,hibernate源代码分析或技术内幕的书,谢谢
- 如何添加系统的操作日志功能?
- 怎么在asp中调用axis生成的webservice啊
- Spring构造方法注入时,注入一种方法时正常注入多种时报错,求助
- 急求:apache+tomcat在win2k下的整合及有效的相关资源链接
- 小弟的第一个BMP,各位大虾帮忙看看,3X!
- 如何连接J2EE实现的JNDI服务器?(在线等,急)
- 使用CXF httpclient框架 找不到org/apache/http/config/Lookup类
- 请问tomcat+j2sdk的JS环境设置问题
- 请教关于Ant运行时的一个奇怪问题
public class MyFirstTapeTestClient1 extends Object {
private static final String ERROR_NULL_REMOTE = "Remote interface reference is null. It must be created by calling one of the Home interface methods first.";
private static final int MAX_OUTPUT_LINE_LENGTH = 100;
private boolean logging = true;
private MyFirstTapeHome myFirstTapeHome = null;
private MyFirstTape myFirstTape = null; //Construct the EJB test client
public MyFirstTapeTestClient1() {
initialize();
create();
helloWorld("You are the best!");
} public void initialize() {
long startTime = 0;
if (logging) {
log("Initializing bean access.");
startTime = System.currentTimeMillis();
} try {
//get naming context
Context context = getInitialContext();
System.out.println("One");
//look up jndi name
/**@todo Provide a valid JNDI lookup name for the Home interface*/
Object ref = context.lookup("MyFirstTape");
System.out.println("Two");
//look up jndi name and cast to Home interface
myFirstTapeHome = (MyFirstTapeHome) PortableRemoteObject.narrow(ref, MyFirstTapeHome.class);
System.out.println("Three");
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded initializing bean access through Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
}
e.printStackTrace();
}
}
..........
这里面就有web.xml文件
或是你直接在你的应用所在的目录下找web-inf目录
然后找出web.xml文件在web.xml里找到MyFirstTape的JNDI
在此文件里你能找到类似下面的
<servlet-mapping>
<servlet-name>MyFirstTape</servlet-name>
<url-pattern>???</url-pattern>
</servlet-mapping><url-pattern>和</url-pattern>之间的就是你要的东西
也能找到servlet的JNDI的
web.xml中的问题!
1)的确是部署的问题,但与web.xml完全不沾边,因为我没有web tier,只有项目中有JSP或Servlet等web conponent时才会涉及web.xml。真正有关的是:weblogic-ejb-jar.xml,它才是整个application的部署文件,里边有EJB的JNDI信息。
2)我的问题重做了一次就解决了,与前次唯一的区别是:这回在创建Ejb Module时,我选的version是Ejb 2.0 Compliant而不是第一次选的Ejb 1.x Compliant。不知是否只是巧合,这样改动一下就解决问题。而且事后我又试了两次,选Ejb 1.x Compliant就是不行,与我前面的问题一样。此点,仅供参考!