• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Object, load thyself!

 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note: I'm using an object->xml serializer package called skaringa
I'm having a strange problem in one of my classes.
Say I have an class SomeObject.
This class has a method called load (File xmlFile)
where xmlfile is a skaringa-generated xml of SomeObject, and it loads a new instance of SomeObject and copies the instance variables.
This compiles fine and runs fine, in my Eclipse JVM. However, when running in Tomcat's JVM, it throws a ClassNotFoundException during the deserialization process. So it's running SomeObject.load(), it's in the middle of the skaringa deserialization, and it's telling me it can't find the class SomeObject! Any ideas on what might be going on?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the skaringa library in the Tomcat lib directory and SomeObject.class under WEB-INF? It could be a classloader problem: SomeObject sees Skaringa, but Skaringa doesn't see SomeObject because it's further down in the classloader hierarchy. If this is your situation, I'd suggest moving Skaringa libraries into WEB-INF/lib.
 
Phil Chuang
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the Skaringa lib is in tomcat4/shared/lib and SomeObject is in the webapp's WEB-INF/classes directory... I'll try moving skaringa to WEB-INF/lib and see what that does.
 
Phil Chuang
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can a mod move this post to the Apache/Tomcat forum?
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved as requested
 
Phil Chuang
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, moving the library did it-
Strange thing with that tomcat classloader (strange to me I guess) -
A class in a webapp calling a library in the shared area which calls back to a class in the webapp doesn't work.
I had to put the library in the webapp lib in order for it to work.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic