You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jacek Laskowski <ja...@laskowski.net.pl> on 2007/11/09 22:21:39 UTC

Why is PersistenceUnitBuilder.respectExcludeUnlistedClasses(GBeanData gbeanData) for?

Hi,

I'm still trying to figure out why geronimo refuses seam's jee5 sample
to deploy and stumbled upon
org.apache.geronimo.persistence.builder.PersistenceUnitBuilder.respectExcludeUnlistedClasses(GBeanData
gbeanData) method.

    private void respectExcludeUnlistedClasses(GBeanData gbeanData) {
        boolean excludeUnlistedClasses = (Boolean)
gbeanData.getAttribute("excludeUnlistedClasses");

        if (excludeUnlistedClasses) {
            gbeanData.clearAttribute("jarFileUrls");
        } else {
            gbeanData.clearAttribute("managedClassNames");
        }
    }

Why is this for and how could I set the attribute excludeUnlistedClasses?

I think I'm missing some Geronimo architectural design lessons so it
may seem obvious for the most if not all of you, but can't answer it
myself. If Geronimo starts a gbean, can its attributes be changed at
runtime? Am I allowed to deploy a gbean that's already deployed and
change its configuration, i.e. deploy a new configuration whereas the
former's removed.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: Why is PersistenceUnitBuilder.respectExcludeUnlistedClasses(GBeanData gbeanData) for?

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Nov 9, 2007 10:42 PM, David Jencks <da...@yahoo.com> wrote:

> - if you set excludeUnlistedClasses in persistence.xml then we're
> supposed to ignore any jar file urls
> - if you don't set excludeUnlistedClasses we're supposed to ignore
> any class names you provide and rely completely on scanning all jar
> files listed to find the classes to enhance.

IIRC a JPA provider "inside the container" should disregard <class>
and <exclude-unlisted-classes> in persistence.xml as it's only for the
"outside the container" mode. I don't think we pass it on to a jpa
provider. I'm going to see how much effort it would be to let other
jpa providers be players in geronimo.

> Again IIRC openjpa had some major problems dealing with listed
> classes if you supplied both.

Oh, nice to know.

> it's in persistence.xml

I don't think it's taken into account though. I'll try to dig into it
further today.

> yes, but if the attributes were supplied in the constructor nothing
> will happen until you restart the gbean.

...but it's not possible from within a plan. There's no way to deploy
an ear and change gbeans at runtime, is it? I think I'm messing up
administrator's and deployer's responsibilities.

> > Am I allowed to deploy a gbean that's already deployed and
> > change its configuration, i.e. deploy a new configuration whereas the
> > former's removed.
>
> I don't follow what you mean here.

I need to change a gbean configuration at runtime while Geronimo's
running while deploying an ear.

> BTW, is this app using Hibernate rather than OpenJpa?

Yes, but it doesn't really matter as I switched it off so openjpa's
used. It didn't change much - openjpa kept enhancing classes and thus
the exception.

>  I don't know what might happen from openejb's use of openjpa for cmp 2.1, but you
> might try turning off the openjpa module.  This should prevent the
> openjpa enhancer from getting registered, and if its not registered
> it can't cause trouble :-)  If openejb turns openjpa on again for you
> through dependency relationships you might be able to just turn off
> the openjpa enhancer gbean.

That's the idea. Although other apps might not be able to run on such
modified Geronimo, but it would let me finish it and tweak the rest
later. Thanks!

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: Why is PersistenceUnitBuilder.respectExcludeUnlistedClasses(GBeanData gbeanData) for?

Posted by David Jencks <da...@yahoo.com>.
It's not altogether clear from the spec, but...(IIRC)

- if you set excludeUnlistedClasses in persistence.xml then we're  
supposed to ignore any jar file urls
- if you don't set excludeUnlistedClasses we're supposed to ignore  
any class names you provide and rely completely on scanning all jar  
files listed to find the classes to enhance.

Again IIRC openjpa had some major problems dealing with listed  
classes if you supplied both.


On Nov 9, 2007, at 1:21 PM, Jacek Laskowski wrote:

> Hi,
>
> I'm still trying to figure out why geronimo refuses seam's jee5 sample
> to deploy and stumbled upon
> org.apache.geronimo.persistence.builder.PersistenceUnitBuilder.respect 
> ExcludeUnlistedClasses(GBeanData
> gbeanData) method.
>
>     private void respectExcludeUnlistedClasses(GBeanData gbeanData) {
>         boolean excludeUnlistedClasses = (Boolean)
> gbeanData.getAttribute("excludeUnlistedClasses");
>
>         if (excludeUnlistedClasses) {
>             gbeanData.clearAttribute("jarFileUrls");
>         } else {
>             gbeanData.clearAttribute("managedClassNames");
>         }
>     }
>
> Why is this for and how could I set the attribute  
> excludeUnlistedClasses?

it's in persistence.xml
>
> I think I'm missing some Geronimo architectural design lessons so it
> may seem obvious for the most if not all of you, but can't answer it
> myself. If Geronimo starts a gbean, can its attributes be changed at
> runtime?

yes, but if the attributes were supplied in the constructor nothing  
will happen until you restart the gbean.
> Am I allowed to deploy a gbean that's already deployed and
> change its configuration, i.e. deploy a new configuration whereas the
> former's removed.

I don't follow what you mean here.

BTW, is this app using Hibernate rather than OpenJpa?  I don't know  
what might happen from openejb's use of openjpa for cmp 2.1, but you  
might try turning off the openjpa module.  This should prevent the    
openjpa enhancer from getting registered, and if its not registered  
it can't cause trouble :-)  If openejb turns openjpa on again for you  
through dependency relationships you might be able to just turn off  
the openjpa enhancer gbean.

hope this helps
david jencks

>
> Jacek
>
> -- 
> Jacek Laskowski
> http://www.JacekLaskowski.pl