Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0

    Default java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collection.Se

    java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collection.Set

    Hi All,

    I am migrating my project from hibernate2 to Hibernate3.6.
    Please note that I have 2 JBoss servers that talk yo each other.
    The project deployed on Server 1 (say 'A') is still on Hibernate2, while I have migrated the projetc on server 2(say 'B') to Hibernate3.6.
    Now, an object constructed at 'A' is sent to 'B' and I am getting the above mentioned Exception a 'B'. Seems the Exception is coming while deserializing the Object at 'B' which was serialized at 'A'.

    Can somebody help me out with :
    1. Solution to the above problem
    2. Is Hibernate 3 fully backward-compatible with Hibernate 2?

    The stack Trace:
    12:49:07,882 WARN [root] Clone and Redelivery property not set as expected.
    12:49:08,890 ERROR [root] java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collection.Set
    at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMg r3.java:306)
    at org.jboss.mx.loading.RepositoryClassLoader.loadCla ssImpl(RepositoryClassLoader.java:521)
    at org.jboss.mx.loading.RepositoryClassLoader.loadCla ss(RepositoryClassLoader.java:415)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 56)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at java.io.ObjectInputStream.resolveClass(ObjectInput Stream.java:622)

    Thanks,
    Shishir

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    They moved everything in 3.
    The core package for 2 was net.sf.hibernate, and for 3 it's org.hibernate.
    This was to allow for both versions to be running at the same time in the same app.

    Of course, this also means that you cannot serialise/deserialise between the two versions.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    @Tolls!! Thanks for your reply. But, this still doesn't solve my problem.
    Does this mean, that I need to Keep both jars(Hibernate2 & 3.6)together in the classpath?

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    It means you can't have the two versions talking to each other.
    If part of your architecture requires you to have your two servers talking to each other using Hibernate objects then that won't work if one is Hibernate 2 and the other is Hibernate 3.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    OK. So, that clears the point quite well.
    So, is there any work-around, like instead of Hibernate Objects, can we convert them to some other type and send to talk between the two servers?

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    If it's just the data in the object you are interested in then you could create a Data Transfer Object, which is just a POJO with the same data as the Hibernate model.

    Is there a reason you can't upgrade the other server?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    This seems to be a good approach. I will try create a DTO or a Collection object & see if that works out.
    Thanks for your suggestions.
    Will soon report how it turns out..

  8. #8
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    Finally, i got the result. Hibernate 2.X and 3.x can co-exist together.. We just need to add the required jars in the classpath of the correct project.
    i.e. put 2.x in the classpath where the project uses 2.x API and put 3.x in classpath where the project uses 3.x API. As simple as that.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: java.lang.RuntimeException: No ClassLoaders found for: net.sf.hibernate.collectio

    But then you run the (quite common) risk of jar hell.
    So long as you are aware of that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 3
    Last Post: 03-21-2011, 01:48 PM
  2. Replies: 2
    Last Post: 10-30-2009, 11:55 AM
  3. Replies: 0
    Last Post: 07-06-2009, 02:38 PM
  4. Replies: 4
    Last Post: 06-24-2009, 06:34 AM
  5. java.lang.RuntimeException+ Axis
    By Peter in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •