Home Tutorialhelp Comment Compilation Error

 
 

Comment

Gajanan K Bandale
Compilation Error,
July 19, 2007 at 3:46 PM

Hi I went through this tutorial but i am getting one error which is compilation error: please tell me why is it?

I changed some code like this in FirstExample.java :
==========================================

package net.roseindia.tutorial.hibernate;
import org.hibernate.*;
import javax.security.auth.login.*;

//import roseindia.tutorial.hibernate.*;

public class FirstExample
{
public static void main(String[] args)
{
Session session = null;

try
{
// This step will read hibernate.cfg.xml and prepare hibernate for use
//SessionFactory sessionFactory = ((Object)new Configuration()).configure().buildSessionFactory();
Object SessionFactory;
session = ((Object)SessionFactory).openSession();
//Create new instance of Contact and set values in it by reading them from form object
System.out.println("Inserting Record");
Contact contact = new Contact();
contact.setId(6);
contact.setFirstName("Deepak");
contact.setLastName("Kumar");
contact.setEmail("deepak_38@yahoo.com");
session.save(contact);
System.out.println("Done");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally
{
// Actual contact insertion will happen at this step
session.flush();
session.close();
}
}
}


I am getting error :

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method openSession() is undefined for the type Object

at net.roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:18)


Please help me to solve the problem....
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
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 

Hibernate Questions

java compilation error - Hibernate
java compilation error  hi i am getting org.hibernate.exception.GenericJDBCException: Cannot open connection exception when runnig the code why this exception is coming 

Hibernate Questions

java compilation error - Hibernate
java compilation error  hi, i have made an registration page 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 

Hibernate Questions

Compilation error. Hibernate code - Hibernate
Compilation error. Hibernate code   Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory...) how to rectify that error in hibernate  Hi Friend, You have 

Hibernate Questions

hibernate firstExample not inserting data - Hibernate
hibernate firstExample not inserting data  hello all , i followed... for more information. http://www.roseindia.net/hibernate/ Thanks. ... is : my FirstExample is : /** * */ package 

Hibernate Questions

Java Compilation error. Hibernate code problem. Struts first example - Hibernate
Java Compilation error. Hibernate code problem. Struts first example  Java Compilation error. Hibernate code problem. Struts first example 

Java Beginners

compilation error
compilation error  Hi my program below is not compiling,when I try to compile it i'm getting the error message "tool completed with exit code 1".The loop has to be at the end of the program can you help me. Blockquoteimport 

Hibernate Questions

Hibernate compilation - Hibernate
Hibernate compilation  please explain how to compile and run Hibernate at command prompt ( in dos) with sample example 

Applet Questions

java compilation error - Applet
java compilation error  I am getting compilation error in the following code.: public void paint(Graphics g) { switch(screen...; } } Error is: Illegal start of expression Plz. find why am I getting this error 

Framework Questions

groovy compilation error - Framework
] [groovyc] 1 error Compilation error: Compilation Failed how we can resolve...groovy compilation error  while i am running the grails application , i got the error message like: [groovyc 

Hibernate Questions

Webshpere compilation error
Webshpere compilation error   I want clear result . Thank you WSWS3166E: Error: No client transport named 'http' found. faultActor: null faultDetail: [10/5/10 13:19:40:937 EDT] 00000043 SystemOut O WSWS3166E: Error 

JDBC Questions

jdbc compilation error - JDBC
jdbc compilation error  java.lang.Exception: Problem in call_select when i am executing the program i am getting the above error. how can i resolve it?  Hi friend, plz specify in detail and send me code 

Applet Questions

java compilation error - Applet
java compilation error  hi friends the following is the awt front design program error, give me the replay E:\ramesh>javac product.java Note: product.java uses or overrides a deprecated API. Note 

Java Beginners

Java compilation error - Java Beginners
Java compilation error  Method overridden problems in compile time error 

SQL Question

Java Compilation error - SQL
Java Compilation error  ava.lang.NullPointerException at beanUtils.SaleHeaderUtility.getFullRemainPatientList(SaleHeaderUtility.java:754) at forms.ProcessDialog.updatePatientBalances(ProcessDialog.java:119 

Java Beginners

compilation error - Java Beginners
compilation error  Dear sir, When i compile some pgms i am getting below error.what may be the reason? "uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details."  Hi Friend 

Ant Questions

java compilation error - Ant
java compilation error  hi, i have a application in which i m reading from an xml file and then storing its values in database.but when i started using ant its main program is not running as it is unable to detect the jar file 

Java Beginners

compilation error - Java Beginners
compilation error  i 'm not able to compile a program : prblem is there is one package in which 2 class person & dog reside. both classes r public... in same package Dog class is being compiled bt. Person is not compiled . error 

Java Beginners

compilation error - Java Beginners
compilation error   import java.awt.*; import java.awt.event.*; import javax.swing.*; class BLayout implements ActionListener { JFrame f ; JPanel jp; JButton b[]; CardLayout cl; BLayout(String s) { jp = new JPanel 

Java Beginners

compilation error - Java Beginners
compilation error  class s { public static void main(String ar[]) { int j=0834... this program it is giving an error as integer number is too large.why? and what 

Struts Questions

Compilation Error - Struts
Compilation Error  description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class 

Java Beginners

compilation error - Java Beginners
compilation error  sir what is the error inthis code after executing the below code i got java.lang.NoSuchMethodError: main Exception in thread "main" package org.array; import java.io.*; public class Employee 

JDBC Questions

java compilation error - JDBC
java compilation error   /* *Project:employee.java *Date:April 04,2007. *Purpose:To All Java Developers **/ package employee; import javax.swing.*; import java.awt.*; import javax.swing.border. 

JSP Servlet Questions

compilation error - JSP-Servlet
compilation error  Hi sir, i'm using following code to upload an image to the database.I'm facing the following problem. <% String contentType = request.getContentType(); if ((contentType != null 

Java Beginners

java compilation error - Java Beginners
java compilation error  Sir Thanx for ur response for reading a doc file but when i tried to execute ur code compilation error occurs, it says --> org.apache.poi.hwpf package does not exist. --> 

Java Beginners

java compilation error - Java Beginners
java compilation error  HELLO SIR,I HAVE ASKED QUESTION AND I GOT REPLY FOR THAT ALSO BUT I AM GETING COMPILATION ERROR UNCHECKED OR UNSAFE OPERATION PLZ RECTIFY THIS. HOW TO READ ELEMENTS FROM TWO ARRAYLIST AND PRINT 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error  I got this error while convert java to pdf... Exception:java.lang.IndexOutOfBoundsException: reserve - incorrect column/size can somebody told me how to handle this error...  Hi Friend 

Java Beginners

java compilation error - Java Beginners
java compilation error  Hello madam/sir, i m a beginners in java. My problem is that i want to connect a login form to a frame containing 4 panels. how could i do it?Please help 

Java Beginners

java compilation error - Java Beginners
java compilation error  I need to know how to correct a compiler error for my program to run. The error I keep getting is unclosed string literal... and this is when my compiler error occurs. Let me know if you need any 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error   i wrote a simple hello world program i get this error every time please help Exception in thread "main" java.lang.NullPointerException 

Java Beginners

java compilation error - Java Beginners
java compilation error  i have downloaded java software(version 6 update 12) from www.java.com. whenever i try to compile the program using javac command, error message is displayed javac is not recognized as an internal 

Java Beginners

java compilation error - Java Beginners
java compilation error  can not find symbol sysbol:method println(int,int,int) location: class java.io.PrintStream) System.out.println(+a,+b,+c);  Hi friend, Please, specify in detail what's your problem 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  How to compile a java Program,If i am having jdk1.5 in webligic it support jdk1.4..When i put a .class file into WEB-INF/classes/Mybeans/Datacon.class it was given a error  Hi friend 

Java Beginners

Java compilation error - Java Beginners
Java compilation error  hai, now only i have started to work with java.I have been given a task as execute unix codes using eclipse.But i dont know the source codes.Please help me to start the program... Regards, R.Punitham 

Java Beginners

java compilation error - Java Beginners
java compilation error  i am going to type program and the error is shaded one this one is giving error please sole this one sir import java.io....:"+ch); } }   Hi friend, Having some error in your code check 

Java Beginners

java compilation error - Java Beginners
java compilation error  Hello, I'm having problems with trying.... It's flagging two errors for this one code. The first error says identifier expected and the next error says invalid method declaration; return type required 

Java Beginners

java compilation error - Java Beginners
java compilation error  i am going to type program and the error is shaded one this one is giving error please sole this one sir import java.io....:"+ch); } }   Hi friend, Having some error in your code check 

Java Beginners

Java compilation error - Java Beginners
Java compilation error  Hello I am having this problem while compiling I create a file the package is com.deitel.ch14; the filename...\AccountRecord.java I save AccountRecord.java in ch14 However I get an error saying 

Java Beginners

java compilation error - Java Beginners
java compilation error  Dear Sir ........ I was installed the java soft ware in PC by following your guidelines only, after installing I'm... getting the error like file not found : exxx.java(my file name is exx), Ill 

Java Beginners

Compilation error in java - Java Beginners
Compilation error in java  i have a properties file named "connecton.properties" which has details about database server connection. when i load i... FileInputStream(f); props.load(in); but i got a error the system could 

Java Beginners

Java Compilation Error - Java Beginners
Java Compilation Error  hi, i'm chandrakanth.i got a dought regarding below program. It generates compilation error.but it executes and generates the out put. i can't understand the reason. please suggest me 

Java Beginners

compilation error in java - Java Beginners
compilation error in java  Here is the pgm usinf if-else statement.... For removing the error you have to use the String type in place of char & your code will work without any error 

Swing AWT

java compilation error - Swing AWT
java compilation error   NestedPopupMenu n = new NestedPopupMenu(); getting error as "local variable n is never read  Hi dharani, This is running code. I hope that this code will help you. import java.util. 

Java Beginners

java compilation error - Java Beginners
java compilation error  how to set path and class path for java.. why is it necessary  Hi Friend, Classpath specifies the location of the user defined classes and the packages in a Java program for the Java Virtual 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  i have a field like name if name is not given then it should give an alert like name cannot be null, i want this type of validations.  Hi uma, I am sending you a link. This link will help 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  i have created an employee table in mysql and connected it using JDBC, now i have to do client side validations, can u please suggest a way of how to do client side validations.my employee table consists 

JSP Servlet Questions

srvlet compilation error - JSP-Servlet
srvlet compilation error  while compiling a servlet, httpservlet class not found errors & many such class not are generated.   Hi Friend, It seems that compiler haven't found the servlet-api.jar file.So put 

Development process Questions

java compilation error - Development process
java compilation error  i have a requirement in my prog where i need to create multiple references while looping is going on for example i have a for loop like for(int i=0;i<5;i++) { String s=new String("naveen"); } now 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error  how to put 2 classes on java program?and what shall i do if symbol not found appear?  Hi Friend, Try the following code: class Determine{ public int add(int a,int b){ return a+b 

Java Beginners

java compilation error - Java Beginners
java compilation error   1)java code: import java.awt.*; import javax.swing.*; public class ButtonsPanelApplet extends JApplet{ public void... ButtonPanelApplet does give me error of "exception in thread main...."   

Java Beginners

Java compilation error - Java Beginners
Java compilation error  Hello, i am getting an error while running simple core java program on command prompt.java is installed on my pc. the error is: javac:file not found usage:javac Regards, jyoti prakash  

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  hi, i have created a table in MYsql and connected it using JDBC, I have to now validate those fields using jsp, so please can you suggest me a way how to validate using jsp, my table has fields 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  sir ,i have jdk1.6.0_01 and textpad installed .I have also set classpath and path.But stil on compiling my servlet programs in textpad i get compile time errors like javax.servlet.* ,javax.servlet.http. 

Java Beginners

Java Compilation Error - Java Beginners
Java Compilation Error   Actually Iam having a packaging. Whatever methods and the imported packages are used in the program are available... imported packages. What ever error iam getting is at the array usage. So, guide me 

JSP Servlet Questions

Java compilation error - JSP-Servlet
Java compilation error  Hi, im trying to do a report creation using... to my problem, but having some error as below.. Generated servlet error: C...; ^ Generated servlet error: C:\Program Files\Apache Software Foundation 

Java Beginners

java compilation error - Java Beginners
java compilation error  Hello, I had recently sent an email...); MY ERROR FLAGS HERE public class DisplayImage extends Panel { BufferedImage image; public DisplayImage() { try{ MY SECOND ERROR FLAGS HERE 

RMI Questions

Java Compilation and running error - RMI
Java Compilation and running error   The following set of programs... some problem and gives following on compilation"java uses unchecked or unsafe...); } catch(Exception e) { System.out.println("Error: " + e 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error  import java.io.*; import java.util....? } } when i write [owner = check.resulAcc()throws IOException;] get error... the same error.. can u help me solve this problm?please 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error  import java.io.*; import java.util.... error there,.. [';' expected] the semicolon i already put at the end like above,..but still the same error.. can u help me solve this problm?please 

Development process Questions

Java Compilation error - Development process
Java Compilation error  hi my serious problem is,how can i upload a file directly to the current remote database.. Below steps might work. 1. Create db connection to xls file using code you posted. 2. Create db 

Java Beginners

java compilation error - Java Beginners
java compilation error  Hello, I sent a previous message regarding... can't run it ProductInventoryVGUI Uncaught error fetching image... thats maybe why I'm getting that error message. Is there a way I can find an image 

Java Beginners

: Java Compilation error. - Java Beginners
: Java Compilation error.  what is the difference between static block and static method?  Hi friend, Static block will execute when ever execution starts, it means this block executes first of all, where 

JSP Servlet Questions

Java Compilation error - JSP-Servlet
Java Compilation error  hi i m vipul chauhan , i having a problem with this package i download package from the location http://commons.apache.org...-fileupload-1.2.1.jar but still there is a problem and when i compile my file this error 

Java Beginners

java compilation error - Java Beginners
java compilation error  package punitha; import java.util.Vector; import javax.swing.*; import javax.swing.JFrame.*; import... calling other java pgms like k-means and Readfile... when i execute am getting error 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error  What's wrong with this: public enum RockPaperScissors { ROCK ("Rock crushes scissors."), PAPER ("Paper covers...; } } /*error starts here-->*/public static boolean validSelection(char 

Java Beginners

java compilation error - Java Beginners
java compilation error  here is the rest of my codes. I hope you...) { ProductInventory2.addProduct(temp); repaint(); MY COMPILER ERROR BEGINS BELOW... haven't provide the code of classes Product and Inventory2.Thatswhy 2 error occurs 

JSP Servlet Questions

java compilation error - JSP-Servlet
java compilation error  i want to do client side validations using JSP, so please can u suggest me a way out.thanq very much for the previous answers, i need validations only using script but not struts2.  wat kind 

Java Beginners

Java compilation error - Java Beginners
Java compilation error  I place the following code in to my program but get a compile error of cannot resolve symbol on this code - fullFileName.append(vendorID) vendorID is a parameter. What am I doing wrong. public void 

Java Beginners

java Compilation
java program compilation time following error is occur in my system Note...:unchecked for details. 1 error so plz send me answer why this error is coming.... To avoid this error, specify the type of object you're storing in the collection. So 

Java Beginners

java Compilation
java program compilation time following error is occur in my system Note...:unchecked for details. 1 error so plz send me answer why this error is coming.... To avoid this error, specify the type of object you're storing in the collection. So 

Java Beginners

java Compilation
java program compilation time following error is occur in my system Note...:unchecked for details. 1 error so plz send me answer why this error is coming.... To avoid this error, specify the type of object you're storing in the collection. So 

Hibernate Questions

Hibernate code - Hibernate
Hibernate code  firstExample code that you have given for hibernate... me any error or exception.console gives the same as u have shown in tutorial... to use the same primary key,it gives me the constraint violation error that means 

Java Beginners

"compilation error " & "throw an exception" - Java Beginners
"compilation error " & "throw an exception"  Hello. I have a question here: Statement sql2 = con.createStatement(); int result.... Will result in compilation error c. Will return the number of rows retrieved from 

Java Interview Questions

Java Compilation error. - Java Interview Questions
Java Compilation error.  when ever i run my console application i get this error or message even if it is a helloworld program please help AgentId [JavaApplication]c:\javase\bin\javaw.exe 

Servlet Interview Questions

java servlet compilation error - Servlet Interview Questions
java servlet compilation error  i done the Restart your tomcat server and run your servlet.but i got the problam 

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 

Servlet Interview Questions

java compilation error - Servlet Interview Questions
java compilation error  when i compile my servlet java file i get the compilation error as import java.servlet.* not found  servlet interface is coming under javax package use " import javax.servlet.*; "    

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 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 

Java Beginners

Compilation Error in Java Bean - Java Beginners
Compilation Error in Java Bean  Hello Sir, Please Help me to resolve... server.I received a compiler error. Structure is: application folder> Html file...;.java file > web.xml file Compiler Error:-> 

JSP Servlet Questions

java Compilation error:jsp code - JSP-Servlet
java Compilation error:jsp code   I am getting an Generated Servlet error: String literal is not properly closed by a double-quote. here is my..., You haven't closed the string literal properly,therefore error occurs.In 

Servlet Interview Questions

java servlet compilation error - Servlet Interview Questions
java servlet compilation error  hello sir plz help me, i compile the servlet program but i got the arrors that errors are package javax.servlet.http doesnot exist, alla packese i got the same problam..  Hi Friend 

Servlet Interview Questions

javservlet compilation error - Servlet Interview Questions
javservlet compilation error  hello sir I set the classpath in environment variables but I got the same error.what have to do can u plz help me.   if u had set classpath in environment variables then it doesnt 

JSP Servlet Questions

jsp code compilation error - JSP-Servlet
jsp code compilation error  hai, iam doing online banking project.i... is the error and also what is the proper code for funds transfer. HTTP... The server encountered an internal error () that prevented it from fulfilling 

Java Interview Questions

java compilation error - Java Interview Questions
java compilation error  how to import default package class in to another package in java for example class hello{ void display(){ System.out.println("Hello java"); } } package com; class useDefault{ psvm 

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 

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

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 

Java Beginners

command prompt is compilation is not working
command prompt is compilation is not working   Dear java users can anyone help me to run the program in command line prompt i tried by selecting... helloworld through command prompt class not found error and class loader not able 

Hibernate Questions

java - Hibernate
java  ption in thread "main" java.lang.Error: Unresolved compilation... ........................................................... The aboue error is got when i downloaded the code and run using Hibernate and annotation..plse help me...  Hi 

Hibernate Questions

error in hibernate example
error in hibernate example  i am getting error in this.... log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Resource: Contact.hbm.xml 

Hibernate Questions

SEVERE: Error listenerStart - Hibernate
SEVERE: Error listenerStart  what is SEVERE: Error listenerStart 

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 

UML Questions

java compilation - UML
java compilation  write a program that accepts a data sequence, generates a fcs (using a known divisor) and then ultimately check wether the recieved data is in error or not  Hi Friend, Please clarify it. Thanks 

Ajax Questions

JAVA COMPILATION - Ajax
JAVA COMPILATION  THE BLOCK DIAGRAM BELOW SUMMARITY DESCRIBE THE CRC METHOD.WRITE A PROGRAM THAT ACCEPTS A DATA SEQUENCE, GENERATES A FCS (USING A KNOWN DIVISOR) AND THEN ULTIMATELY CHECK WHETHER THE RECEIVED DATA IS IN ERROR 

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... - Hibernate 3.0rc1 10:46:41,397 INFO Environment:469 - hibernate.properties 

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 

Advertisements Advertisements
 

 

 

DMCA.com