-
1. Re: ClassCastException accessing EJB3 from portlet
soshah Jul 26, 2006 12:42 PM (in response to cuoz)Gary-
Can you post a representation of how both your ear files are packaged?
Thanks
Sohil -
2. Re: ClassCastException accessing EJB3 from portlet
unibrew Jul 26, 2006 1:16 PM (in response to cuoz)My guess would be that you are packaging Client.class in both ears and you should have it only in ejb3 package.
-
3. Re: ClassCastException accessing EJB3 from portlet
soshah Jul 26, 2006 1:26 PM (in response to cuoz)Since the exception is happening in the Portal layer (in the Portlet) wouldn't the Client.class have to be in the ear file that holds the portlet.
which from your post looks like you are packaging it in the portlet ear.
Again, information on how the two files are packaged will throw more light on the issue -
4. Re: ClassCastException accessing EJB3 from portlet
cuoz Jul 26, 2006 2:46 PM (in response to cuoz)Thank you for the responses. Here is the packaging details:
for the EJB3 deployment:
panel-server.ejb3:
class files for both client & server
META-INF/persistence.xml
META-INF/jboss.xml (security domain declaration)
for the portlet deployment:
panel-email.war:
WEB-INF/classes (portlet related classes)
WEB-INF/lib/panel-client.jar (client jar for session & interfaces)
WEB-INF/email-object.xml
WEB-INF/portlet-instances.xml
WEB-INF/portlet.xml
WEB-INF/web.xml
unibrew: you indicated that I should not have client classes in both places, but my past experience (regular webapps, not portlets) is that to hot-deploy and not affect multiple applications I need to have them in both places and have call-by-value & such configured (which I believe I do). I am able to do this with my regular test war file.
My goal is to have appropriate packaging to allow updates to the EJB3 application without needed to redeploy all the portlets & other applications (jbpm will be in the mix also).
Thank you for the help,
gary. -
5. Re: ClassCastException accessing EJB3 from portlet
unibrew Jul 26, 2006 3:38 PM (in response to cuoz)So, you can have Client.class just in war files. ejb3 archive could still be hot-deployed at any time as far as the class still implements Client interface. Call-by-value has nothing with it because if you deploy Client.class in different packages then it has got different classloaders which causes that they are not the same class for JVM and cannot be casted.
Sohil gave an idea to move classes from your lib jar to WEB-INF/classes and check whether it works.
Moreover, we don't see any application.xml in this ear definition. Maybe you could achieve loading lib jar only once by defining it there. -
6. Re: ClassCastException accessing EJB3 from portlet
cuoz Jul 26, 2006 5:31 PM (in response to cuoz)Ok, I made progress and got it to "work", but it's not 100% of what I was hoping for. Here's what I did, maybe there is a way to improve on it to obtain my ultimate goal.
1. I packaged all of the applications into their own ear files, with loader-repository entries in jboss-app.xml.
2. I switched from local interfaces to remote
3. I needed to include the server classes (ClientEJB) as well as the client classes with the web application.
4. I tested this setup with a portlet and also a full webapp. I was able to hot deploy any piece(s) that I wanted without affecting operation of the others.
The only drawback is that I needed to have all the server classes in the client applications. I'm guessing that I didn't have to do this with my EJB2.1 application because I was actually dealing with proxies for the home & local/remote interfaces.
At some point I'll test to see if I actually need the loader-repository entries or not.
Thanks again for the assistance. Let me know if you have better ideas for how to accomplish what I'm looking for.
Gary.