[jboss-user] [JNDI/Naming/Network] - Re: HELP: Looking up to java:comp namespace problem!!

fla83tn do-not-reply at jboss.com
Sun Aug 6 08:50:00 EDT 2006


Thanks for the reply, but I solved the problem myself!
The problem was that I was trying to access the java: namespace from outside a bean and my descriptor file was wrong!

With the following all goes right:

For example, in my entity bean I want to refer at java:/Mail so I must declare in the ejb-jar the following:



  | <entity>
  |      <ejb-name>LineOrder</ejb-name>
  |      ............................
  |      <resource-env-ref>
  |         <resource-env-ref-name>mail/Mail</resource-env-ref-name>
  |         <resource-env-ref-type>javax.mail.Session</resource-env-ref-type>
  |       </resource-env-ref>
  | /entity>
  | 

and in the file jboss.xml:


  | <entity>
  |    <ejb-name>LineOrder</ejb-name>
  |    ........................................
  |     <resource-env-ref>
  |         <resource-env-ref-name>mail/Mail</resource-env-ref-name>
  |         <jndi-name>java:/Mail</jndi-name>
  |       </resource-env-ref>
  | </entity>
  | 

So in my entyty bean (LineOrderBean.java for example) I can do:

         
  |            session = (javax.mail.Session) c.lookup("java:comp/env/mail/Mail");
  | 

I hope this can be helpful for somebody..

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963427#3963427

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963427



More information about the jboss-user mailing list