-->
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: java.lang.NoClassDefFoundError in J2SE environment
PostPosted: Thu May 04, 2006 11:19 am 
Newbie

Joined: Thu May 04, 2006 6:44 am
Posts: 1
Location: Bangalore
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: HibernateEntityManager 3.1 beta 7

Mapping documents:

Persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="testDB" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.jboss.tutorial.entity.bean.Order</class>
<class>org.jboss.tutorial.entity.bean.LineItem</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.connection.username" value="radien"/>
<property name="hibernate.connection.password" value="radien"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@172.25.203.148:1521:radien"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
</properties>
</persistence-unit>
</persistence>

Code between sessionFactory.openSession() and session.close():

Client.java

emf = Persistence.createEntityManagerFactory("testDB");
if(emf==null){
System.out.println("Got Entity manager factory as null");
}
EntityManager em = emf.createEntityManager();
//private Order order;
/*
Client client=new Client();
if (client.order == null) client.order = new Order();

client.order.addPurchase("Memory stick", 2, 500.00);
*/
em.close();
emf.close();

Full stack trace of any exception that occurs:
run:
[java] INFO 04-05 20:23:25,059 (Environment.java:<clinit>:495) -Hibernate
3.2 cr1
[java] INFO 04-05 20:23:25,090 (Environment.java:<clinit>:528) -hibernate
.properties not found
[java] INFO 04-05 20:23:25,106 (Environment.java:buildBytecodeProvider:662
) -Bytecode provider name : cglib
[java] INFO 04-05 20:23:25,121 (Environment.java:<clinit>:579) -using JDK
1.4 java.sql.Timestamp handling
[java] Exception in thread "main" java.lang.NoClassDefFoundError: build/cla
sses/org/jboss/tutorial/entity/bean/Order (wrong name: org/jboss/tutorial/entity
/bean/Order)
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader
.java:124)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[java] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.j
ava:110)
[java] at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configur
ation.java:707)
[java] at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(
Ejb3Configuration.java:778)
[java] at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactor
y(Ejb3Configuration.java:640)
[java] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactor
y(Ejb3Configuration.java:528)
[java] at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configu
ration.java:126)
[java] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactor
y(Ejb3Configuration.java:180)
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFac
tory(HibernatePersistence.java:110)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Pers
istence.java:37)
[java] at org.jboss.tutorial.entity.client.Client.main(Client.java:48)


[java] Java Result: 1

Name and version of the database you are using:Oracle 9i

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi all,

I am new to this hibernate entity manager thing.I am trying to use hibernate entity manager in J2SE environment.I am trying to create entity manager factory from my client program.While i am running the client it is showing the class def not found error i.e it is failing to find the
entity classes.The folder that contains the classes is also in the classpath.
I am unable to figure out why this error is occuring .Please help me in solving the issue.

Thank You.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 25, 2006 2:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
your path seems to be wrong

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 29, 2006 3:48 pm 
Newbie

Joined: Tue Dec 27, 2005 4:22 pm
Posts: 5
Location: fortaleza/ce - Brasil
see in line:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: build/cla
sses/org/jboss/tutorial/entity/bean/Order (wrong name: org/jboss/tutorial/entity
/bean/Order)

verify your classpath for find the class org.jboss.tutorial.entity.bean.Order.

verifiy if you dir build/classes in the classe path.


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.