You are not logged in.

#1 2009-05-28 16:39:08

daJense
Member
Registered: 2009-05-17
Posts: 45

Problem running java application - org.apache.commons.loggin

Hi,
I have a problem running a java application. I get the follwoing error message:

 java -jar eNAQ-0.1-20040507.jar
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at enaq.gui.main.ENAQ.<clinit>(ENAQ.java:27)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at enaq.gui.main.SplashStarter.main(SplashStarter.java:48)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 4 more

It seems it can't find the class org/apache/commons/logging/LogFactory

But it is installed.

[jens@jense-mobile dist]$ pacman -Qs commons-logging
local/java-commons-logging 1.1.1-2
    Wrapper interface for logging APIs in Java
[jens@jense-mobile dist]$

The program runs without problems using windows. Any ideas how to solve this?

Thx

Offline

#2 2009-05-28 19:11:10

jstarek
Member
Registered: 2008-02-27
Posts: 15

Re: Problem running java application - org.apache.commons.loggin

I've just taken a look at the commons-logging package. It installs the libraries that comprise the Apache Commons Logging API in /usr/share/java/commons-logging/*.jar. I suppose you'll just have to give java this information when starting your program. Try

java -classpath /usr/share/java/commons-logging/commons-logging.jar -jar eNAQ-0.1-20040507.jar

Restoring the oldest German radio telescope: http://astropeiler.de

Offline

#3 2009-05-29 13:26:19

daJense
Member
Registered: 2009-05-17
Posts: 45

Re: Problem running java application - org.apache.commons.loggin

Thx for your help,

I tried what you suggested, but no joy. Same problem:

[jens@jense-mobile dist]$ java -classpath /usr/share/java/commons-logging/commons-logging.jar -jar eNAQ-0.1-20040507.jar
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory                                                   
        at enaq.gui.main.ENAQ.<clinit>(ENAQ.java:27)                                                                    
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at enaq.gui.main.SplashStarter.main(SplashStarter.java:48)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 4 more

The commons-logging package is where you suggested it should be, but it seems there is no class LogFactory.

locate LogFactory.class

does not return anything. Of course this way I can't if it is included in the .jar file... but I don't know how to do that.

Last edited by daJense (2009-05-29 13:27:46)

Offline

#4 2009-05-29 13:43:14

jstarek
Member
Registered: 2008-02-27
Posts: 15

Re: Problem running java application - org.apache.commons.loggin

Hm, ok, can you provide me with a link to the program you're trying to run?

Besides, as you said, you can't find Java classes that are packed in a jar file with locate. The correct way to check whether that class is there would be to look into the jar with an archival program, in this case, jar:

jar tf /usr/share/java/commons-logging/commons-logging.jar

Restoring the oldest German radio telescope: http://astropeiler.de

Offline

#5 2009-05-29 14:53:33

daJense
Member
Registered: 2009-05-17
Posts: 45

Re: Problem running java application - org.apache.commons.loggin

Ok, the class seems to be there.

[jens@jense-mobile java]$ jar tf /usr/share/java/commons-logging/commons-logging.jar                                                
META-INF/                                                                                                                           
META-INF/MANIFEST.MF                                                                                                                
META-INF/maven/                                                                                                                     
META-INF/maven/commons-logging/                                                                                                     
META-INF/maven/commons-logging/commons-logging/                                                                                     
org/                                                                                                                                
org/apache/                                                                                                                         
org/apache/commons/                                                                                                                 
org/apache/commons/logging/                                                                                                         
org/apache/commons/logging/impl/
META-INF/LICENSE
META-INF/NOTICE
META-INF/maven/commons-logging/commons-logging/pom.properties
META-INF/maven/commons-logging/commons-logging/pom.xml
org/apache/commons/logging/Log.class
org/apache/commons/logging/LogConfigurationException.class
org/apache/commons/logging/LogFactory$1.class
org/apache/commons/logging/LogFactory$2.class
org/apache/commons/logging/LogFactory$3.class
org/apache/commons/logging/LogFactory$4.class
org/apache/commons/logging/LogFactory$5.class
org/apache/commons/logging/LogFactory$6.class
org/apache/commons/logging/LogFactory.class
org/apache/commons/logging/LogSource.class
org/apache/commons/logging/impl/Jdk14Logger.class
org/apache/commons/logging/impl/LogFactoryImpl$1.class
org/apache/commons/logging/impl/LogFactoryImpl$2.class
org/apache/commons/logging/impl/LogFactoryImpl$3.class
org/apache/commons/logging/impl/LogFactoryImpl.class
org/apache/commons/logging/impl/NoOpLog.class
org/apache/commons/logging/impl/SimpleLog$1.class
org/apache/commons/logging/impl/SimpleLog.class
org/apache/commons/logging/impl/WeakHashtable$1.class
org/apache/commons/logging/impl/WeakHashtable$Entry.class
org/apache/commons/logging/impl/WeakHashtable$Referenced.class
org/apache/commons/logging/impl/WeakHashtable$WeakKey.class
org/apache/commons/logging/impl/WeakHashtable.class
[jens@jense-mobile java]$

The program is a prototype I am writing my theses about, so there is no public download. I will send you a link via email

Offline

Board footer

Powered by FluxBB