[jboss-jira] [JBoss JIRA] Updated: (EJBTHREE-1863) res-type in resource-ref is not checked

Wolfgang Knauf (JIRA) jira-events at lists.jboss.org
Sun Jul 5 15:15:51 EDT 2009


     [ https://jira.jboss.org/jira/browse/EJBTHREE-1863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wolfgang Knauf updated EJBTHREE-1863:
-------------------------------------

    Attachment: ResourceRef.ear


Version 2 of the sample, with two more "java:/comp/EJBContext" bindings through "<resource-env-ref>", one with injection, the other with a lookup.

It shows that for a "<resource-env-ref>", the "<resource-env-ref-type>" is not validated against the type of the JNDI lookup result, it is just checked that the class can be found in the current classloader.

So, the final goal should probably be to make "resource-env-ref" and "resource-ref" use the same validation code.

A side effect of my sample is that it works around https://jira.jboss.org/jira/browse/EJBTHREE-1858 , because 1858 first checks the type, then performs some specific actions according to the type, and the type does not match in my sample.

> res-type in resource-ref is not checked
> ---------------------------------------
>
>                 Key: EJBTHREE-1863
>                 URL: https://jira.jboss.org/jira/browse/EJBTHREE-1863
>             Project: EJB 3.0
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Wolfgang Knauf
>            Assignee: jaikiran pai
>         Attachments: ResourceRef.ear, ResourceRef.ear
>
>
> The "res-type" of the "resource-ref" element in ejb-jar.xml is not verified.
> See the attached sample: neither on deploy nor on JNDI lookup, an error is raised for this xml snippet, which contains an invalid res-type:
> 			<resource-ref>
> 				<res-ref-name>EnvNameOfSessionContext1</res-ref-name>
>  				<res-type>whole.lotta.Crap</res-type>
> 				<mapped-name>java:comp/EJBContext</mapped-name>
> 				<injection-target>
> 					<injection-target-class>de.knauf.resourceref.ResourceRefTestBean</injection-target-class>
> 					<injection-target-name>sessionContext1</injection-target-name>
> 			  	</injection-target>
> 			</resource-ref>
> 			<resource-ref>
> 				<res-ref-name>EnvNameOfSessionContext2</res-ref-name>
>  				<res-type>whole.lotta.Crap</res-type>
> 				<mapped-name>java:comp/EJBContext</mapped-name>
> 			</resource-ref>
> The class org.jboss.injection.ResourceHandler.loadXmlResourceRefs almost completely ignores the "res-type" element ;-).
> For a "resource-env-ref" element, the "resource-env-ref-type" is validated, though maybe this happens by accident ;-):
> Caused by: java.lang.ClassNotFoundException: asdjavax.ejb.SessionContext from BaseClassLoader at 22adfd{...}
> 	at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
> 	at java.lang.ClassLoader.loadClass(Unknown Source)
> 	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Unknown Source)
> 	at org.jboss.injection.ResourceHandler.loadXmlResourceEnvRefs(ResourceHandler.java:217)
> 	... 73 more
> So, I would like a similar check for the "resource-ref" res-type.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list