Taking your example, if the code expects to do a lookup of a datasource dependency using ctx.lookup("java:comp/env/jdbc/mydb")
then the corresponding resource-ref would look like :
...
You're not the only one that has found dealing with java:comp/env a bit confusing. That's one reason the Java EE 5 platform provides an alternative to context lookups() in the form of resource injection.
You might find the following presentation about component dependencies useful :
https://glassfish.dev.java.net/javaee5/ejb/compdependencies_xmlforum_nov15.pdf
Regarding the portability of code using java:comp/env between Java EE implementations and stand-alone web servers like Tomcat, it's true that not all Java EE code can be used outside of Java EE. However, it's guaranteed to be portable to other Java EE implementations.
http://forums.java.net/jive/thread.jspa?threadID=14497
No comments:
Post a Comment