tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: ClassCastException on JNDI lookup
Date Wed, 09 Jul 2008 09:14:27 GMT

On Jul 8, 2008, at 8:47 AM, chawax wrote:

> And two interfaces, generated everytime too :
> - @javax.ejb.Local interface EmployeeServiceLocal extends  
> EmployeeService
> - interface EmployeeService
[...]
> I also have a ejb-jar.xml file with EJB defined as following :
>
> <session>
>    <ejb-name>EmployeeServiceBean</ejb-name>
>    <local>t4.core.employee.EmployeeServiceLocal</local>
>    <ejb-class>t4.core.employee.EmployeeServiceBean</ejb-class>
>    <session-type>Stateless</session-type>
>    <transaction-type>Container</transaction-type>
> </session>

The issue is <local> must refer to interfaces that extend  
javax.ejb.EJBLocalObject, i.e. the old style EJB 2.x interfaces.  You  
just need to update your descriptor to use the <business-local>  
element instead as in:

   <session>
      <ejb-name>EmployeeServiceBean</ejb-name>
      <business-local>t4.core.employee.EmployeeServiceLocal</business- 
local>
      <ejb-class>t4.core.employee.EmployeeServiceBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
   </session>

That should fix the issue.  Alternatively, you can let the annotation  
do the work and leave EmployeeServiceLocal out of your ejb-jar.xml  
entirely.

I'm surprised you didn't get a validation failure.  We aggressively  
check for all sorts of possible mistakes, such as using <business- 
local> where <local> should be used or using <local> where <local- 
home> should be used, etc.  You just happened to find one we didn't  
check for :)   Looks like a pretty important one too!  We will  
definitely add it for the next release.

> Thanks in advance for your help ;)

No problem!

> And congratulations for the good job made on OpenEJB. I tried to use  
> other
> embedded containers (JBoss Embedded, Glassfish embedded,  
> EJB3Unit, ...) and
> met so many bugs I could not make them work. I am not far to succeed  
> with
> Open EJB !

Thank you very much for the positive feedback, we definitely  
appreciate it.

-David


Mime
View raw message