-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: retrieving object through tiers
PostPosted: Wed May 05, 2004 8:09 pm 
Newbie

Joined: Thu Apr 29, 2004 10:29 am
Posts: 13
I'm using hibernate with jboss, i have a ejb with a method who loads a Person from the database and try to send it to the client-side. When i do it i get a weird exception. But if i make the Person by hand (not using hibernate) i have no problem sending the Person to the client.

Any suggestions??

Code:
public Person loadPerson(Integer i) throws RemoteException {
   Session session = null;
   try {
      Context ctx = new InitialContext();
      SessionFactory factory =(SessionFactory) ctx.lookup("java:/hibernate/HibernateFactory");
      session = factory.openSession();
      Person p=(Person)session.load(Person.class, i);
      session.close();
      System.out.println(p.getFirstName());
      return p;
   } catch (Exception ex) {
      System.out.println(ex.getMessage());
   }
   return null;
}


Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/odmg/DCollection
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
   at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
   at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:219)
   at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:154)
   at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
   at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
   at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
   at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
   at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
   at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
   at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:136)
   at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
   at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
   at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
   at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
   at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
   at $Proxy1.loadPerson(Unknown Source)
   at uy.edu.ort.client.Client.testBean(Client.java:71)
   at uy.edu.ort.client.Client.main(Client.java:86)


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 9:21 pm 
Newbie

Joined: Thu Apr 29, 2004 10:29 am
Posts: 13
i've been checking the object i get when i load the person, the person has a set of phones and a set of adresses, the problem is that hibernate includes some information inside those sets so that when i send it to the client-side it gives me the error i had posted.

Any ideas of how to send an object with a set from the server-side to the client-side ????


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 3:15 am 
Newbie

Joined: Tue Oct 21, 2003 1:25 pm
Posts: 14
Location: Los Angeles, CA
I assume by "send an object from the server side to the client side" you mean via RMI...

If you don't have a RMISecurityManager installed on the client side, you won't be able to export class definitions over the wire. Therefore you must have the .jars required by Hibernate in the client side classpath.

See Java RMI and RMISecurityManager for more information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 6:17 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Put hibernate2.jar, odmg.jar and probably cglib.jar on the client side

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2004 1:29 am 
Newbie

Joined: Thu Apr 29, 2004 10:29 am
Posts: 13
Ok.
Thank you all.
We have already solve the problem!!!.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.