aspose file tools*
The moose likes Java in General and the fly likes error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "error " Watch "error " New topic
Author

error

keith w lockey
Greenhorn

Joined: Aug 23, 2010
Posts: 5
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.sshtools.j2ssh.SshClient.<clinit>(Unknown Source)
at FileUtility.sFtp(FileUtility.java:203)
at SendFiles.main(SendFiles.java:142)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 3 more

I keep getting the error about. I have put the logging jar in my manifest file. It should be working. Not sure what to do.
Keith
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

Well, you have to give us more information for starters. The error message is saying that org.apache.commons.logging.LogFactory is not in your classpath. You say the logging jar is in your manifest, but where's the manifest? What exactly does it contain? Are you sure you have the right logging jar ... that is, is that class actually in it?
keith w lockey
Greenhorn

Joined: Aug 23, 2010
Posts: 5
Main-Class: SendFiles
Class-Path: j2ssh-common-0.2.9.jar j2ssh-core-0.2.9.jar j2ssh-daemon-0.2.9.jar commons-logging.jar


this is my manifest file. All the jars listed are in the directory.

Thanks,
Keith
keith w lockey
Greenhorn

Joined: Aug 23, 2010
Posts: 5

[Post New]posted Today 06:26:05 PM
Quote Edit
The following error is shown when I try to run the SendFiles.jar.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.sshtools.j2ssh.SshClient.<clinit>(Unknown Source)
at FileUtility.sFtp(FileUtility.java:203)
at SendFiles.main(SendFiles.java:142)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 3 more


My manifest file for this jar is below:
Main-Class: SendFiles
Class-Path: j2ssh-common-0.2.9.jar j2ssh-core-0.2.9.jar j2ssh-daemon-0.2.9.jar commons-logging.jar

Thanks,
Keith
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

Well, the LogFactory should be in commons-logging.jar, so either you've got a corrupt one, or it's somehow not on the classpath. Is your manifest called MANIFEST.MF, and is it in a directory called META-INF, in a jar file with all your classes?

Try putting all the jars in one directory, and from that directory type:

java -cp my.jar;commons-logging.jar;j2ssh-common-0.2.9.jar;j2ssh-core-0.2.9.jar;j2ssh-daemon-0.2.9.jar SendFiles

(That's assuming your classes are in my.jar.)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

keith w lockey wrote:All the jars listed are in the directory.


And when you say "in the directory" does that mean "in the same directory as the executable jar" (which is what it should mean) or does it mean something else?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Keith, next time please UseAMeaningfulSubjectLine.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
keith w lockey
Greenhorn

Joined: Aug 23, 2010
Posts: 5
java -cp my.jar;commons-logging.jar;j2ssh-common-0.2.9.jar;j2ssh-core-0.2.9.jar;j2ssh-daemon-0.2.9.jar SendFiles
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-d32 use a 32-bit data model if available

-d64 use a 64-bit data model if available
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
bash: commons-logging.jar: command not found
bash: j2ssh-common-0.2.9.jar: command not found
bash: j2ssh-core-0.2.9.jar: command not found
bash: j2ssh-daemon-0.2.9.jar: command not found



I get this when I run the java command.
Keith
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Linux and Unix use : instead of ; to separate files and folders in these kinds of lists.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: error