You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by David Blevins <da...@visi.com> on 2009/06/06 01:20:13 UTC

Re: Enum class loading in a session bean

Update for the archive searchers.  We tackled this one on the dev list  
before the release.  Here's the resolution:

http://www.nabble.com/Re%3A-Enum-class-loading-in-a-session-bean-p23759666.html

-David

On May 27, 2009, at 9:56 AM, Jean-Sébastien Scrève wrote:

>
> Hi,
>
> I have a pretty annoying problem with Enum types.
>
> I have the following session bean implementation :
>
> @WebService
> @Stateless (name =
> "net.atos.xastory.csm.contract.CatalogueStockManagementService")
> @Local (CatalogueStockManagementService.class)
> public class CatalogueStockManagementServiceImpl implements
> net.atos.xastory.csm.contract.CatalogueStockManagementService {
>
> 	public Price getPrice() {
> 		return new Price();
> 	}
> 	
> 	private Currency getCurrency() {
> 		return net.atos.xastory.csm.core.product.Currency.EUR;
> 	}
> }
>
> Price is a POJO. Currency is an Enum type.
> I have a Class Not Found exception on the Currency type at OpenEJB  
> startup.
> (OpenEJB + Tomcat).
>
> I dug into the problem and I think I found the problem.
>
> In TempClassLoader I see the following change :
>
> // Annotation classes must be loaded by the normal classloader
> // So must Enum classes to prevent problems with the sun jdk.
> if (isAnnotationClass(bytes) || isEnum(bytes)) {
>            return Class.forName(name, resolve,
> getClass().getClassLoader());
> }
>
> isEnum was added recently and causes my problem. Was is the problem  
> we want
> to avoid with Jdk ?
> Shouldn't we try loading from TempClassLoader first then do a
> Class.forName() ?
>
> I can fill up a JIRA if want to.
>
> Regards,
>
> Jean-Sébastien Scrève.
>
>
> -- 
> View this message in context: http://www.nabble.com/Enum-class-loading-in-a-session-bean-tp23746554p23746554.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>