Hello,
yes, it has to do with the finder methods, i.e. with the finder methods
other than the findByPrimaryKey(). This finder methods as well as the create
method works fine.
I had a look at the JOnAS source code and I found the problem. The create-
and findByPrimaryKey method both create the instances like this:
ctx = ejbobj.createContext();
eb = (Test.TestEJB)ctx.getInstance(); //eb is of type TestEJB
The other finder methods get their instance via:
eb = (Test.TestEJB)getAvailable(); //this is also the place where the
ClassCastException occurs
So I first had a look on the createContext()-method
(JBeanEntity.java)mentioned above and found a comment hinting that the same class
loader should be
used that loaded the home interface:
try {
cn = home.getEnterpriseBeanClassName();
// load the bean with the same class loader of the Home
c = home.getClass().getClassLoader().loadClass(cn);
}
catch(...){...}
try
{
EntityBean eb = (EntityBean)c.newInstance();
...
}
The getAvailable() method in the end, just loads the class via
cn = home.getEnterpriseBeanClassName();
c = Class.forName(cn);
...
EntityBean eb = (EntityBean)c.newInstance();
And that is the problem. The class during the createContext-call is loaded
via the com.lutris.classloader.MultiClassLoader whereas the class during
getAvailable() is loaded via the sun.launcher(?) (don't remember the right
name, sorry).
So I changed the code in getAvailable() to also use the statement
c = home.getClass().getClassLoader().loadClass(cn);
but this time without the "home." and it seems to work.
But I'm wondering why nobody else has this problem???
And my bean does nothing great, as the name already says, it is just a
stupid test bean.
Ah, regarding running the examples. I haven't run them yet, but if there
is enough time, I will try to do that today.
Have a nice day,
Marc
>Hi Marc,
>
>Your problem is strange.
>Are you sure it is about finder methods. The error message is:
> "Failed to CREATE a new instance" ??
>Are the given JOnAS examples works fine ?
>(It will be interesting to run the example/eb)
>
>Kind regards.
>Hélène.
>
>>
>>...
>>
--
-=- Hélène JOANIN -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
mailto:[EMAIL PROTECTED] http://www.evidian.com
Phone: 33.4.76.29.73.53 Fax: 33.4.76.29.76.00
Download our EJB Server JOnAS at http://www.objectweb.org
--
Marc Eilens
mailto: [EMAIL PROTECTED]
Sent through GMX FreeMail - http://www.gmx.net
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".