Do you need to enforce/have to have that protected default constructor?  I'm getting 
by just fine with base classes being appropriately serialized in my Axis application.  

-----Original Message-----
From: Leschke Scott-QA2775 [mailto:[EMAIL PROTECTED]
Sent: Friday, February 21, 2003 5:29 PM
To: '[EMAIL PROTECTED]'
Cc: 'Almeida, Timothy'
Subject: RE: Base Classes and java.lang.IllegalAccessException



I apologize a bit since my example doesn't show this. The methods of the base class 
are public so can't they basically be thought of as being part of subclass via the 
extension. It works fine outside of Axis.

Although with Java being incrementally loaded perhaps the base class isn't being 
loaded because relection is being used...

abstract class A
{
   public int getSomeAttribute()
   {
      return someAttribute;
   }

   public void setSomeAttribute(int value)
   {
      this.someAttribute = value;
   }

   protected A()
   {}

   private int someAttribute = 0;
}

public class B
   extends A
{
   public B()
   {
      super();
   }
}

-----Original Message-----
From: Almeida, Timothy [mailto:[EMAIL PROTECTED]
Sent: Friday, February 21, 2003 5:12 PM
To: Scott Leschke
Subject: RE: Base Classes and java.lang.IllegalAccessException


Doesn't surprise me very much. I would say, the BeanSerializer is iterating
through all the getters/setters and attempting to call them. Clearly, since
it isn't in the same package it will fail when trying to execute methods of
private classes. If reflection weren't being used to invoke those methods,
the compiler would have caught the 'illegal access'. One might say its an
Axis bug in that it does not trap and ignore such exceptions; probably is
not a bug that it cannot invoke protected methods, though.

-----Original Message-----
From: Leschke Scott-QA2775 [mailto:[EMAIL PROTECTED]
Sent: Friday, February 21, 2003 4:56 PM
To: '[EMAIL PROTECTED]'
Subject: FW: Base Classes and java.lang.IllegalAccessException



I haven't seen any response to this so I'll try one more time.

Scott

-----Original Message-----
From: Leschke Scott-QA2775 
Sent: Thursday, February 20, 2003 10:03 AM
To: '[EMAIL PROTECTED]'
Subject: Base Classes and java.lang.IllegalAccessException


We're using Axis 1.0 and are having a problem with serialization using
BeanSerializer. We have a number of classes that are public and have public
default constructors but they extend abstract classes that have package
level visibility. For example:

abstract class A
{
   protected A()
   {}
}

public class B
   extends A
{
   public B()
   {
      super();
   }
}

When BeanSerializer attempts to serialize B, it throws
java.lang.IllegalAccessException because A is not public. Changing the
visibility of A to public corrects the problem. Is this an artifact of Java
reflection? An Axis bug?

Thanks,

Scott

Reply via email to