You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Nigro, Joseph" <jn...@MassMutual.com> on 2002/11/29 17:06:17 UTC

org/apache/commons/logging/LogFactory NoClassDefFoundError


	I'm going to apologize in advance for this one,, Anyone know why I
would be getting an exception: java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory for the code below when I try to run
this servlet, what is the HttpClient's  relationship to LogFactory ?
I put commons-logging.jar( I'm not sure why) in my class path along with
commons-httpclient.jar. Compiles fine, won't run in container under
Weblogic 5.1 Solaris 5.8, JDK 1.3.1_02

Thanks

	//******Imports************************
import org.apache.commons.httpclient.HttpClient;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
//******Imports************************

public class httptimeout extends HttpServlet {

	public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
  PrintWriter out = res.getWriter();
  out.println("ugh");

				//URL url = new URL("http://www.cnn.com");
                HttpClient client1 = new HttpClient();
                //client1.startSession(url);
                //HttpState hs = new HttpState();
                //hs = client1.getState();
                //resultSet = hs.toString();
                //client1.endSession();
                //client.setTimeout(3000);
                //HttpMethod method = new GetMethod();
                //method.setFollowRedirects(false);
                //method.setStrictMode(false);
		        //client.executeMethod(method);
				//sc = method.getStatusCode();


} //end of Do Get

}  //end of Servlet

------------------------------------------------------------------------------
This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. 


==============================================================================


RE: org/apache/commons/logging/LogFactory NoClassDefFoundError

Posted by Adam Jack <aj...@TrySybase.com>.
Common Logging is a logging abstraction that allow a package like HttpClient
to put out log message (errors/informational/trace/debug) irrespective of
the logging infrastructure that you have in place.

	http://jakarta.apache.org/commons/logging.html

JDK 1.4 (which you are not using) has java.util.logging -- but JDK 1.3 and
before did not have anything. Back then (and still today) folks used log4j
(much nicer than JDK 1.4 logging IMHO) or Avalon LogKit (I've not used, but
it might be appropriate for your use case) or other similar logging
packages. See:

	http://jakarta.apache.org/log4j/docs/index.html
	http://jakarta.apache.org/avalon/index.html

Again ,the purpose of commons logging was to let folks write code like
HttpClient w/o getting all caught up with what logging package the user
wanted. At start-up commons logging goes looking for JDK 1.4 logging (which
it won't find in your environment) then it goes looking for others. I am
guessing that although you have commons logging (an abstraction) you do not
have an logging implementation that it can find. [Kinda like having JDBC but
with no JDBC driver.]

Either that, or although you have commons logging in your compile classpath
it isn't in your runtime one.

Good luck.

regards,

Adam
-----Original Message-----
From: Nigro, Joseph [mailto:jnigro@MassMutual.com]
Sent: Friday, November 29, 2002 9:06 AM
To: 'commons-httpclient-dev@jakarta.apache.org'
Subject: org/apache/commons/logging/LogFactory NoClassDefFoundError




	I'm going to apologize in advance for this one,, Anyone know why I
would be getting an exception: java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory for the code below when I try to run
this servlet, what is the HttpClient's  relationship to LogFactory ?
I put commons-logging.jar( I'm not sure why) in my class path along with
commons-httpclient.jar. Compiles fine, won't run in container under
Weblogic 5.1 Solaris 5.8, JDK 1.3.1_02

Thanks

	//******Imports************************
import org.apache.commons.httpclient.HttpClient;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
//******Imports************************

public class httptimeout extends HttpServlet {

	public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
  PrintWriter out = res.getWriter();
  out.println("ugh");

				//URL url = new URL("http://www.cnn.com");
                HttpClient client1 = new HttpClient();
                //client1.startSession(url);
                //HttpState hs = new HttpState();
                //hs = client1.getState();
                //resultSet = hs.toString();
                //client1.endSession();
                //client.setTimeout(3000);
                //HttpMethod method = new GetMethod();
                //method.setFollowRedirects(false);
                //method.setStrictMode(false);
		        //client.executeMethod(method);
				//sc = method.getStatusCode();


} //end of Do Get

}  //end of Servlet

----------------------------------------------------------------------------
--
This e-mail transmission may contain information that is proprietary,
privileged and/or confidential and is intended exclusively for the person(s)
to whom it is addressed. Any use, copying, retention or disclosure by any
person other than the intended recipient or the intended recipient's
designees is strictly prohibited. If you are not the intended recipient or
their designee, please notify the sender immediately by return e-mail and
delete all copies.


============================================================================
==


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>