This content has been marked as final.
Show 2 replies
-
1. Re: HELP: Looking up to java:comp namespace problem!!
lafr Jul 28, 2006 4:13 PM (in response to fla83tn)To get a mail session via "java:comp/env/Mail" I declared this tags for xdoclet:
* @ejb.resource-ref * res-ref-name="Mail" * res-type="javax.mail.Session" * res-auth="Container" * @jboss.resource-ref * res-ref-name="Mail" * jndi-name="java:/Mail"
Using the global namespace you simply do a lookup of "java:/Mail".
No narrowing. -
2. Re: HELP: Looking up to java:comp namespace problem!!
fla83tn Aug 6, 2006 8:50 AM (in response to fla83tn)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..