resource id is an alias for openejb:Resource/<id> which is a global
internal (but stable) name

you should be able to use java:global as global name too

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/6/5 ZhongGuan <[email protected]>

> Thank you for the answer.
> I learned some concept about JNDI.
> Here is what I'v got, please help me to confirm.
> for example, I config a datasource in TomEE
>     <Resource id="jdbc/test1" type="DataSource">
>       JdbcDriver oracle.jdbc.xa.client.OracleXADataSource
>       JdbcUrl jdbc:oracle:thin:@localhost:1521:xe
>       UserName test
>       Password test
>       JtaManaged true
>     </Resource>
> And In WEB-INF/web.xml
> <resource-ref>
>         <description>DataSource</description>
>         <res-ref-name>jdbc/test2</res-ref-name>
>         <res-type>javax.sql.XADataSource</res-type>
>         <res-auth>Container</res-auth>
>         <mapped-name>jdbc/test1</mapped-name>
> </resource-ref>
>
> 1. "jdbc/test1" is a product sepecific name or global jndi name?
> 2. "jdbc/test2" is a local jndi name, it is in "java:comp/env".
>
> When I use @Resource to inject this resource.
> (in fact, I defined two datasources in tomee.xml, and this is the second
> one, to avoid tomee maps the first datasource in tomee.xml when there is no
> comfortable mapping.)
>
>
> @Resource(name="jdbc/test1")  OK,(WHY?)
> @Resource(name="jdbc/test2")  OK, (I can understand)
> @Resource(mappedname="jdbc/test1")  OK, (I can understand)
> @Resource(mappedname="jdbc/test2")  NOK, (I can understand)
> @Resource(lookup="XXXX") Nerver OK..I don't know what should be here.
> the lookup API says
> "The name of the resource that the reference points to. It can link to any
> compatible resource using the global JNDI names. "
>
> I got confused,
> what is the product specific, global jndi namespace?
> and what portable string means? it means local JNDI name?
>
> please help me. thanks.
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/stand-alone-Application-looks-up-remote-EJB-by-global-jndi-name-tp4663033p4663480.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to