-->
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.  [ 2 posts ] 
Author Message
 Post subject: package net.sf.... not found
PostPosted: Mon Dec 20, 2004 10:23 am 
Newbie

Joined: Mon Dec 20, 2004 10:08 am
Posts: 1
Location: delhi India
I am not a java programmer but am working on a project that uses hibernate to store data.

When i execute my file i get an error :

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
gging/LogFactory
at net.sf.hibernate.cfg.Configuration.<clinit>(Configuration.java:94)
at net.ttg4me.data.UpdateCps.main(UpdateCps.java:23)
Press any key to continue...

I believe this error is due to improper classpath. However i have tried everything i possibly could to set the classpath..but without any success.

If i try compiling Configuration.java i get exactly a 100 errors all saying something to the effect :
D:\net\sf\hibernate\cfg\Configuration.java:24: package org.apache.commons.logging does not exist
-> import org.apache.commons.logging.Log;

Apache server is installed on my server
Please help..

Here's my sample code:

package net.ttg4me.data;

import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.*;
import net.sf.hibernate.transaction.*;
import net.sf.hibernate.cfg.Configuration;


// use as
// java test.InsertProduct name amount price
public class UpdateCps {

public static void main(String[] args)
throws Exception {
try
{
// 1. Build a Product
CpsBrep p = new CpsBrep();
p.setRejcode("sachin");

// 2. Fire up Hibernate
Configuration cfg = new Configuration()
.addClass(CpsBrep.class);
SessionFactory sf = cfg.buildSessionFactory();

// 3. Open Session
Session sess = sf.openSession();

// 4. Save Product and close Session
Transaction t = sess.beginTransaction();
sess.save(p);
t.commit();
sess.close();
}
catch (Exception ex)
{
System.out.println(ex);
}
}
}

_________________
Thanx in Advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 20, 2004 12:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it is 100% certain that you are missing commons-logging.jar from your classpath (and posibly others)


btw. why does your subject say net.sf not found and your contents talk about commons-logging classes ?

_________________
Max
Don't forget to rate


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