I've developed a EJB application, with a Remote interface. This application was deployed on weblogic 12.
With a java application, i'm trying use my EJB application, but when I call method lookup from the class InitialContext, i get this message "javax.naming.NameNotFoundException: While trying to lookup 'NewSessionBean.remote' didn't find subcontext 'NewSessionBean"
This is code from remote interface:
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();
}
This is part of the code from implementation:
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>();
}
And this is a part of the code when i call lookup:
try {
int choice = 1;
NewSessionBeanRemote libraryBean =
(NewSessionBeanRemote)ctx.lookup("NewSessionBean/remote");
Thanks for considering my request.
PS I am following the EJB tutorial at tutorialspoint.
You could see your JNDI tree through the following path in Weblogic's console
Environment -> servers -> select your server -> click on view JNDI tree link
I always check JNDI tree for lookup problems.
Why do not you use JNDI portable name for lookup?
https://docs.oracle.com/cd/E19798-01/821-1841/girgn/index.html
If you had deployed your implementation as a separate EAR, you could use the following lookup
If you had deployed your implementation as a separate jar, you could use the following lookup
If you want to look up in the same EAR but in a different jar
If you want to look up in the same EAR and in the same jar