-->
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.  [ 3 posts ] 
Author Message
 Post subject: HibernateException in RCP.Help!
PostPosted: Wed Oct 25, 2006 4:26 am 
Newbie

Joined: Fri Oct 20, 2006 5:18 am
Posts: 2
I used Hibernate in my RCP program, the code related to the exception is following:(i use Hibernate2.1 ,Eclipse 3.2.)
package com.uxteam.reload.facestudiod;

import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cfg.Configuration;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.ViewPart;

public class ViewPart1 extends ViewPart{

public ViewPart1(){
super();
}


public void createPartControl(Composite parent) {

Label label=new Label(parent,SWT.NONE);
label.setText("这是一个ViewPart测试");

try {
Configuration conf = null;
conf = new Configuration().configure();

String contenthql="select myatom.teAtomContent from edu.ustc.infosec.te.SteAtom as myatom "
+"where myatom.teAtomClass=3 and myatom.teAtomObjectId=20100000001";

SessionFactory sf=new
Configuration().configure().buildSessionFactory();
final Session session=sf.openSession();


java.util.List concentlist=session.createQuery(contenthql).list();

session.close();
System.out.println("OK");

} catch (HibernateException e) {
e.printStackTrace();
}
}

public void setFocus() {

}
}

The application can run ,but there are exceptions like this:
java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:157)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:759)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:234)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:69)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:292)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:197)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
at org.eclipse.ui.internal.WorkbenchPage$ActivationList.setActive(WorkbenchPage.java:3898)
at org.eclipse.ui.internal.WorkbenchPage.restoreState(WorkbenchPage.java:2922)
at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1936)
at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java:2857)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1665)
at org.eclipse.ui.internal.Workbench.access$12(Workbench.java:1650)
at org.eclipse.ui.internal.Workbench$17.run(Workbench.java:1529)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1473)
at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:183)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:702)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1085)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1847)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.uxteam.reload.facestudiod.intro.Application.run(Application.java:18)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)

Does anybody know how to solve this problem?
Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 5:03 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
Quote:
java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException


Make sure you have the hibernate2.jar in the classpath of your application.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 9:06 pm 
Newbie

Joined: Fri Oct 20, 2006 5:18 am
Posts: 2
jaikiran wrote:
Quote:
java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException


Make sure you have the hibernate2.jar in the classpath of your application.


i am sure of that.


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