Suppose I have an ejb defined in some package and a class defined in the same package. The class is inteded to be a read-only bean of the ejb state, that is, suppose the ejb has a property balance. The read-only bean has a property balance defined as:
double balance; //package visability
public double getBalance(){ //public visability
return blaance;
}
My idea is on my ejb I have a method that returns the read-only state of the ejb to a user. For example, the ejb would have a method as follows:
public ReadOnlyClass getReadOnlyClass(){
ReadOnlyClass readOnly= new ReadOnlyClass();
readOnly.balance = this.balance;
return readOnly;
}
SO HERE's THE PROBLEM!!!!!!!!!
When I use the above approach under weblogic I get an IllegalAccessException on the line:
"readOnly.balance = this.balance;"
Even though both the ejb and the read-only class are defined in the same package, they are not recognized that way. I think this happens because they are loaded by different class loaders. I do not get this exception if the balance instance member of the read-only class is public.
Can anyone offer confirmation or a solution to this problem?
Thanks!
-
package access between ejb's and java classes (0 messages)
- Posted by: Web Master
- Posted on: September 01 2000 16:28 EDT