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

Custom classloader not taken into account in EnumInflater #12

Closed
manuelbernhardt opened this issue Sep 8, 2011 · 8 comments
Closed
Assignees

Comments

@manuelbernhardt
Copy link
Contributor

On line 378 in Inflaters, the Enumeration clazz is fetched like this:

    val clazz = Class.forName(path)

When using this with a custom classLoader such as in the Play environment, Enumerations can't be found.

@rktoomey
Copy link
Contributor

rktoomey commented Sep 8, 2011

Good catch - thanks! Just published a fix in latest 2.8.1 build of 0.0.8-SNAPSHOT - please update and let me know if this fixes the issue.

Please let me know if you need 2.9.0 instead - we are crunching toward an internal release and I need to sort out some merge issues with that branch.

@rktoomey
Copy link
Contributor

rktoomey commented Sep 8, 2011

OK, fresh build of 0.0.8-SNAPSHOT for 2.9.0-1 just published. I suppose I need to re-branch and switch over to 2.9.1- it never ends... :)

@ghost ghost assigned rktoomey Sep 8, 2011
@manuelbernhardt
Copy link
Contributor Author

Wow, now that was fast, thanks!

I don't need 2.9 since Play is for now running on 2.8.1 - 2.9.1 will be used in Play 2.0 which is likely to reach maturity in a couple of months.

I'll give this a shot as soon as possible.

@manuelbernhardt
Copy link
Contributor Author

Hi Rose,

I'm afraid it does not work entirely yet, now I get a Class.forName() lookup triggered at line 381:

val companion: Any = clazz.companionObject

The stacktrace says:

Caused by: java.lang.ClassNotFoundException: models.Visibility$
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.novus.salat.package$$anon$1.companionClass(package.scala:44)
at com.novus.salat.package$$anon$1.companionObject(package.scala:46)
at com.novus.salat.transformers.in.EnumInflater$class.$init$(Injectors.scala:381)

Thanks,

Manuel

rktoomey added a commit that referenced this issue Sep 9, 2011
…hod that uses the list of classloaders in context to resolve.
@rktoomey
Copy link
Contributor

rktoomey commented Sep 9, 2011

Sorry about that! Searched for every use of Class.forName and
replaced with the method that uses the list of classloaders in context
to resolve. Just published a new snapshot.

On 9 September 2011 08:30, Manuel Bernhardt
reply@reply.github.com
wrote:

Hi Rose,

I'm afraid it does not work entirely yet, now I get a Class.forName() lookup triggered at line 381:

   val companion: Any = clazz.companionObject

The stacktrace says:

   Caused by: java.lang.ClassNotFoundException: models.Visibility$
       at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:169)
       at com.novus.salat.package$$anon$1.companionClass(package.scala:44)
       at com.novus.salat.package$$anon$1.companionObject(package.scala:46)
       at com.novus.salat.transformers.in.EnumInflater$class.$init$(Injectors.scala:381)

Thanks,

Manuel

Reply to this email directly or view it on GitHub:
https://github.com/novus/salat/issues/12#issuecomment-2050703

@manuelbernhardt
Copy link
Contributor Author

It's getting closer! I now got one left here, it seems:

at java.lang.Class.forName(Class.java:169)
at com.novus.salat.transformers.out.EnumStringifier$class.$init$(Extractors.scala:250)

rktoomey added a commit that referenced this issue Sep 13, 2011
@rktoomey
Copy link
Contributor

Thanks, Manuel, I apologise for the delay - was working all weekend. Just published a snapshot build that replaced every naked Class.forName with one that respects custom classloaders.

@manuelbernhardt
Copy link
Contributor Author

Thanks Rose, it works like a charm now!

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