2

I'm working on web application where I have some groovy templating engine and some classes loaded dynamically at runtime. Those templates are cached in local using jbosscache.
When trying to set a clustered environement, I'm going through problem when trying to replicate those templates when running my app in node1 and I have a ClassNotFoundException class UITestTemplate throw in the console in the unmarshalling process which clearlly mean that my application is not able to deserialize an Object with type UITestTemplate.
With jvisualVM I can see that there is no class UITestTemplate in node2 which makes some sence. But, what seems weird is when do I stop both nodes, then start node1 an run my web app so those classes get compiled (I can see them in the monitoring tool). Secondly I start node2 and run my app from there I got the same reported error which means node1 is unable to deserialize the received object having as a class UITestTemplate while it is loaded into JVM.

  • So does this problem an expected behavior with groovy dynamic generated classes? How to woraround it then?
  • Is it related to domain permissions and class loading hierarchy?

NB: I only run into problem when trying to replicate cache of those templates as other beans are seamelessly replicated.

It is really a blocking issue and I really rely on your precious advises.

BR.

Community
  • 1
  • 1
tmarwen
  • 15,750
  • 5
  • 43
  • 62
  • A wild guess... Maybe something related to class loader? – Will Feb 17 '14 at 15:06
  • Yes it might be but I found not way to figure out the problem source. Do I have to load classes computed in node1 from node2? or something similar?! – tmarwen Feb 17 '14 at 15:11
  • Maybe. Which classloader are you using? Are you using the `new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), config);` from the linked question? – Will Feb 17 '14 at 15:14
  • Yes I'm using the `groovy.lang.GroovyClassLoader` mentionned in the linked post. – tmarwen Feb 17 '14 at 15:35
  • I've never played with classloaders, but maybe due to the class being in a different classloader, it isn't being replicated. What about using the same classloader as jboss, instead of a `new GroovyClassLoader`? – Will Feb 17 '14 at 17:11
  • If I use the main application server classloader, how am I going to replace the `GroovyClassLoader.parseClass(new GroovyCodeSource(), false);` then? I thought I could only be done in this way? – tmarwen Feb 18 '14 at 08:15

0 Answers0