Re: jonas 5.1.5 jsp to ejb3 lookup issue

Florent BENOIT <[email protected]> Tue, 08 Feb 2011 09:20:14 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
	Matthias,

You could use "jonas admin -j" command to list JNDI names available. Or you could also go in JOnAS Admin web console and you can also list these JNDI names

Also, the "new way" of getting EJBs is by using @EJB injection, so you don't have to know the JNDI name

Regards,

Florent





[email protected] wrote:
> Hi friends,
>
> I try to access an ejb3 stateless sb from my jsp using this code:
>
> private static final String JNDI_NAME = "org.mfri.jonas.smtp.SendSMTPBean"
> 			+ "_" + SendSMTPInterface.class.getName() + "@Remote";
>
> Context initialContext = null;
> 		try
> 		{
> 			initialContext = new InitialContext();
> 		} 
> 		catch (NamingException e)
> 		{
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}
> 		SendSMTPInterface theSendmailInterface = null;
> 		try
> 		{
> 			theSendmailInterface = (SendSMTPInterface)  
> initialContext.lookup(MailClientBean.JNDI_NAME);
> 		} 
> 		catch (NamingException e)
> 		{
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}
>
> I get:	javax.naming.NameNotFoundException:
> org.mfri.jonas.smtp.SendSMTPBean_org.mfri.jonas.smtp.SendSMTPInterface@Remote
>
> The JNDI name should be ok according to the ejb3 programming doc.
>
> any ideas?
>
> Thanks Matthias
>
>
>