-
1. Re: EJBTHREE-1823 - handling of res-type in resource-ref
wolfgangknauf Jun 26, 2009 2:48 PM (in response to wolfgangknauf)By the way: the "resource-env-ref" element performs validation of the "resource-env-ref-type".
-
2. Re: EJBTHREE-1823 - handling of res-type in resource-ref
jaikiran Jun 29, 2009 5:22 AM (in response to wolfgangknauf)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.
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.
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");
-
3. Re: EJBTHREE-1823 - handling of res-type in resource-ref
jaikiran Jun 29, 2009 5:23 AM (in response to wolfgangknauf)And yes, thanks for all these comments and the other bug reports that you have been filing :)
-
4. Re: EJBTHREE-1823 - handling of res-type in resource-ref
wolfgangknauf Jun 29, 2009 10:30 AM (in response to wolfgangknauf)Hi Jaikiran,
yes, your "I did not get this" guess was correct: I used it to inject a SessionContext, and no matter what was entered for the "res-type", it did not complain, neither on injection nor on JNDI lookup. I can build a sample if you want.
Shall I create any JIRA issues (about the unnecessary warning and about the type check)?
Wolfgang -
5. Re: EJBTHREE-1823 - handling of res-type in resource-ref
jaikiran Jun 30, 2009 4:27 AM (in response to wolfgangknauf)"Wolfgang Knauf" wrote:
Shall I create any JIRA issues (about the unnecessary warning and about the type check)?
Sure, please create one.
yes, your "I did not get this" guess was correct: I used it to inject a SessionContext, and no matter what was entered for the "res-type", it did not complain, neither on injection nor on JNDI lookup. I can build a sample if you want.
Although, the spec mentions this as a deployer's responsibility to correctly configure the res-type, i guess we could issue either a WARN or ERROR if the types don't match. Please create a separate JIRA for this too and attach your application. -
6. Re: EJBTHREE-1823 - handling of res-type in resource-ref
wolfgangknauf Jul 2, 2009 2:43 PM (in response to wolfgangknauf)Done!
For the warn message: https://jira.jboss.org/jira/browse/EJBTHREE-1862
For the missing validation of "res-type": https://jira.jboss.org/jira/browse/EJBTHREE-1863
Is there any check that the object declared through the resource-env-ref/resource-ref element is actually of the correct type? It seems the error message for resource-env-ref is only coming if the declared class is not found at all by the classloader, but if it is just wrong, there is no error message. Is this worth one more JIRA ;-)?
Wolfgang -
7. Re: EJBTHREE-1823 - handling of res-type in resource-ref
jaikiran Jul 3, 2009 1:06 AM (in response to wolfgangknauf)"Wolfgang Knauf" wrote:
Is there any check that the object declared through the resource-env-ref/resource-ref element is actually of the correct type? It seems the error message for resource-env-ref is only coming if the declared class is not found at all by the classloader, but if it is just wrong, there is no error message. Is this worth one more JIRA ;-)?
Wolfgang
AFAIK, there isn't any check. Please add the comments to the existing JIRA for the missing validation and if possible attach the same application. -
8. Re: EJBTHREE-1823 - handling of res-type in resource-ref
wolfgangknauf Jul 5, 2009 3:19 PM (in response to wolfgangknauf)I attached an updated sample to https://jira.jboss.org/jira/browse/EJBTHREE-1863 with two "resource-env-ref" declarations with invalid "resource-env-ref-type" class. I also added some comments about missing type checks.
Best regards
Wolfgang