-->
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.  [ 4 posts ] 
Author Message
 Post subject: Log4j hit error when Hibernate deployment
PostPosted: Thu Jul 17, 2008 5:21 am 
Beginner
Beginner

Joined: Tue Jun 17, 2008 12:14 am
Posts: 21
I have a JBoss/Hibernate applets. And beside that I re-use the same Hibernate for data patching.

I have manifest:
Code:
Main-Class: com.XXX.YYY.Client


and main class:
Code:
package com.XXX.YYY;
public class Client
{
    public static void main(String[] args) throws Exception
   {     
      try {
      
         //SAXParser jfs = new SAXParser();
         System.out.printf("********************************** 1 \n");
         OrderHandler oHandler = new OrderHandler();
         System.out.printf("********************************** 2 \n");
                           }
   }
}

and I have OrderHandler.class:

Code:
package com.XXX.YYY;
public class OrderHandler extends DefaultHandler {
   static final Logger logger = Logger.getLogger(OrderHandler.class);
...
}

why I hit error :

Code:
********************************** 1
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at com.XXX.YYY.OrderHandler.<clinit>(OrderHandler.java:54)
        at com.XXX.YYY.Client.main(Client.java:102)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 2 more


when I run my jar file?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 2:05 pm 
Newbie

Joined: Thu Jul 17, 2008 1:24 pm
Posts: 9
log4j is a dependency of hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 7:58 pm 
Beginner
Beginner

Joined: Tue Jun 17, 2008 12:14 am
Posts: 21
then what should I do? deploy along with these jar file:
1) antlr.jar
2) asm.jar
3) asm-attrs.jar
4) cglib.jar
5) commons-collections.jar
6) commons-logging.jar
7) dom4j.jar
8) hibernate3.jar
9) hsqldb.jar
10) jta.jar
11) log4j.jar
? how about command line? Use -cp ? With all these lib placed in relative folder called "lib", it fails when using

Code:
java -cp lib -jar  XXX.jar

even I use

Code:
java -cp c:\hibernate-3.2\lib -jar XXX.jar


also fails.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 18, 2008 4:38 am 
Beginner
Beginner

Joined: Tue Jun 17, 2008 12:14 am
Posts: 21
now I get

Quote:
java.lang.NoClassDefFoundError: org/hibernate/Session
at com.flextronics.fftester.Client.main(Client.java:103)
Caused by: java.lang.ClassNotFoundException: org.hibernate.Session
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 1 more


I know it's from hibernate3.jar file not in the classpath lib directory
but i have used :

Code:
java -cp hibernate3.jar -jar XXX.jar
(with jar file relatively)
Code:
java -cp C:\hibernate-3.2\lib -jar XXX.jar
(with pointing to hibernate installation folder directly)
Code:
java -cp lib -jar XXX.jar
(with all the hibernate library in a folder called "lib" relatively)
all failed, no matter I used JBoss way to get session :

Code:
SessionFactory sessionFac_report = (SessionFactory)ctx.lookup("java:/hibernate/XXXSessionFactory");
sesReporting = sessionFac_report.openSession();


or Hibernate way:
Code:
SessionFactory sessionFac_report = new Configuration().configure().buildSessionFactory();
sesReporting = sessionFac_report.openSession(); 


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