Packaging of EJB3 Entity Beans inside .war

2005-06-12 Thread Alexander Taylor
Hi,
Does anyone know how to correctly package an EJB3/JBoss Entity bean
inside a .WAR file for use in Tomcat correctly?

I can correctly pass an EJB3 entity object to my Tomcat client using a
sesson bean, but when I try to cast the returned object to my Entity
bean type on the client I get a ClassCastException.

I have seen in various places that this may be a packaging issue

Does anyone know how/where to place the .class files for an Entity
object in the war, or what structure to place them in?

I have tried dumping them in a .jar in various places, to no avail.

Cheers,
Alex.


-- 
Alexander Taylor <[EMAIL PROTECTED]>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



EJB3/JBoss Entity Bean remoting issue

2005-05-25 Thread Alexander Taylor
Hi, 
I am having an issue with a ClassCastException whilst trying to remote
an EJB3 entity bean. 

I have a simple Entity bean "Account" which appears to function
perfectly. I then have a stateless session bean with the following
function: 

public Account findAccountById(int id) { 
Account a = (Account)manager.find(Account.class, id); 
} 

I.e. return the account that matches the given id. 

In my client (on top of Tomcat 5.5 - external to JBoss - I know perhaps
that this is not currently supported, but it seems to work in most
cases), I have a call in a Spring MultiActionController: 


AccountServices service = (AccountServices)
context.lookup(AccountServices.class.getName()); 
Account a = service.findAccountById(id); 

Which causes: 

java.lang.ClassCastException: db.mapping.Account 
at $Proxy0.findAccountById(Unknown Source) 
at
web.AccountMAController.showAccountSummary(AccountMAController.java:43) 

etc.. 

Interestingly, if I return the account in an ArrayList from the function
findAccountById (i.e. getResultList), and pass this resultant list to a
JSP page, and inject the arraylist as a bean - I can access the members
of the Account object perfectly. 

Also, if I return the Entity bean as an "Object", and pass this object
through to a jsp, this works too - i.e. i can access the members.  So my
object is clearly of the type db.mapping.Account, but casting to it
causes the above exception.

This exception is the only output given (other than the full stack
trace) - nothing goes to catalina.out

I cannot fault my code, and indeed this workaround seems to work - so my
EJB is clearly returning the correct data, but I cannot cast to the
Account object from within the servlet. 

I am running this on Tomcat 5.5.9.

There is no exception thrown on the JBoss Server, so there would appear
to be some issue with the Tomcat class-loader here.

Ideas anyone?

Cheers,
Alex.


-- 
Alexander Taylor <[EMAIL PROTECTED]>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]