-->
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: Could not load class org.hibernate.collection.PersistentBag
PostPosted: Thu Jan 31, 2008 11:01 pm 
Newbie

Joined: Sun Jan 13, 2008 3:16 pm
Posts: 5
Location: New Zealand
Hi

Have an example here where can save a Customer and a list of properties to the data base but when reading them back get a
"Could not load class org.hibernate.collection.PersistentBag"
Using Hibernate version 3.2.5 with Netbeans 6 with
Apache Derby Network Server - 10.2.2.0
Has any one got some Idea of what I am doing wrong??
I have also put some code on the server side to iterate thru the properties and this is not a problem but when it is serialized and goes back to the client we get the problem.

Regards Dave

Customer Entity
@Entity
@Table(name = "CUST")
@NamedQueries({@NamedQuery(name = "Customer.findById", query = "SELECT c FROM Customer c WHERE c.id = :id"),
@NamedQuery(name = "Customer.findByName", query = "SELECT c FROM Customer c WHERE c.name = :name"),
@NamedQuery(name = "Customer.findByIsActive", query = "SELECT c FROM Customer c WHERE c.isActive = :isActive"),
@NamedQuery(name = "Customer.findProperties", query = "SELECT p FROM Property p WHERE p.customerId = :id")})
public class Customer implements Serializable {

@Id
@Column(name = "ID", nullable = false, length = 6)
private String id;
@Column(name = "NAME", length = 40)
private String name;
@Column(name = "IS_ACTIVE")
private Character isActive;
@OneToMany(mappedBy = "customer", fetch = FetchType.LAZY)
public List<Property> properties = new ArrayList<Property>();

Property Entity

@Entity
@Table(name = "PROP")
@NamedQueries({@NamedQuery(name = "Property.findById", query = "SELECT p FROM Property p WHERE p.id = :id")})
public class Property implements Serializable {

private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", length = 6, nullable = false)
private Integer id;
@Column(name = "NAME", length = 40)
private String name;
@Column(name = "CUSTOMER_ID", length = 6)
private String customerId;
@Column(name = "VERSION")
private Integer version;
@JoinColumn(name = "CUSTOMER_ID", referencedColumnName = "ID", insertable = false, updatable = false)
@ManyToOne(fetch = FetchType.LAZY)
private Customer customer;

Property EJB

@Stateless
public class CustomerFacade implements CustomerFacadeRemote {
@PersistenceContext
private EntityManager em;

public void create(Customer customer) {
em.persist(customer);
List<Property> properties = customer.getProperties();
for (Property pr : properties) {
em.persist(pr);
System.out.println("saving properties one by one =" + pr.getId() + pr.getName());
}
}

public Customer find(Object id) {
Customer customer = em.find(Entities.Customer.class, id);
customer.getProperties().size();
return (customer);
}


Code I run to create a Cutomer with a property then read it back.


private void jButtonCreateCustomerActionPerformed(java.awt.event.ActionEvent evt) {
customer = new Customer();

customer.setId("JOHN");
customer.setIsActive('Y');
customer.setName("John Brown");


properties = new ArrayList<Property>();

Property p = new Property();

p.setId(1);
p.setCustomerId("JOHN");
p.setName("Property 1");
p.setVersion(0);
p.setCustomer(null);
properties.add(p);

customer.setProperties(properties);
customerFacade.create(customer);
}

private void jButtonReadCustomerActionPerformed(java.awt.event.ActionEvent evt) {
customerFacade.find("JOHN");
}

Log at the Remote Client
Feb 1, 2008 4:11:53 PM com.sun.corba.ee.impl.encoding.CDRInputStream_1_0 read_value
WARNING: "IOP00810257: (MARSHAL) Could not load class org.hibernate.collection.PersistentBag"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1974)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2199)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1211)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:328)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:368)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readResult(DynamicMethodMarshallerImpl.java:466)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:195)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at Facades.__CustomerFacadeRemote_Remote_DynamicStub.find(Facades/__CustomerFacadeRemote_Remote_DynamicStub.java)
at Facades._CustomerFacadeRemote_Wrapper.find(Facades/_CustomerFacadeRemote_Wrapper.java)
at eap.testCustomer.jButtonReadCustomerActionPerformed(testCustomer.java:110)
at eap.testCustomer.access$100(testCustomer.java:22)
at eap.testCustomer$2.actionPerformed(testCustomer.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:279)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at Facades.__CustomerFacadeRemote_Remote_DynamicStub.find(Facades/__CustomerFacadeRemote_Remote_DynamicStub.java)
at Facades._CustomerFacadeRemote_Wrapper.find(Facades/_CustomerFacadeRemote_Wrapper.java)
at eap.testCustomer.jButtonReadCustomerActionPerformed(testCustomer.java:110)
at eap.testCustomer.access$100(testCustomer.java:22)
at eap.testCustomer$2.actionPerformed(testCustomer.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1974)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2199)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1211)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:328)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:368)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readResult(DynamicMethodMarshallerImpl.java:466)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:195)
... 32 more
javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at Facades._CustomerFacadeRemote_Wrapper.find(Facades/_CustomerFacadeRemote_Wrapper.java)
at eap.testCustomer.jButtonReadCustomerActionPerformed(testCustomer.java:110)
at eap.testCustomer.access$100(testCustomer.java:22)
at eap.testCustomer$2.actionPerformed(testCustomer.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

_________________
Hibernate newbie


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 02, 2008 12:55 pm 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
Hi,

of course the Client also has to have access to some Hibernate classes, that is: Hibernate's persistent Collections and some others. There is a library named "hibernate3-client.jar" which you should deploy to the client's classpath.

Carlo
------------------------
please give me some credits if this post helped you.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 03, 2008 1:18 am 
Newbie

Joined: Sun Jan 13, 2008 3:16 pm
Posts: 5
Location: New Zealand
Hi Carlo

We thought there should be some library on the client side needed to be installed but found no information (I still can't). In what down load is this Hibernate3-client.jar part of???

Also thank you very much responding to our problem, it really is of help to us.

Regards Dave

_________________
Hibernate newbie


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 03, 2008 1:32 am 
Newbie

Joined: Sun Jan 13, 2008 3:16 pm
Posts: 5
Location: New Zealand
Hi Carlo

Yes This fixes my problem except using hibernate3.jar on the client libraries not hibernate3-client.jar (I could not find)?

Thank you very much.


Regards Dave

_________________
Hibernate newbie


Top
 Profile  
 
 Post subject: hibernate3-client.jar ???
PostPosted: Mon Feb 04, 2008 3:54 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
normac wrote:
Hi Carlo
... using hibernate3.jar on the client libraries not hibernate3-client.jar (I could not find)?


I'm sorry, I do not remember from where I got this jar; it must have come with some distribution, maybe Hibernate3, Seam or JBoss. Obviously it is not in the Hibernate-3.2.5.GA distribution, as I can see. My hibernate3-client.jar is dating from 2007-06-22.

Is there anybody here (from Hibernate team) who can tell something authorized? In fact it is very important for Hibernate solutions which have a client-server design based on a Java desktop client and a RMI connection to a Hibernate based server.

Carlo


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.