Home Tutorialhelp Comment while try to run this prg it will display error

 
 

Comment

hari
while try to run this prg it will display error,
April 19, 2007 at 3:27 PM


while try to run this prg it will display error like this:
but i cant uble to rectify it...
can any one do the needful..
public class Testhql {
public static void main(String[] args) {
Session session = null;

try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();


//Using from Clause
String SQL_QUERY ="from Insurance insurance";
Query query = session.createQuery(SQL_QUERY);
for(Iterator it=query.iterate();it.hasNext();){
Contact ct=(Contact)it.next();
System.out.println("ID: " + ct.getId());
System.out.println("First Name: " + ct.getFirstName());
}

session.close();
}catch(Exception e){
System.out.println(e.getMessage());
}finally{
}

}
}

output:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/Synchronization
at org.hibernate.impl.SessionFactoryImpl.buildCurrentSessionContext(SessionFactoryImpl.java:999)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:334)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at techm.Testhql.main(Testhql.java:13)

View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
IDE Questions

Nested try
as an exception (cannot divided by 0) occurs and display the error 'Div by zero error...(String args[]) { try { int a = Integer.parseInt(args[0]); int b...) { System.out.println("Div by zero error!"); } finally 

Java Interview Questions

java prg
; xor = x ^ y; while(and != 0 ){ and <<= 1 

General

Nested Try-Catch Blocks
! If the outer try block's statements run successfully... Nested Try-Catch Blocks       In Java we can have nested try and catch blocks. It means 

Java Beginners

java run time error - Java Beginners
java run time error  when i compile my program it didnt show any error in my program.but i cant run my program, if i run my program means it will show error like as following Exception in thread "main 

Hibernate Questions

Hibernate error in eclipse
Hibernate error in eclipse   Hi... while running my application i got these type errors...can youme please? Exception in thread "main... code........ I will try to short out your problem 

WebSevices Questions

Run time error - WebSevices
Run time error  Hello, Anyone know, how run the template... in solving the problem : protected function _run($template) { $this->_smarty->display($template 

Java Beginners

java run time error - Java Beginners
java run time error  i am getting error "main... is to display contents of directory "sanvij" in tabular form which have different sub... only, i have to display number of files and its last modified time ,i use 

EJB Questions

error while inserting millions of records - EJB
error while inserting millions of records  Hello, I am using ejb cmp... out occurs same problem is occur when i am using hibernate but when i am using...; try { context = new InitialContext(System.getProperties()); Object obj 

Hibernate Questions

java compilation error - Hibernate
whosevalues should be inserted into database. i have used hibernate and eclipse it is working fine. but when i make a war file and deploy it using ant and then run...).By that only this exeptions rise dude..Try it and give your result after 

Hibernate Questions

How to run? - Hibernate
friends are told hibernate is a new entry to Java. so plz try to tell how to use Hibernate code in my application?  Hi friend, Hinernate : Hibernate...How to run?  Hiiiiiiiiiiiii friend.. i am Magesh 

Java Server Faces Questions

errors while run - Java Server Faces Questions
errors while run  I,ve download the SimpleHelloByEnteringName jsf intoduntion sample project and tried to run this application following the steps narrated in roseindia jsf tutorial. But i found the fillowing error:(My 

Hibernate Questions

Hibernate error - Hibernate
Hibernate error  I had run hibernate first example but it an error appeared. Error is java.lang.NullPointerException.  Hi Friend... want more examples of Hibernate please visit the following link. http 

Hibernate Questions

Hibernate error - Hibernate
Hibernate error  I hava following error while running hibernate example in eclipse. I placed hibernate.cfg.xml and contact.hbm.xml in bin/roseindia/tutorial/hibernate. But I have following error. log4j:WARN No appenders 

Hibernate Questions

Hibernate - Hibernate
Hibernate  when I run Hibernate Code Generation wizard in eclipse I'm getting the following error. I added ojdbc14.jar to my build path. Still I'm getting this error. please let me know, how to resolve 

Java Beginners

display error message for dupliacate record in properties file
display error message for dupliacate record in properties file  ... one entry e.x.001,002,003,001 i want to display the error message "Duplicate Record found" while compile the java file.Please give the correct solution soon 

Java Beginners

Error While Compiling - Java Beginners
Error While Compiling  Hi All I Am a beginner and i face the following problem while compiling can anyone help me. C:\javatutorial\example>...;. or try to set the path in envirnment variable..ok.. example set path 

JSP Servlet Questions

error of HTTP Status 404 while running servlet on apache tomcat server
error of HTTP Status 404 while running servlet on apache tomcat server  i have followed the steps given here.Also hava put servlet-api in lib folder... try to run my servlet that is placed in the directories as it has been mentioned 

JSP Tutorials

Try catch in JSP
Try catch in JSP          In try block we write those code which can throw exception while code execution and when the exception is thrown 

Hibernate Questions

connection proxy error in hibernate
connection proxy error in hibernate  while we get connection through hibernate we arise an error connection proxy error while we are using multiple connection's 

Hibernate Questions

hi i m new to hibernate..plzzzzzzzzzzzzzz help me.... - Hibernate
change my query ... now its showing me this error... plz help me..... MY PRG...hi i m new to hibernate..plzzzzzzzzzzzzzz help me....  hi friends i m new to hibernate..& i m stuck in one positon in my pgm.. its a simple select 

Java Beginners

Applet run with appletviewer but not in browser, any code problem.
() { public void run() { try...Applet run with appletviewer but not in browser, any code problem.  ... fine but not run from the browser as http://localhost:8080/ProgressoApplication 

Java Beginners

try catch
try catch  why following code gives compile time error.please reply. class ThreadDemo1 extends Thread { public void run() { for(int i=1;i<=3;i++) { System.out.println(i); try 

Java Beginners

Nested try
versa.pl explain me class Demo { static void nestedTry(String args[]) { try...("Div by zero error!"); } finally { System.out.println("Finally"); } } public static void main(String args[]) { try { nestedTry(args); } catch 

Hibernate Questions

Hibernate error in eclipse
Hibernate error in eclipse   Hi... while running my application i got these type errors...can youme please? Exception in thread "main" java.lang.ExceptionInInitializerError at com.StoreData.main(StoreData.java:11) Caused 

Hibernate Questions

Hibernate error in eclipse
Hibernate error in eclipse   Hi... while running my application i got these type errors...can youme please? Exception in thread "main" java.lang.ExceptionInInitializerError at com.StoreData.main(StoreData.java:11) Caused 

Hibernate Questions

Hibernate error in eclipse
Hibernate error in eclipse   Hi... while running my application i got these type errors...can youme please? Exception in thread "main" java.lang.ExceptionInInitializerError at com.StoreData.main(StoreData.java:11) Caused 

Hibernate Questions

Hibernate error in eclipse
Hibernate error in eclipse   Hi... while running my application i got these type errors...can youme please? Exception in thread "main" java.lang.ExceptionInInitializerError at com.StoreData.main(StoreData.java:11) Caused 

SQL Question

Error while SQL Server connection to Java
Error while SQL Server connection to Java  import java.sql.*; public... Exeption { Connection con=null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver... this code, i am getting an error as OdbcSqlServerConnection.java:29: class,interface 

SQL Question

Error while SQL Server connection to Java
Error while SQL Server connection to Java  import java.sql.*; public... Exeption { Connection con=null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver... this code, i am getting an error as OdbcSqlServerConnection.java:29: class,interface 

Maven Questions

Error with Maven while deploying the war file
Error with Maven while deploying the war file  Hi, I am new to maven... I created java spring hibernate project.. and i kept all .java files... hibernate, properties and spring. in hibernate i kept all .hbm.xml files 

Java Beginners

error while running the applet - Java Beginners
error while running the applet  import java.applet.Applet; import...); ++num; } } } } i have problem while running the code , error...) { try { setVisible(false); dispose 

Applet Questions

java applet run time error - Applet
java applet run time error  Hi, Im new to java applet.please help me. i have create a MPEG movie player in applet. when i run that program it show the error that,"javax.media.NoPlayerException: Error instantiating class 

Hibernate Questions

Hibernate delete a row error - Hibernate
Hibernate delete a row error  Hello, I been try with the hibernate delete example (http://www.roseindia.net/hibernate/hibernate-delete.shtml... static void main(String[] args) { Session sess = null; try 

JSP Servlet Questions

getting error while inserting values in database
getting error while inserting values in database  AddUser.java...) { out.println("An Error Had occurred while accessing the database...; ResultSet rs = null; try 

Hibernate Questions

hibernate
hibernate   i am using hibernate3.2.5 and oracle9i. First i set classpath to ojdbc14.jar and all the hibernate jar files to path env variable.After that when i try to execute the program i got an error "unknown oracle major 

Java Beginners

how to run a applet from browser
how to run a applet from browser  hi, iam sending the code... error. plz suggest me the related code to execute from browser. import... Random(); try { String connectionURL = "jdbc:mysql://localhost:3306/mysql 

Maven Questions

Error with Maven while deploying the war file
Error with Maven while deploying the war file  Hi, I am new to maven... I created java spring hibernate project.. and i kept all .java files... hibernate, properties and spring. in hibernate i kept all .hbm.xml files 

Hibernate Questions

connection proxy error in hibernate
connection proxy error in hibernate  while we get connection through hibernate we arise an error connection proxy error while we are using multiple error message is like below statements SEVERE: Servlet.service() for servlet 

Hibernate Questions

Database Error - Hibernate
Database Error  Hi, I am working with Struts 1.2---- AJAX-----Hibernate 3.0 --- MySQL 5.0. At the time of inserting/fetching from Database... exceeded; try restarting transaction That means the database becomes locked. Can 

JavaScript Questions

Error display
Error display  I want to give a message on the screen that an error has occured...but I dont want to use alert and give pop up box...any other solution for the problem 

Hibernate Questions

hibernate...............
hibernate...............  goodevining. I am using hibernate on eclipse, while connection to database Orcale10g geting error .........driver ARNING: SQL Error: 0, SQLState: null 31 May, 2012 8:18:01 PM 

Hibernate Questions

Hibernate giving exception - struts - MySQL - Hibernate
while initializing hibernate: " + e.getMessage()); } System.out.println...Hibernate giving exception - struts - MySQL  Hi all, My name is Asif. I am trying to Run one simple application using NetBeans IDE 

JavaScript Questions

error display
error display  I am creating a web page...I have two textboxes and an add button. If nothing has been entered in the textboxes and if I click the add button , I have to get pop up box indicating that "please fill in the fields 

Java Beginners

run time error
run time error  my program compile successfully but does not showing... saved your class with HelloWorld. Check it out. Even then if error occurs, post the error.   Here it works and showing output. Have you save the file 

Java Beginners

Code error
) read.close(); } } } While using this it shows error as: run...; try { read = new XmlReader(urL... are trying to run was not found in the classpath. It seems AbstractSAXParser 

JSP Servlet Questions

i have got error while compiling simple tag handler
i have got error while compiling simple tag handler   javac.servlet.jsp not found! tell me what are the jar files required to run simple tag handler...;it is : javax.servlet.jsp only but getting error wt is reason 

General

Java error reached end of file while parsing
Java error reached end of file while parsing... of file while parsing ,In this code we want to display Time in hour, minute... an error i.e java error reached end of file while parsing as the class closing braces 

WebSevices Questions

While running jsp
While running jsp  I found this error when i run the client.jsp can anyone help me javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://localhost:8080/WebService1/MyWebService?wsdl. It failed with: http 

Hibernate Questions

error come
error come  com.techi.bean.Employee cannot be cast to [Ljava.lang.Object;... i display the data action to jsp using set list atribute on action... and display the data on the browser. We have used JDBC here to connect to mysql 

JSP Servlet Questions

jsp image display
://localhost:3306/student"; try { Class.forName("com.mysql.jdbc.Driver...(factory); List items = null; try { items...(); while (itr.hasNext()) { FileItem item = (FileItem 

Java Beginners

Try and catch in Exception Handling.
Try and catch in Exception Handling.  How can we use try and catch...; try{ x=a/b; }catch (Exception er...); } } } Result Display: Division by zero 

Hibernate Tutorial Example

Hibernate Criteria
-factory> </hibernate-configuration> When you run...Hibernate Criteria org.hibernate.Criteria is an interface which is very powerful alternatives of HQL (Hibernate Query Language) with some limitations 

Hibernate Questions

hibernate code - Hibernate
hibernate code  while generating the hibernate code i got the error like org.hibernate.MappingException 

Hibernate Questions

hibernate - Hibernate
Hibernate; import org.hibernate.Session; import org.hibernate.*; import... static void main(String[] args) { Session session = null; try{ SessionFactory... error SEVERE: Error parsing XML: /hibernate.cfg.xml(4) Content is not allowed 

Swing AWT

Not able to display jtable at runtime
Not able to display jtable at runtime  Hello, can anyone please help...; panTable.updateUI(); String query=""; try{ Class.forName...){ int r=0; while(rs.next()){ if(c==0 

Applet Questions

error in compiling j2me apllication - Applet
error in compiling j2me apllication  hi, in my j2me application... { MainPageCanvas mainPage=null; Display display=null; ListDisplayer... */ mainPage=new MainPageCanvas(); mainPage.setCommandListener(this); display 

Hibernate Questions

Hibernate - Hibernate
Hibernate  Hai this is jagadhish, while executing a program in Hibernate in Tomcat i got an error like this HTTP Status 500... Exception report message description The server encountered an internal error 

Hibernate Questions

in connectivity - Hibernate
the hibernate and postgresql that progrram is running while showing no error but the data is not be inserting in to the data base while it is showing that data insertted  Hi friend, This is connectivity and hibernate configuration 

Hibernate Questions

hibernate - Hibernate
Hibernate; import org.hibernate.Session; import org.hibernate.*; import... static void main(String[] args) { Session session = null; try... got the following error SEVERE: Error parsing XML: XML InputStream(8 

JDBC Questions

JSP run problem
JSP run problem  type Exception report message description The server encountered an internal error () that prevented it from fulfilling...; Post your code. It seems that there is a programming error. Check your code 

General

Java Error
. Most of the errors in java are abnormal conditions while the error ThreadDeath... Java Error      ... that occurs in a program. Error in java is a subclass of the Throwable class 

Hibernate Questions

Error java.lang.NullPointerException hibernate - Hibernate
Error java.lang.NullPointerException hibernate  hello everybody; I'm developping a web application using Struts 1.1 , Hibernate 3.1 and Mysql , and I've got this message error: Etat HTTP 500 

Hibernate Questions

hibernate - Hibernate
hibernate  hi i am new to hibernate. i wan to run a select query... session = null; try{ // This step will read hibernate.cfg.xml and prepare hibernate for use SessionFactory sessionFactory = new Configuration 

Java Beginners

error while compiling - Java Beginners
error while compiling  i am facing problem with compiling and running a simple java program, can any one help me, the error i am getting is javac is not recognised as internal or external command  Check if you JAVA_HOME 

Hibernate Tutorial Example

Hibernate Criteria Case Insensitive
) { e.printStackTrace(); } } } When you run this application it will display message...Hibernate Criteria Case Insensitive The Case Insensitive ignores the case...) { try { Session session = HibernateUtil.getSessionFactory().openSession 

IDE Questions

portlet display
portlet display  Hi, i created a portlet by using liferay eclipse IDE. after that i run that portlet successfully. but my portlet is not added.... if any error you can see the server console 

Java Magazine Questions

Difference between error and exception ????????
yourself or that might be thrown because of an obvious run-time error such as trying...Difference between error and exception ?  Can we handle a error in java if yes than give an code of an example? Difference between error 

Struts Questions

Struts2 and Hibernate
in database but i want to display that submit database value in another page while using struts2 and hibernate3.0. I need ur help try to short out this asap 

JDBC Questions

jdbc run time error - JDBC
jdbc run time error  i m creating the table using thin driver it is showing the following run time error: Exception in thread "main" java.lang.ClassNotFoundException: jdbc.oracle.OracleD river 

Hibernate Tutorial Example

Hibernate Criteria And Restrictions
{ session.close(); } } } When you run this application it will display message...Hibernate Criteria Restriction The Hibernate Criteria API contains Restriction...(), in(), gt(), lt() etc. An example of Hibernate Criteria Restriction class is given 

JDBC Questions

How Jdbc program can be run??
,but when i run it ,it gives following error-> C:\Program Files\Java...How Jdbc program can be run??  import java.sql.*; import java.util.*; class MyDbCode3 { public static void main(String [] args) { try 

JDBC Questions

java run time error - JDBC
java run time error  when i m running for batch execution program in jdbc i m facing this kind of runtime error as Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap ter could not establish 

Java Beginners

run ttime error - Java Beginners
run ttime error  how to compile a client server application using RMI ?  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/tutorials/rmi/rmi 

Core Java

try Java Keyword
an appropriate error message. Example to use the try blocks: ... try Java Keyword       The try is a keyword defined in the java programming language. Keywords 

Hibernate Questions

jsp-Hibernate Error - Hibernate
jsp-Hibernate Error  hi, my problem is, I designed an Interface where i am tring to listing the all rows of a table using Iterator and putted a link for deleting each row. I am deleteing row using row id of that record.it delete 

Hibernate Questions

hibernate sql error - Hibernate
hibernate sql error  Hibernate: insert into EMPLOYE1 (firstName..., Please visit the following links: http://www.roseindia.net/hibernate/index.shtml http://www.roseindia.net/hibernate/insert-data-database.shtml Hope 

Java Beginners

Display image
Display image  How to Pass image from html to jsp and display... the html page to jsp page and display it. 1)page.html: <%@ page language="java" %> <HTML> <HEAD><TITLE>Display file upload form 

JSP Servlet Questions

How to display multiple images in jsp
("Image Display Error=" + e.getMessage()); return; } %> </div></td>...How to display multiple images in jsp  <%@ page import="java.io....; %> <html><body> <% try { Connection con 

Hibernate Interview Questions

display sql query in hibernate
display sql query in hibernate  If you want to see the Hibernate generated SQL statements on console, what should we do 

JSP Servlet Questions

how to display?
how to display?  I have to write a code for searcing books in library..."); String keyword=request.getParameter("keyword"); try...) and ('"+keyfield+"'='"+keyword+"')"); while (rs.next 

Hibernate Questions

hibernate firstexample - Hibernate
hibernate firstexample  Hi all. i m new with hibernate,when i m trying to run my first application i m getting following exception. Error reading resource: Employee.hbm.xml give me the solution. Thank you 

JDBC Questions

HOW TO RUN JDBC PRORAM ON JDK1.5.0
then it compiled successfully ,but when i run it ,it gives following error->...HOW TO RUN JDBC PRORAM ON JDK1.5.0  import java.sql.*; import java.util.*; class MyDbCode3* { public static void main(String [] args) { try 

JSP Servlet Questions

profile display
"; Statement st; try { Class.forName(driver).newInstance(); conn...;<th>Item Price</th></tr>"); while(rs.next()){ out.println 

Java Beginners

JComboBox Display Problem - Java Beginners
(); } } The above program run correctly. but the second combo box display date at two...JComboBox Display Problem  I am create one program that contain two combo boxes. If first combo box i am display all date. If i select one date from 

Java Beginners

java run time textfield and use with map - Java Beginners
java run time textfield and use with map  i want to program which read data from file and store in map and display in different textfields which are generated at run time like a text file store information class a1 

Java Beginners

Run this code..plzz - Java Beginners
Run this code..plzz  Hi Friend... ERROR: Exception in thread "main...) at Try.(Try.java:38) at Try.main(Try.java:50) ----------------------------------------------------------------- Can any one correct this Error 

Java Beginners

doesnt run again - Java Beginners
doesnt run again  the code u sent doesnt run and the error msg says... error for the next line just like i have to start a new main code so plz tell the soltion   Hi I am sending u again the code, this code run in my 

Hibernate Questions

Problem in running first hibernate program.... - Hibernate
programs.It worked fine.To run a hibernate sample program,I followed the tutorial below... the error " java.lang.NoClassDefFoundError: roseindia/tutorial/hibernate...Problem in running first hibernate program....  Hi...I am using 

Java Beginners

readline Error - Java Beginners
() { while (!message.equals("")) { try... (String[] args) { boolean done=false; while (!done... str = null; try { System.out.println ("Please enter 

Java Beginners

error
error  while iam compiling iam getting expected error 

Applet Questions

Applet to database error - Applet
to connect to the database for the values to display in the applet.... Following...(this); text.setDrawingComponent(this); try{ Class.forName("com.mysql.jdbc.Driver"); con...+", ",80,690); ...Some Painting Lines Code Here... } public void res(String s) { try 

Hibernate Questions

hibernate code - Hibernate
,but when i run this it shows error i.e Exception in thread "main...hibernate code  sir, i have tried ur hibernate 3.0 firt example code, i have done as u have told in the tutorial like import all the related 

Hibernate Tutorial Example

Hibernate Criteria Between
it will display message as shown below: Hibernate: select this_.roll...Hibernate Criteria Between The Criteria Between method provides some numeric...=criteria.list(); An example of Hibernate Criteria Between is given below 

Hibernate Tutorial Example

Hibernate Criteria Order by
Hibernate Criteria API Order By The Order By API of hibernate criteria is used to display the results either in ascending or descending order. Suppose you... query can be written in hibernate as follows Criteria criteria 

JSP Servlet Questions

How do I change the while loop in this code to the range with range list style display page for a resultSet() in jsp?
How do I change the while loop in this code to the range with range list style display page for a resultSet() in jsp?  this is count record code..."; int rows = 0; try{ Class.forName(driver); con = DriverManager.getConnection(url 

Java Beginners

java error - Java Beginners
,but there are some errors while running the code are 1.class SortFileData is public... be dereferenced If Programme saved in SortFileData also shows some error Please rectify the errors and provide the coding that run properly Write a Java program 

Hibernate Tutorial Example

Hibernate Criteria Distinct
(); } } } When you run this application it will display message as shown below...Hibernate Criteria Distinct The Hibernate Criteria Distinct API search and display the distinct result Consider the following SQL SELECT DISTINCT name FROM 

Java Beginners

when I run exiting project that time I got error, I want solution on it?
when I run exiting project that time I got error, I want solution on it?  Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start 

XML Questions

Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me 

JDBC Questions

java runtime error
java runtime error  hi friends i am trying to run the fallowing program but i am getting the error Exception in thread "main...(); if (choice != 0){ getSelected(choice); } } while ( choice != 0 

Advertisements Advertisements
 

 

 

DMCA.com