RE: Classloading issue: common/lib/servlet-api.jar
Shapira, Yoav wrote: Howdy, - NoClassDefFoundError is different from ClassNotFoundException. Make sure you understand the difference. Then make sure you remove extra copies of the servlet APIs from the classpath, specifically if you have j2ee.jar or servlet.jar somewhere. Yoav, thanks for the reply. ClassNotFoundException - class you explicitly asked for is not found NoClassDefFoundError - a class required by your class (through a new, e.g.) was available at compile time but cannot be found now. I have no servlet jars other than the ones Tomcat 5.0.18 supplies. I do have jboss-j2ee.jar in my classpath, and the code will not compile without it: javax\ejb\CreateException.class not found. I moved the JBoss jars I put in Tomcat's classpath to a directory outside the JBoss directory, just to make sure it wasn't picking up classes from that directory I didn't know about (turns out it was, the JBoss security classes.) I think the problem is probably in one of the classes that reside in jars we build and that are invoked on this page. At any rate, I can add the subject jar to the Tomcat classpath explicitly - that is a good-enough solution for now. - In addition to Senor Duffy's post, read the Classloader How-To in the tomcat documentation. Yoav Shapira Millennium ChemInformatics -Original Message- From: Guy Rouillier [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 4:17 PM To: Tomcat Users List Subject: Classloading issue: common/lib/servlet-api.jar I found this message in the archives from Michael Duffy that is relevant to my question: When Tomcat starts, it assumes the CLASSPATH for your Web app consists of: (1) The rt.jar, of course, (2) All the JARs in TOMCAT_HOME/common/lib, which are visible to all apps, (3) All the JARs in the TOMCAT_HOME/server/lib, which are visible only to Tomcat, (4) All the JARs in your WEB-INF/lib, which are visible only to your app, (5) All the .class files in your WEB-INF/classes, which are visible only to your app. That's it. If your Web app needs a JAR, put it in the WEB-INF/lib and you should be all set. - MOD My page (which is running with a security manager, i.e, -security) is getting the following error (partial stack trace): java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader .java:123 ) I found that common/lib/servlet-api.jar contains this class, and if I manually add it to the classpath (by editing catalina.sh), my page will then work. According to the note above, all jars on common/lib should be automatically available to my pages. I haven't touched catalina.properties. Any idea why this jar is not being picked up automatically out of common/lib? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloading issue: common/lib/servlet-api.jar
Howdy, ClassNotFoundException - class you explicitly asked for is not found NoClassDefFoundError - a class required by your class (through a new, e.g.) was available at compile time but cannot be found now. I know what the errors mean, thanks ;) The most common cause for the latter is version skew: a class was found with the same name but not the same interfaces as the class you had at compile-time. For example, a version of javax.servlet.http.HttpServletRequest from a servlet specification 2.3 jar was found on a tomcat 5 classpath. I have no servlet jars other than the ones Tomcat 5.0.18 supplies. I do have jboss-j2ee.jar in my classpath, and the code will not compile without it: javax\ejb\CreateException.class not found. I moved the Are you running tomcat standalone or JBoss with embedded tomcat? Does the jboss-j2ee.jar have the servlet classes in it? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classloading issue: common/lib/servlet-api.jar
Can you post the entire stack trace? This exception usually occurs when a doPrivileged block is missing (when -security). I will try to reproduce the problem since it is a bug in Tomcat. Do you have the same exception if you don't turn security on? What your servlet is trying to do? Thanks -- Jeanfrancois Guy Rouillier wrote: I found this message in the archives from Michael Duffy that is relevant to my question: When Tomcat starts, it assumes the CLASSPATH for your Web app consists of: (1) The rt.jar, of course, (2) All the JARs in TOMCAT_HOME/common/lib, which are visible to all apps, (3) All the JARs in the TOMCAT_HOME/server/lib, which are visible only to Tomcat, (4) All the JARs in your WEB-INF/lib, which are visible only to your app, (5) All the .class files in your WEB-INF/classes, which are visible only to your app. That's it. If your Web app needs a JAR, put it in the WEB-INF/lib and you should be all set. - MOD My page (which is running with a security manager, i.e, -security) is getting the following error (partial stack trace): java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123 ) I found that common/lib/servlet-api.jar contains this class, and if I manually add it to the classpath (by editing catalina.sh), my page will then work. According to the note above, all jars on common/lib should be automatically available to my pages. I haven't touched catalina.properties. Any idea why this jar is not being picked up automatically out of common/lib? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloading issue: common/lib/servlet-api.jar
Shapira, Yoav wrote: Howdy, ClassNotFoundException - class you explicitly asked for is not found NoClassDefFoundError - a class required by your class (through a new, e.g.) was available at compile time but cannot be found now. I know what the errors mean, thanks ;) The most common cause for the latter is version skew: a class was found with the same name but not the same interfaces as the class you had at compile-time. For example, a version of javax.servlet.http.HttpServletRequest from a servlet specification 2.3 jar was found on a tomcat 5 classpath. The jars that this page uses were definitely compiled with an earlier version of servlet.jar than Tomcat 5 contains. That would produce NoClassDefFoundError? Why would the error go away if I explicitly include the subject jar in the classpath? Sorry, I have read all the JBoss classloading docs, but have not yet read the Tomcat classloader ref you supplied - I will. I have no servlet jars other than the ones Tomcat 5.0.18 supplies. I do have jboss-j2ee.jar in my classpath, and the code will not compile without it: javax\ejb\CreateException.class not found. I moved the Are you running tomcat standalone or JBoss with embedded tomcat? Standalone, though JBoss is running on the same box in a different JVM. Does the jboss-j2ee.jar have the servlet classes in it? No. Yoav, thanks for your time. I don't want to ask for any more of it until I can get the chance to recompile the jars with the same servlet jars Tomcat 5 is using (and I've read the classloader docs.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloading issue: common/lib/servlet-api.jar
Jeanfrancois Arcand wrote: Can you post the entire stack trace? This exception usually occurs when a doPrivileged block is missing (when -security). I will try to reproduce the problem since it is a bug in Tomcat. Jeanfrancois, I'll include the entire stack trace at the bottom on this message. Before spending time on this, let me get ahold of the jars this page uses and recompile them with the Tomcat 5 servlet jars. Yoav gave me the impression that version differences between compile and run time can cause this error. If that doesn't make this go away, I'll report back again. Thanks for your offer. Do you have the same exception if you don't turn security on? What your servlet is trying to do? Yes, I see the same thing without -security. Not clear on why it would still be using a SecureClassloader if I'm not running with -security. Thanks -- Jeanfrancois Guy Rouillier wrote: I found this message in the archives from Michael Duffy that is relevant to my question: When Tomcat starts, it assumes the CLASSPATH for your Web app consists of: (1) The rt.jar, of course, (2) All the JARs in TOMCAT_HOME/common/lib, which are visible to all apps, (3) All the JARs in the TOMCAT_HOME/server/lib, which are visible only to Tomcat, (4) All the JARs in your WEB-INF/lib, which are visible only to your app, (5) All the .class files in your WEB-INF/classes, which are visible only to your app. That's it. If your Web app needs a JAR, put it in the WEB-INF/lib and you should be all set. - MOD My page (which is running with a security manager, i.e, -security) is getting the following error (partial stack trace): java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader .java:123 ) I found that common/lib/servlet-api.jar contains this class, and if I manually add it to the classpath (by editing catalina.sh), my page will then work. According to the note above, all jars on common/lib should be automatically available to my pages. I haven't touched catalina.properties. Any idea why this jar is not being picked up automatically out of common/lib? Thanks. Stack trace java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader .java:1296) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader .java:1230) at org.apache.jasper.servlet.JasperLoader$1.run(JasperLoader.java:176) at java.security.AccessController.doPrivileged(Native Method) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:174) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:110) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at org.apache.jsp.scc.myservices.html.mpm_jsp._jspService(mpm_jsp.java:841) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:311) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:500) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.jav a:200) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:278) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFi
Re: Classloading issue: common/lib/servlet-api.jar
Guy Rouillier wrote: Jeanfrancois Arcand wrote: Can you post the entire stack trace? This exception usually occurs when a doPrivileged block is missing (when -security). I will try to reproduce the problem since it is a bug in Tomcat. Jeanfrancois, I'll include the entire stack trace at the bottom on this message. Before spending time on this, let me get ahold of the jars this page uses and recompile them with the Tomcat 5 servlet jars. Yoav gave me the impression that version differences between compile and run time can cause this error. If that doesn't make this go away, I'll report back again. Thanks for your offer. Do you have the same exception if you don't turn security on? What your servlet is trying to do? Yes, I see the same thing without -security. Not clear on why it would still be using a SecureClassloader if I'm not running with -security. OK, then Yoav's recommendation is the way to go since doPrivileged block is not required when there is no security manager. -- Jeanfrancois Thanks -- Jeanfrancois Guy Rouillier wrote: I found this message in the archives from Michael Duffy that is relevant to my question: When Tomcat starts, it assumes the CLASSPATH for your Web app consists of: (1) The rt.jar, of course, (2) All the JARs in TOMCAT_HOME/common/lib, which are visible to all apps, (3) All the JARs in the TOMCAT_HOME/server/lib, which are visible only to Tomcat, (4) All the JARs in your WEB-INF/lib, which are visible only to your app, (5) All the .class files in your WEB-INF/classes, which are visible only to your app. That's it. If your Web app needs a JAR, put it in the WEB-INF/lib and you should be all set. - MOD My page (which is running with a security manager, i.e, -security) is getting the following error (partial stack trace): java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader .java:123 ) I found that common/lib/servlet-api.jar contains this class, and if I manually add it to the classpath (by editing catalina.sh), my page will then work. According to the note above, all jars on common/lib should be automatically available to my pages. I haven't touched catalina.properties. Any idea why this jar is not being picked up automatically out of common/lib? Thanks. Stack trace java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader .java:1296) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader .java:1230) at org.apache.jasper.servlet.JasperLoader$1.run(JasperLoader.java:176) at java.security.AccessController.doPrivileged(Native Method) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:174) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:110) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at org.apache.jsp.scc.myservices.html.mpm_jsp._jspService(mpm_jsp.java:841) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:311) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:284) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:500) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.jav a:200) at
Classloading issue: common/lib/servlet-api.jar
I found this message in the archives from Michael Duffy that is relevant to my question: When Tomcat starts, it assumes the CLASSPATH for your Web app consists of: (1) The rt.jar, of course, (2) All the JARs in TOMCAT_HOME/common/lib, which are visible to all apps, (3) All the JARs in the TOMCAT_HOME/server/lib, which are visible only to Tomcat, (4) All the JARs in your WEB-INF/lib, which are visible only to your app, (5) All the .class files in your WEB-INF/classes, which are visible only to your app. That's it. If your Web app needs a JAR, put it in the WEB-INF/lib and you should be all set. - MOD My page (which is running with a security manager, i.e, -security) is getting the following error (partial stack trace): java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123 ) I found that common/lib/servlet-api.jar contains this class, and if I manually add it to the classpath (by editing catalina.sh), my page will then work. According to the note above, all jars on common/lib should be automatically available to my pages. I haven't touched catalina.properties. Any idea why this jar is not being picked up automatically out of common/lib? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloading issue: common/lib/servlet-api.jar
Howdy, - NoClassDefFoundError is different from ClassNotFoundException. Make sure you understand the difference. Then make sure you remove extra copies of the servlet APIs from the classpath, specifically if you have j2ee.jar or servlet.jar somewhere. - In addition to Senor Duffy's post, read the Classloader How-To in the tomcat documentation. Yoav Shapira Millennium ChemInformatics -Original Message- From: Guy Rouillier [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 4:17 PM To: Tomcat Users List Subject: Classloading issue: common/lib/servlet-api.jar I found this message in the archives from Michael Duffy that is relevant to my question: When Tomcat starts, it assumes the CLASSPATH for your Web app consists of: (1) The rt.jar, of course, (2) All the JARs in TOMCAT_HOME/common/lib, which are visible to all apps, (3) All the JARs in the TOMCAT_HOME/server/lib, which are visible only to Tomcat, (4) All the JARs in your WEB-INF/lib, which are visible only to your app, (5) All the .class files in your WEB-INF/classes, which are visible only to your app. That's it. If your Web app needs a JAR, put it in the WEB-INF/lib and you should be all set. - MOD My page (which is running with a security manager, i.e, -security) is getting the following error (partial stack trace): java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionBindingListener at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123 ) I found that common/lib/servlet-api.jar contains this class, and if I manually add it to the classpath (by editing catalina.sh), my page will then work. According to the note above, all jars on common/lib should be automatically available to my pages. I haven't touched catalina.properties. Any idea why this jar is not being picked up automatically out of common/lib? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]