Re: Baffled: classpath problem as usual?
Laird Nelson wrote: To debug, I've got it to the point where ActionBase.createActionInstance() tries to create an instance of my Action. The action.xml file is set up properly. The call to newInstance() results in a ClassNotFoundException. Even more weirdly, the tomcat.log reports that ActionServlet is creating and populating my form bean successfully. But when I stick a few System.out.println's in that form bean to verify the truth of this log message, they never fire, suggesting, perhaps, that the form bean can't be found either. The problem seems to be, then, anything located under WEB-INF/classes is not being grokked by the Tomcat classloader. And yet deploying the struts example application works fine--drop it in and go. Any thoughts? Cheers, Laird -- W: [EMAIL PROTECTED] / P: [EMAIL PROTECTED] http://www.amherst.edu/~ljnelson/ Good, cheap, fast: pick two.
Re: Baffled: classpath problem as usual?
Laird Nelson wrote: Laird Nelson wrote: To debug, I've got it to the point where ActionBase.createActionInstance() tries to create an instance of my Action. The action.xml file is set up properly. The call to newInstance() results in a ClassNotFoundException. Even more weirdly, the tomcat.log reports that ActionServlet is creating and populating my form bean successfully. But when I stick a few System.out.println's in that form bean to verify the truth of this log message, they never fire, suggesting, perhaps, that the form bean can't be found either. The problem seems to be, then, anything located under WEB-INF/classes is not being grokked by the Tomcat classloader. And yet deploying the struts example application works fine--drop it in and go. Are you positive that your classes have a "*.class" extension, and are in their proper package hierarchy? In other words, a class named "com.mycompany.mypackage.MyClass" should be located at: /WEB-INF/classes/com/mycompany/mypackage/MyClass.class If your classes are really in JAR files (as one of your comments implied), the JAR files need to be under "/WEB-INF/lib", not "/WEB-INF/classes". Any thoughts? One other "obvious" thing to check is operating system read permissions on all the files ... Cheers, Laird Craig
Re: Baffled: classpath problem as usual?
Hi Laird, ... To debug, I've got it to the point where ActionBase.createActionInstance() tries to create an instance of my Action. The action.xml file is set up properly. The call to newInstance() results in a ClassNotFoundException. Is there some magic setting I don't know about that I need to set? How does Tomcat (3.2, which I'm using) know to look in my .war file's WEB-INF/classes directory? Do I need to specify this somewhere? Do I need to add it to the classpath (seems like I shouldn't have to)? The ClassNotFoundException indicates that Struts can't find your class along the application CLASSPATH, using the Java classloader. Check these points: - Your .java file defines the class as belonging to the package my.app.packages. - Your .class file is under /webapps/WEB-INF/classes/my/app/packages when unwarred. - You defined it in action.xml using the class full name. actionpath="/yourAction" actionClass="my.app.packages.TheActionClass" formAttribute="myForm" formClass="my.app.packages.TheActionForm" Pierre Métras
Re: Baffled: classpath problem as usual?
Pierre Métras wrote: The ClassNotFoundException indicates that Struts can't find your class along the application CLASSPATH, using the Java classloader. Right; I should have made it clear that I've been working with Java professionally for years, i.e. I know what the exception means. (Even so, classpath problems STILL nip you in the butt if you aren't careful! :-)) Check these points: - Your .java file defines the class as belonging to the package my.app.packages. Yep. - Your .class file is under /webapps/WEB-INF/classes/my/app/packages when unwarred. Verified. (Under $TOMCAT_HOME/webapps etc., actually). - You defined it in action.xml using the class full name. actionpath="/yourAction" actionClass="my.app.packages.TheActionClass" formAttribute="myForm" formClass="my.app.packages.TheActionForm" Verified. Any other ideas? I've edited ActionMapping.createActionInstance() so that it dumps the "java.class.path" system property to STDOUT immediately before calling Class.forName(). That class path does NOT contain the unwarred war file in the tomcat webapps directory (I thought it would, but maybe Tomcat's classloader doesn't set/use this property?). Is this good/bad? Cheers, Laird -- W: [EMAIL PROTECTED] / P: [EMAIL PROTECTED] http://www.amherst.edu/~ljnelson/ Good, cheap, fast: pick two.
Re: Baffled: classpath problem as usual?
"Craig R. McClanahan" wrote: Are you positive that your classes have a "*.class" extension, and are in their proper package hierarchy? In other words, a class named "com.mycompany.mypackage.MyClass" should be located at: /WEB-INF/classes/com/mycompany/mypackage/MyClass.class Verified. If your classes are really in JAR files (as one of your comments implied), the JAR files need to be under "/WEB-INF/lib", not "/WEB-INF/classes". No jar files (other than struts itself). Verified. One other "obvious" thing to check is operating system read permissions on all the files ... Verified. None of this helped. :-( My next step will be to chuck the .war file up on a public web server somewhere and implore this list to please try dropping it into tomcat and seeing what you come up with. Cheers, Laird -- W: [EMAIL PROTECTED] / P: [EMAIL PROTECTED] http://www.amherst.edu/~ljnelson/ Good, cheap, fast: pick two.