-->
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.  [ 4 posts ] 
Author Message
 Post subject: Class cast error when building Transation Factory
PostPosted: Mon Aug 09, 2004 8:54 am 
Newbie

Joined: Mon Aug 09, 2004 4:41 am
Posts: 7
Hi there,

Does anyone know what will cause the class casting error shown below? I'm using Hibernate in Knopflerfish (an OSGi container.)

Thanks

Aug 9, 2004 2:52:50 PM net.sf.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
[stderr] java.lang.ClassCastException
[stderr] at net.sf.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:34)
[stderr] at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:65)
[stderr] at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
[stderr] at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
[stderr] at example.MyTestBundle.impl.TestServiceImpl.<init>(TestServiceImpl.java:115)
[stderr] at example.MyTestBundle.impl.ServiceActivator.start(ServiceActivator.java:34)
[stderr] at org.knopflerfish.framework.BundleImpl$1.run(BundleImpl.java:262)
[stderr] at java.security.AccessController.doPrivileged(Native Method)
[stderr] at org.knopflerfish.framework.BundleImpl.start(BundleImpl.java:236)
[stderr] at org.knopflerfish.bundle.desktop.swing.Desktop.startBundle(Desktop.java:1796)
[stderr] at org.knopflerfish.bundle.desktop.swing.Desktop.addFile(Desktop.java:2011)
[stderr] at org.knopflerfish.bundle.desktop.swing.Desktop.drop(Desktop.java:1960)
[stderr] at java.awt.dnd.DropTarget.drop(DropTarget.java:398)
[stderr] at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:542)
[stderr] at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:52)
[stderr] at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:805)
[stderr] at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:743)
[stderr] at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:29)
[stderr] at java.awt.Component.dispatchEventImpl(Component.java:3494)
[stderr] at java.awt.Container.dispatchEventImpl(Container.java:1627)
[stderr] at java.awt.Component.dispatchEvent(Component.java:3477)
[stderr] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
[stderr] at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:3269)
[stderr] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3123)
[stderr] at java.awt.Container.dispatchEventImpl(Container.java:1613)
[stderr] at java.awt.Window.dispatchEventImpl(Window.java:1606)
[stderr] at java.awt.Component.dispatchEvent(Component.java:3477)
[stderr] at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
[stderr] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
[stderr] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
[stderr] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
[stderr] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
[stderr] at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Aug 9, 2004 2:52:50 PM net.sf.hibernate.connection.DriverManagerConnectionProvider close


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 8:59 am 
Regular
Regular

Joined: Mon Oct 06, 2003 7:17 am
Posts: 58
Location: Switzerland
Can you show the code where the classCastException is thrown.


Top
 Profile  
 
 Post subject: Here is my code
PostPosted: Mon Aug 09, 2004 9:18 am 
Newbie

Joined: Mon Aug 09, 2004 4:41 am
Posts: 7
I'm attching the code. The error happened at the last statement when building session factory.
I had to pass in URL because inside a OSGi bundle, Hibernate could not find where the mapping file is.

Let me know if you have any ideas,

Peng
Properties props = new Properties();
props.setProperty("hibernate.connection.url","jdbc:mysql://localhost:3306/jbossdb");
props.setProperty("hibernate.connection.driver_class","com.mysql.jdbc.Driver");
props.setProperty("hibernate.connection.username","jboss");
props.setProperty("hibernate.connection.password","password");
props.setProperty("hibernate.dialect","net.sf.hibernate.dialect.MySQLDialect");
props.setProperty("hibernate.show_sql","false");
props.setProperty("hibernate.use_outer_join","true");
props.setProperty("hibernate.transaction.factory_class","net.sf.hibernate.transaction.JDBCTransactionFactory");

URL url = bc.getBundle().getResource("/DataDomainUser.hbm.xml");

Configuration config = new Configuration()
.addURL(url)
.setProperties(props);

SessionFactory sessionFactory = config.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 09, 2004 4:48 pm 
Regular
Regular

Joined: Mon Oct 06, 2003 7:17 am
Posts: 58
Location: Switzerland
I can't see any problems in your code. Try to set a breakpoint on the line where the ClassCastException occurs and then you will see which type will occure this exception. Maybe you come one step further with this.

Reto


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.