-
1. Re: jndi mapping with Trails example
kabirkhan Jul 24, 2005 8:12 AM (in response to lpiccoli)By default it uses the fully qualified name of the remote/local interface class.
You can override this using the jboss specific @RemoteBinding and @LocalBinding annotations
http://docs.jboss.org/ejb3/tutorial/jndibinding/jndi.html -
2. Re: jndi mapping with Trails example
lpiccoli Jul 25, 2005 12:01 AM (in response to lpiccoli)hi all,
i still can not get this dam EJB3 code to be bound to a JNDI name.. what do i have to do here?
I have attached the SLSB code, the JSP code and the exception. The SLSB
cannot bw found from the JNDI context. The ear seems to be deployed cleanly as there are no errors in the server.log
This is such a trivial task but i can't seem to solve it.
Any help is appreciated.
------SLSB code----
package com.asteriski.asset.business;
import com.asteriski.asset.entity.*;
import javax.ejb.*;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.*;
@Stateless
public class AssetBean implements Asset {
@PersistenceContext (unitName="as")
protected EntityManager em;
public void addAsset (String name) {
System.out.println( "addAsset");
AssetEntity assetEntity = new AssetEntity (name);
em.persist (assetEntity);
}
public Collection getAssets()
{
return em.createQuery("from Asset a").getResultList();
}
}
---------JSP snipp-----
<%
AssetBean ab = null;
try {
System.out.println( "Attempting context lookup");
InitialContext ctx = new InitialContext();
ab = (AssetBean) ctx.lookup(AssetBean.class.getName());
System.out.println( "got context lookup");
} catch (Exception e)
{
System.out.println( "Error context lookup " + e);
//e.printStackTrace ();
}
%>
---------Exception-----
13:52:31,003 INFO [STDOUT] Error context lookup javax.naming.NameNotFoundExcept
ion: com.asteriski.asset.business.AssetBean not bound
13:52:31,003 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception -
3. Re: jndi mapping with Trails example
lpiccoli Jul 25, 2005 1:49 AM (in response to lpiccoli)solved this problem.
It seems that the jndi is bound to the interface class not the implementation class!
-lp -
4. Re: jndi mapping with Trails example
bill.burke Jul 25, 2005 10:29 AM (in response to lpiccoli)Yes. You don't have reference to the bean class on the client and also, a bean class can have both a local and remote interface...
The real reason for the default was so that you automatically had a compiler checked constant you could use to lookup the EJB.
MyRemoteInterface.class.getName()