[java] javax.naming.NameNotFoundException

I am running an example of ejb using JBoss5 Container. I am using an example from here(Part one).
In the example I deployed bean in JBoss and an application in Tomcat(to acces the bean from JBoss). I am getting the error in the screen of tomcat server
javax.naming.NameNotFoundException: greetJndi not bound

( greetJndi is the jndi-name in jboss.xml file ) Is there any specific directory structure to deploy in JBoss?

Thanks

This question is related to java jboss jakarta-ee ejb-3.0 jndi

The answer is


The error means that your are trying to look up JNDI name, that is not attached to any EJB component - the component with that name does not exist.

As far as dir structure is concerned: you have to create a JAR file with EJB components. As I understand you want to play with EJB 2.X components (at least the linked example suggests that) so the structure of the JAR file should be:

/com/mypackage/MyEJB.class /com/mypackage/MyEJBInterface.class /com/mypackage/etc... etc... java classes /META-INF/ejb-jar.xml /META-INF/jboss.xml

The JAR file is more or less ZIP file with file extension changed from ZIP to JAR.

BTW. If you use JBoss 5, you can work with EJB 3.0, which are much more easier to configure. The simplest component is

@Stateless(mappedName="MyComponentName")
@Remote(MyEJBInterface.class)
public class MyEJB implements MyEJBInterface{
   public void bussinesMethod(){

   }
}

No ejb-jar.xml, jboss.xml is needed, just EJB JAR with MyEJB and MyEJBInterface compiled classes.

Now in your client code you need to lookup "MyComponentName".


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to jboss

How to enable TLS 1.2 in Java 7 Jboss server error : Failed to start service jboss.deployment.unit."jbpm-console.war" SQLException: No suitable Driver Found for jdbc:oracle:thin:@//localhost:1521/orcl PSQLException: current transaction is aborted, commands ignored until end of transaction block JBoss AS 7: How to clean up tmp? How to deploy a war file in JBoss AS 7? How to increase heap size for jBoss server JBoss default password HTTP response header content disposition for attachments PersistenceContext EntityManager injection NullPointerException

Examples related to jakarta-ee

Java 11 package javax.xml.bind does not exist javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature) web.xml is missing and <failOnMissingWebXml> is set to true WELD-001408: Unsatisfied dependencies for type Customer with qualifiers @Default Name [jdbc/mydb] is not bound in this Context An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException How to consume a SOAP web service in Java java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

Examples related to ejb-3.0

What is the difference between DAO and Repository patterns? javax.naming.NameNotFoundException "detached entity passed to persist error" with JPA/EJB code use of entityManager.createNativeQuery(query,foo.class)

Examples related to jndi

How to create JNDI context in Spring Boot with Embedded Tomcat Container Name [jdbc/mydb] is not bound in this Context Cannot create JDBC driver of class ' ' for connect URL 'null' : I do not understand this exception How to use JNDI DataSource provided by Tomcat in Spring? How do I connect to a Websphere Datasource with a given JNDI name? How to lookup JNDI resources on WebLogic? What does "javax.naming.NoInitialContextException" mean? Configure hibernate to connect to database via JNDI Datasource What is JNDI? What is its basic use? When is it used? What does java:comp/env/ do?