dev@glassfish.java.net

URGENT: ACTION: Nandina Ektare: Latest JSR-303 breaks some things

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Mon, 27 Jul 2009 20:06:51 -0700

>>>>> On Mon, 27 Jul 2009 18:35:17 -0700, Ed Burns <Ed.Burns_at_Sun.COM> said:

EB> Mitesh, if you see this message, there's an FYI for you at the end.
>>>>> On Mon, 27 Jul 2009 17:21:27 -0700, Ed Burns <Ed.Burns_at_Sun.COM> said:

>>>>> On Mon, 27 Jul 2009 17:09:31 -0700, Ed Burns <Ed.Burns_at_Sun.COM> said:
EB> I've created an SVN tag for the latest source drop of JSR-303 from
EB> JBoss, per the instructions at [1]. The tag is

EB> http://mercurial.sfbay.sun.com/svn/glassfish/tags/bean-validator-3.0-JBoss-4.0.0.Beta2-b01

EB> STOP THE PRESSES. Mitesh alerted me to a problem with this binary.

EB> Please hold off. I'll have a new tag.

EB> Turns out the new release from JBoss does have some problems.

EB> Nandini, I built glassfishv3 HEAD from a fresh svn checkout today,
EB> dropped in the latest OSGi jar that I generated from the latest source
EB> from jboss [1], and started it up. Sadly, I received this exception:

EB> EVERE: Exception in command execution : java.lang.NullPointerException
EB> java.lang.NullPointerException
EB> at org.hibernate.validation.xml.ValidationXmlParser.getInputStreamForPath(ValidationXmlParser.java:234)
EB> at org.hibernate.validation.xml.ValidationXmlParser.getValidationConfig(ValidationXmlParser.java:207)

I have fixed this simple problem in our fork of their source code and
sent them the patch. The updated jar is at [1]. Now I'm getting
another problem. If I set suspend=y in domain.xml and attach the
debugger, I can diagnose the problem. Here are my findings:

Nandini, the first thing you need to do is change your
WriteableView.java so that it imports BeanDescriptor from the package
javax.validation.metada.

Then you can build your hk2 config.jar and see the following problem
when bringing up glassfish.

Callstack at time of problem:

ValidatorImpl.collectMetaConstraintsForPath:676
ValidatorImpl.validateValue:556
ValidatorImpl.validateValue:148
WriteableView.handleValidation:564
WriteableView.setter:147
WriteableView.invoke:106

Sourcecode around callstack:

                final BeanMetaData<T> metaData = getBeanMetaData( clazz );
                if ( !propertyIter.hasNext() ) {

                        //use metadata first as ReflectionHelper#containsMember is slow
========> HERE if ( metaData.getPropertyDescriptor( elem.getName() ) == null ) {
                                throw new IllegalArgumentException(
                                                "Invalid property path. There is no property " + elem.getName() + " in entity " + metaData.getBeanClass()
                                                                .getName()
                                );
                        }

                        List<MetaConstraint<T, ? extends Annotation>> metaConstraintList = metaData.geMetaConstraintsAsList();
                        for ( MetaConstraint<T, ?> metaConstraint : metaConstraintList ) {
                                if ( metaConstraint.getPropertyName().equals( elem.getName() ) ) {
                                        metaConstraints.add( metaConstraint );
                                }
                        }
                }
                else {

Values:

clazz: com.sun.enterprise.config.serverbeans.JavaConfig
elem.getName: jvmOptions

Problem. For some reason, when the code reaches ==> HERE (see above),
there is no propertyDescriptor for jvmOptions in the metadata for
JavaConfig. I'm not sure why this is.

Ed


[1] http://javaweb.sfbay.sun.com/~edburns/bean-validator.jar


-- 
| ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
| homepage:         | http://ridingthecrest.com/