• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error

 
keith w lockey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[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
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keith, next time please UseAMeaningfulSubjectLine.
 
keith w lockey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linux and Unix use : instead of ; to separate files and folders in these kinds of lists.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic