Hi,
Just my $0.02:
I've had this exception due to multible classloaders.
>From JVM specification, section 5.3:
"At run time, a class or interface is determined not by its
name alone, but by a pair: its fully qualified name and its
defining class loader. Each such class or interface belongs
to a single runtime package. The runtime package of a class
or interface is determined by the package name and defining
class loader of the class or interface."
In my case I had different classes A and B in the same package
loaded by different classloaders, and when trying to access a
package private member in A from B I got this exception.
Could be similar things happening here.
Best Regards,
Ole Husgaard.
Sebastien Alborini wrote:
>
> "Bordet, Simone" wrote:
> >
> > Hey Oleg,
> >
> > > BTW, I'm getting an Exception on shutdown in that place, but haven't
> > > finished its investigation yet.
> > > But maybe you or somebody else would understand what happens faster
> > > than I, so please take a look:
> > >
> > > BEAN EXCEPTION:null
> > > java.lang.IllegalAccessException
> > > at java.lang.reflect.Field.get(Native Method)
> >
> > Maybe I'll say something you already know, but this can happen if the
> > constructor of the data member is not accessible (ie package private or
> > protected or private). Is it your case ? Otherwise can you post more details
> > ?
>
> Hi,
>
> I get the same exception with the stateful bean in testbeans
> (BMTStatefulBean). The declared field is: private SessionContext
> sessionContext;
>
> javax.ejb.SessionContext is an interface, the actual field is
> org.jboss.ejb.StatefulSessionContext.StatefulSessionContextImpl, which
> is an inner protected class, and apparently the constructor can't be
> accessed from
> org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager... (I tried
> to switch to a public inner class, without any luck)
>
> Any ideas?
>
> Sebastien
>
> [Container factory] BEAN EXCEPTION:null
> [Container factory] java.lang.IllegalAccessException:
> org/jboss/test/testbean/bean/StatefulSessionBean
> [Container factory] at java.lang.reflect.Field.get(Native Method)
> [Container factory] at
>
>org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:269)
> [Container factory] at
>
>org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache.java:49)
> [Container factory] at
>
>org.jboss.ejb.plugins.EnterpriseInstanceCache$1.execute(EnterpriseInstanceCache.java:339)
> [Container factory] at
> org.jboss.util.WorkerQueue$QueueLoop.run(WorkerQueue.java:201)
> [Container factory] at java.lang.Thread.run(Thread.java:484)
>
> >
> > > It looks like SecurityManager doesn't allow the access to private
> > > fields, but I haven't installed a SecurityManager (more precisely,
> > > the correspondent line in jboss.properties is commented)
> > > and my server.policy "Allows everything".
> > > And, BTW, why the passivation is performed on shutdown?
> > > Does jBoss restores the passivated instances after restart???
> >
> > Yes, it should (ie on restart it does not activate them; it should do it
> > when the bean is called again). Well I never tested this, maybe I'll try
> > now...
> >
> > HTH,
> >
> > Simon