Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRUDControllers in a module fail to render #54

Open
ianrae opened this issue Mar 7, 2015 · 4 comments
Open

CRUDControllers in a module fail to render #54

ianrae opened this issue Mar 7, 2015 · 4 comments

Comments

@ianrae
Copy link

ianrae commented Mar 7, 2015

From the bottom up:

m8 crashes, apparently confused where to look for sampleForm.scala.html. It exists in the app but play-crud perhaps is looking in twixt (since that's where the class that derived from CRUDController is.

java.lang.NoClassDefFoundError: views/html/SampleForm (wrong name: views/html/sa
mpleForm)
java.lang.NoClassDefFoundError: views/html/SampleForm (wrong name: views/html/sa
mpleForm)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at play.utils.crud.TemplateController.call(TemplateController.java:83)
at play.utils.crud.TemplateController.call(TemplateController.java:83)
at play.utils.dyn.DynamicCrudController.render(DynamicCrudController.jav
a:75)
at play.utils.dyn.DynamicCrudController.render(DynamicCrudController.jav
a:75)


NOTE. If I copy TwixtController up into the m8 app and derive SampleController from it, everything works fine.

@hakandilek
Copy link
Owner

Hi @ianrae,

can yo please provide a full sample under https://github.com/hakandilek/play2-crud/tree/master/samples to reproduce the problem.

I can try to identify the problem better then.

@ianrae
Copy link
Author

ianrae commented Mar 11, 2015

I'm trying to figure out how to do that -- i think i need two github repos to do it :(

I found a workaround. In ClasspathScanningControllerRegistry.scanCrud(), add bulder.addUrls to add "org.mef.twixt" explicitly. Now all my controllers are seen. Not sure how to make this into a way that play2-crud can expose to library developers such as myself. Perhaps a value in the .conf file?

 ConfigurationBuilder builder = new ConfigurationBuilder().setUrls(
            ClasspathHelper.forPackage("", cls));
        builder.addUrls(ClasspathHelper.forPackage("org.mef.twixt"));

final Reflections reflections = new Reflections(builder.setScanners(new SubTypesScanner(),
            new TypeAnnotationsScanner()).addClassLoaders(cls));

@hakandilek
Copy link
Owner

instead of 2 repos you can create a branch.

@ianrae
Copy link
Author

ianrae commented Mar 14, 2015

Hi Hakan. I have submitted a pull request with two projects that are in samples/issue54. Let me know what you think. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants