[jboss-dev-forums] [Design of EJB 3.0] - Re: EJBTHREE-1823 - handling of res-type in resource-ref

jaikiran do-not-reply at jboss.com
Mon Jun 29 05:22:14 EDT 2009


anonymous wrote : So I think that JBoss should warn only if no "injection-target" is specified (though it can handle this case, too).
  | 

Yes, we can do away with the WARN message if the injection-target is configured. 
anonymous wrote : 
  | And:
  | "The resource manager connection factory type must be compatible with the type declared in the res-type element" 

That's part of the "Deployer's responsibility" section :) So the container provider may or may not validate the types, which effectively might mean runtime exceptions in the application code where the code does a JNDI lookup and casts it to an incorrect type.
anonymous wrote : 
  | Even if I ...have an invalid res-type value, a lookup works.
I did not get this. You mean, you have something like this (just an pseudo example):

<resource-ref>
  |   <res-ref-name>MyDS</res-ref-name>
  |   <res-type>i.am.invalid.type</res-type>
  |   <mapped-name>java:/DefaultDS</mapped-name>
  | </resource-ref>
  | 
  | 

Context ctx = new InitialContext();
  | // successful lookup and cast
  | DataSource ds = (DataSource) ctx.lookup("java:comp/env/MyDS");

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

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



More information about the jboss-dev-forums mailing list