[hibernate-dev] HV 4.2 and joda-time jar CNFE issue (but used to work with HV 4.1) ...

Gunnar Morling gunnar.morling at googlemail.com
Thu Aug 4 19:03:48 EDT 2011


Hi,

I just had a short look into the relevant bits in HV.

What I think is that in
o.h.v.metadata.ConstraintHelper#isJodaTimeInClasspath() the class
org.joda.time.ReadableInstant can successfully be loaded. Otherwise
the Joda specific validator wouldn't be in the list of processed
validators in o.h.v.util.ValidatorTypeHelper (the Joda validator will
always be loaded if Joda is available also if constraints are
actually applied to java.util.Date/Calendar only).

The question then would be why the class is visible/available in the
first situation but not in the latter. Maybe the ValidatorFactoryImpl
is initialized in the context of the web module (where Joda is
available according to the last answer) but the actual validation
later on happens in the context of a JAR in the EAR.

So maybe it would help to put Joda into the <EAR>/lib directory
instead of WEB-INF/lib of the WAR.

Hth,

--Gunnar


2011/8/4 Scott Marlow <smarlow at redhat.com>:
> On 08/04/2011 10:59 AM, Hardy Ferentschik wrote:
>> I wonder though what he is actually validating (the actual annotated
>> bean). He is mentioning HV 4.1 and there we did not even have joda time
>> support
>> so I don't see how he validated Joda time instances using 4.1 without
>> providing a custom ConstraintValidator.
>>
>
> I asked in the jira and got this response:
>
> "
> My app doesn't use joda-time directly. When I started migration from
> JBoss 6 to 7 I had to copy joda-time into WEB-INF/lib because the EAR's
> web module is using Seam International and the JAR requires joda-time.
> AFAIK, joda-time was included in JBoss 6.
>
> The annotations for HV like @Min etc. are in domain classes which are in
> a utility project included as a JAR in <EAR>/lib. However, such a JAR
> doesn't see JARs in WEB-INF/lib.
>
> I think the best solution for HV's dependency would be to have a
> joda-time module as you mentioned above.
> "
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>



More information about the hibernate-dev mailing list