【发布时间】:2018-10-25 23:25:32
【问题描述】:
我开发了一个带有远程接口的 EJB 应用程序。此应用程序部署在 weblogic 12 上。
使用 java 应用程序,我正在尝试使用我的 EJB 应用程序,但是当我从类 InitialContext 调用方法查找时,我收到此消息“javax.naming.NameNotFoundException:尝试查找'NewSessionBean.remote'时没有' t 找到子上下文“NewSessionBean”
这是来自远程接口的代码:
package co.com.tutorial.stateless;
import java.util.List;
import javax.ejb.Remote;
/**
*
* @author jquintep
*/
@Remote
public interface NewSessionBeanRemote {
void addBook(String bookName);
List getBooks();
}
这是实现代码的一部分:
package co.com.tutorial.stateless;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
/**
*
* @author jquintep
*/
@Stateless
public class NewSessionBean implements NewSessionBeanRemote {
List<String> bookShelf;
public NewSessionBean() {
bookShelf = new ArrayList<String>();
}
这是我调用查找时代码的一部分:
try {
int choice = 1;
NewSessionBeanRemote libraryBean =
(NewSessionBeanRemote)ctx.lookup("NewSessionBean/remote");
感谢您考虑我的请求。
PS 我在 tutorialspoint 关注 EJB 教程。
【问题讨论】:
标签: jakarta-ee ejb weblogic