ejb@glassfish.java.net

Re: Holder Class Error

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Thu, 22 Jun 2006 16:24:52 -0400

Ning Zhu wrote:

>Hi,
>
Hi Ning,

I'm forwarding the note to the corba team to see if they know why
org.omg.CORBA.BooleanHolder is causing that exception. Please also post
the full stack trace. You can also just send the boolean as a return
value or write a simple struct class that holds your in/out parameters.

--ken

>
>We are running into a new problem, which is about "Holder" class. When we
>trying to do output and in/out parameters for ejb, we just start from a very
>simple test and here is the code:
>
>// asp.dorp.Content
>
>package asp.dorp;
>import javax.ejb.Remote;
>@Remote
>public interface Content {
> void getContentbyID(org.omg.CORBA.BooleanHolder rights);
>}
>
>//asp.dorp.ContentBean
>
>package asp.dorp;
>import javax.ejb.Stateless;
>@Stateless
>public class ContentBean implements asp.dorp.Content {
> public ContentBean() {
> }
>
> public void getContentbyID(org.omg.CORBA.BooleanHolder rights) {
> rights.value = true;
> }
>}
>
>// Test client, standalone client from same app server, not enterprise
>client
>
>package test;
>
>public class Main {
> public Main() {
> }
>
> public statis void main(String[] args) {
> org.omg.CORBA.BooleanHolder rights = new
>org.omg.CORBA.BooleanHolder(false);
> try {
> javax.naming.InitialContent ic = new javax.naming.InitialContent();
> asp.dorp.Content local = (asp.dorp.Content)
>ic.lookup("asp.dorp.Content");
> local.getContentbyID(rights);
> // this is where we always getting an error of
>java.lang.ClassCastException: org.omg.CORBA.BooleanHolder
> }
> catch(Exception e){}
> }
>}
>
>We have no clue how to use this holder class now. Could you help us?
>
>Ning
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>
>