"could not create Vfs.Dir from url" when compiling with Maven

4,200 views
Skip to first unread message

Sébastien Tromp

unread,
Jul 10, 2011, 8:46:50 AM7/10/11
to gwt-validation
Hello,

I am currently using GWT + Maven + gwt-validation-2.0-preview-r209,
and when compiling with Maven, I get the following error:

14:31:06.026 [main] ERROR org.reflections.Reflections - could not
create Vfs.Dir from url. ignoring the exception and continuing
[INFO] org.reflections.ReflectionsException: could not create Vfs.Dir
from url, no matching UrlType was found [file:/C:/Users/Daedin/.m2/
repository/net/kindleit/gae-runtime/1.4.3/gae-runtime-1.4.3.pom]
[INFO] either use fromURL(final URL url, final List<UrlType> urlTypes)
or use the static setDefaultURLTypes(final List<UrlType> urlTypes) or
addDefaultURLTypes(UrlType urlType) with your specialized UrlType.
[INFO] at org.reflections.vfs.Vfs.fromURL(Vfs.java:104)
~[reflections-0.9.5-RC2.jar:na]
[INFO] at org.reflections.vfs.Vfs.fromURL(Vfs.java:89)
~[reflections-0.9.5-RC2.jar:na]
[INFO] at org.reflections.Reflections.scan(Reflections.java:136)
[reflections-0.9.5-RC2.jar:na]
[INFO] at org.reflections.Reflections.<init>(Reflections.java:91)
[reflections-0.9.5-RC2.jar:na]
[INFO] at com.em.validation.rebind.scan.ClassScanner.<init>(Unknown
Source) [gwt-validation-2.0-preview-r209.jar:na]
...

The build process goes on, and later on I have a bunch of warning like
these:

Rebinding javax.validation.ConstraintValidatorFactory
[INFO] Invoking generator
com.em.validation.rebind.generator.gwt.GwtConstraintValidatorFactoryGenerator
[INFO] [WARN] Not generating (found by print writer):
com.em.validation.client.generated.factory.GeneratedConstraintValidatorFactory

The build process then finishes with a "success" status.

I can then run Unit Tests just fine, but have a NullPointerException
at runtime (in the GWT app):

java.lang.NullPointerException
at
com.em.validation.client.ValidatorImpl.validateProperty(ValidatorImpl.java:
89)
at
com.em.validation.client.ValidatorImpl.validateProperty(ValidatorImpl.java:
100)
at
com.fiveorbs.client.presenter.validation.LoginValidator.validateLoginName(LoginValidator.java:
20)

The code that brings the exception is:

final Login validationLogin = new Login(loginName, null);
final Set<ConstraintViolation<Login>> validateProperty =
validator.validateProperty(validationLogin,
"loginName");

Where Login is:

public class Login extends BaseAction implements Action<LoginResult> {

@NotNull
@Size(min = 3, max = 25)
private String loginName;
private String password;

public Login(final String loginName, final String password) {
this.loginName = loginName;
this.password = password;
}

As mentioned above, I cannot reproduce it with a test case, so it is
likely an issue in my configuration / deployment. Would you have any
idea as to what that may be?

Regards,
--
seb

Sébastien Tromp

unread,
Jul 10, 2011, 9:12:27 AM7/10/11
to gwt-validation
For information, the issue also occurs with the r199 version.

2011/7/10 Sébastien Tromp <sebasti...@gmail.com>



--
Seb

Sébastien Tromp

unread,
Jul 10, 2011, 9:23:08 AM7/10/11
to gwt-validation
Debugging the code show that the GeneratedReflectorFactory is used to get the proper reflector:

public <T> IReflector<T> getReflector(Class<? extends T> targetClass) {
if(targetClass == null || Object.class.equals(targetClass)) return null;
return (IReflector<T>)this.reflectorCache.get(targetClass);
}

However, the reflectorCache is empty at that point.

The RuntimeReflectorFactory, by comparison, creates a reflector if it doesn't exist:

@Override
public <T> IReflector<T> getReflector(Class<? extends T> targetClass) {
 //return a null reflector when the object doesn't warrant reflecting
        if(Object.class.equals(targetClass) || Annotation.class.equals(targetClass) || targetClass == null) return null;
        
        @SuppressWarnings("unchecked")
        RuntimeReflectorImpl<T> reflector = (RuntimeReflectorImpl<T>)this.reflectorCache.get(targetClass);              
        if(reflector == null) {
            reflector = new RuntimeReflectorImpl<T>(targetClass);
            
            this.reflectorCache.put(targetClass, reflector);
            
            //add constraint descriptors
            reflector.setConstraintDescriptorMap(ConstraintDescriptionResolver.INSTANCE.getConstraintDescriptors(targetClass));

            //add the super reflector and interface reflectors
            RuntimeReflectorImpl<T> runtime = (RuntimeReflectorImpl<T>)reflector;
            runtime.setSuperReflector((Reflector<?>)ReflectorFactory.INSTANCE.getReflector(targetClass.getSuperclass()));
            for(Class<?> iface : targetClass.getInterfaces()) {
                runtime.addReflectorInterface((Reflector<?>)ReflectorFactory.INSTANCE.getReflector(iface));
            }           
        }
        
        return reflector;
}

Would you have an idea as to why no reflector creation is done? Or, alternatively, how can I force the use of the RuntimeFactory for instance?

Regards,
-- 
seb

2011/7/10 Sébastien Tromp <sebasti...@gmail.com>



--
Seb

chris.r

unread,
Jul 11, 2011, 10:37:28 AM7/11/11
to gwt-validation
"public class Login extends BaseAction implements Action<LoginResult>
{ "

Are action and BaseAction GWT compatible classes? However it happens,
Vfs.Dir is being pulled in which is not compatible out of the box.
This library only works with GWT compatible classes on the client
side.

On Jul 10, 9:23 am, Sébastien Tromp <sebastien.tr...@gmail.comr>
wrote:
> 2011/7/10 Sébastien Tromp <sebastien.tr...@gmail.com>
>
>
>
>
>
>
>
>
>
> > For information, the issue also occurs with the r199 version.
>
> > 2011/7/10 Sébastien Tromp <sebastien.tr...@gmail.com>

Sébastien Tromp

unread,
Jul 11, 2011, 10:42:01 AM7/11/11
to gwt-val...@googlegroups.com
Action comes from GWT-Dispatch, and is GWT compatible.
As for BaseAction, I assume it is GWT compatible: it contains a single property, and a no-args constructor. It is furthermore sent over the wire from the client to the server, and there is no issue on this side.

Thanks for your reply :)
-- 
seb

2011/7/11 chris.r <chris....@gmail.com>
--
You received this message because you are subscribed to the Google Groups "gwt-validation" group.
To post to this group, send email to gwt-val...@googlegroups.com.
To unsubscribe from this group, send email to gwt-validatio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-validation?hl=en.




--
Seb

chris.r

unread,
Jul 11, 2011, 6:12:13 PM7/11/11
to gwt-validation
Sorry then. It's probably some other dependency. If it's crashing
the generation process none of the reflectors get generated.

If you need to exclude classes check out this issue:
http://code.google.com/p/gwt-validation/issues/detail?id=34&can=1

On Jul 11, 10:42 am, Sébastien Tromp <sebastien.tr...@gmail.com>
wrote:
> Action comes from GWT-Dispatch, and is GWT compatible.
> As for BaseAction, I assume it is GWT compatible: it contains a single
> property, and a no-args constructor. It is furthermore sent over the wire
> from the client to the server, and there is no issue on this side.
>
> Thanks for your reply :)
> --
> seb
>
> 2011/7/11 chris.r <chris.ruff...@gmail.com>

chris.r

unread,
Jul 13, 2011, 10:41:41 PM7/13/11
to gwt-validation
Actually, I've started to see this error as well, about the VFS not
being created. I have no idea what I did to trigger it's creation
because it comes from the Reflections library used in the Class
Scanner.

I'd replace it if I could find something better but It's the best
option other than rolling our own.

I've mitigated it as best as I can and updated to the newest version
of the Reflections library. I may have to look into it from the code
side and submit patches to it or something.

It *actually* looks like it has something to do with jars that the GPE
plugin is putting on the classpath that don't actually exist. Not
sure.

Chris

bogdanelloo

unread,
Aug 23, 2011, 11:06:59 AM8/23/11
to gwt-validation
hi,

I am using GWT SDK 2.3.0 + gwt-validation-2.0-preview-r255 (no maven)

I' ve followed the specifications below (with some changes) in order
to configure my GWT project to use GWT Validation Framework:
http://code.google.com/p/gwt-validation/wiki/GWT_Validation_2_0

Changes:
1. I replaced google-colelctions with guava.
2. I added javassist; otherwise the compilation would fail with:
[ERROR] Unexpected java.lang.NoClassDefFoundError: javassist/bytecode/
ClassFile

When I start the compilation process the following error is thrown:
ERROR org.reflections.Reflections - could not create Vfs.Dir from
url. .......
After the above error is encountered, the permutations are generated
and the compilation completes successfully.

When I run the code where the validations take place the following
error is encountered:
ERROR org.reflections.Reflections - could not create Vfs.Dir from url.
ignoring the exception and continuing
org.reflections.ReflectionsException: could not create Dir using
org.reflections.vfs.Vfs$DefaultUrlTypes$1 from url file:/C:/Program
%20Files/eclipse-jee-indigo-win32-x86_64/plugins/
com.google.appengine.eclipse.sdkbundle_1.5.2.r37v201107211953/
appengine-java-sdk-1.5.2/lib/shared/jsp-api.jar

Is there a patch available for this issue or is under development?

Thank you,
bogdan.

chris.r

unread,
Aug 24, 2011, 11:24:12 AM8/24/11
to gwt-validation
This is a problem with Reflections and the way that it handles virtual
file systems (jars). The issues page is here: http://code.google.com/p/reflections/issues/list

I've also updated the wiki page you were using to link to the correct
dependencies (http://code.google.com/p/gwt-validation/wiki/
Dependencies) wiki page.

Chris
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages