Hi to all,
Iam trying to run simple spring application manually. While running the helloclient program it is throwing the NoClassDefFoundError.
iam providing the code.
public interface hello
{
public
String sayhello(String a);
}
...
public class helloimpl implements hello
{
private String greeting;public helloimpl(){}public helloimpl(String a){ greeting=a; }
public String sayhello(String s){ return greeting+s; }
public void setGreeting(String a){ greeting=a; }
}
...
import java.io.*;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.xml.*;
import org.springframework.core.io.*;
public class helloclient
{
public static void main(String args[]) throws Exception{
try{
System.out.println("Please wait...");
Resource rs = new ClassPathResource("hello.xml");
BeanFactory factory = new XmlBeanFactory(rs);
hello bean1 = (hello)factory.getBean("hello");
String s = bean1.sayhello(args[0]);
System.out.println("The value is "+s);
}catch(Exception e){
System.out.println("The Exception is ####"+e);
}
}
}
...
iam setting classpath to the spring.jar and commons-logging.jar of tomcat41\server\lib to the current working directory.
iam using spring 1.2.9.
iam getting the following error while running application
E:\Spring\springdemo>
java helloclient "sridhar"
Please wait...
Exception in
thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
gging/LogFactory
at org.springframework.util.ClassUtils.<clinit>(ClassUtils.java:59)
at org.springframework.core.io.ClassPathResource.<init>(ClassPathResourc
e.java:82)
at org.springframework.core.io.ClassPathResource.<init>(ClassPathResourc
e.java:64)
at helloclient.main(helloclient.java:10)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFacto
ry
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)
... 4 more
iam running program in windowsXP.
if any buddy know please help me.
thank you one and all.
[ May 21, 2008: Message edited by: sridhar bvap ]
[ May 21, 2008: Message edited by: sridhar bvap ]
[ May 21, 2008: Message edited by: sridhar bvap ]