Re: Classpath problems with tomcat on Linux 9
Figured out my problem. I wasn't placing the class file in a subdirectory of the WEB-INF/classes/. Solution: created UserData.java with package name "userdata" created directory WEB-INF/classes/userdata placed UserData.class in WEB-INF/classes/userdata Thank you all who responded, and anyone else that read this and spent more then the time to click the delete button on it. -Andy. On Monday 19 April 2004 12:27 pm, Stephen Bacon wrote: > Hi Andy, > >I'm porting over to TC5 and I've not had any problems with it finding > my classes, *BUT* I don't put any classes into the base directory > itself, but below that. > > So for example, my UserBean class is in > /WEB-INF/classes/AccessCtrl and it is part of the package > "AccessCtrl" (i.e. first line of bean is "package AccessCtrl;") > > The pages that use this include the directive: > <%@ page import="AccessCtrl.*" %> > so that it can find them. > > Additionally, to avoid problems, I generally include the packagename > anyways in my useBean tags: >class="AccessCtrl.UserBean" > scope="session" /> > Which shouldn't be necessary, but I find it increases readability anyways. > > -Steve > > Andy Wadsworth wrote: > > Should I expect Tomcat to find my UserData.class file if I put it > > in webapps//WEB-INF/classes? Do I need to create a web.xml > > or should it find the class file without any web.xml customization? > > If anyone has a very simple example that I could drop in to see if > > it works, I'd appreciate it. I've already verified that the jsp-examples > > all work, but there is a lot of stuff in the web.xml that I shouldn't > > need for what I want to do, and finding what I need is probably where > > my problems lie. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- ### # Andy Wadsworth # # # # BondMart Technologies, Inc. # # [EMAIL PROTECTED] # # # ### Historical High School Essay Bloopers: They (Greeks) also had myths. A myth is a female moth. One myth says that the mother of Achilles dipped him in the River Stynx until he became intollerable. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath problems with tomcat on Linux 9
Still no luck. I'm basically trying to do exactly the same thing that the "jsp-examples/checkbox" is doing and I can't get Tomcat to recognize my UserData.class file. I've tried placing my UserData.class file in every location possible, and no luck. My next step will be to downgrade to Tomcat 4 so I can at least try out the examples that are described in the Tomcat Bible (the examples don't work with Tomcat 5). Should I expect Tomcat to find my UserData.class file if I put it in webapps//WEB-INF/classes? Do I need to create a web.xml or should it find the class file without any web.xml customization? If anyone has a very simple example that I could drop in to see if it works, I'd appreciate it. I've already verified that the jsp-examples all work, but there is a lot of stuff in the web.xml that I shouldn't need for what I want to do, and finding what I need is probably where my problems lie. -Andy. On Friday 16 April 2004 07:32 pm, Berry, Layton wrote: > I'm guessing you need to put the UserData class in a package, > and import it into your savename page. > > Quoting from JSP 2.0 spec, "As of JSP 2.0, it is illegal > to refer to any classes from the unnamed (a.k.a. default) package." > > -Layton > > >-Original Message- > > From: Andy Wadsworth [mailto:[EMAIL PROTECTED] > > >Sent: Friday, April 16, 2004 2:26 PM > >To: [EMAIL PROTECTED] > >Subject: Classpath problems with tomcat on Linux 9 > > > > > > > >I'm just getting started with my JSP and tomcat experience, and while > >learning how JSP works, I'm can't get tomcat to recognize supporting > >class definitions that I have placed in /WEB-INF/classes. > > > >Here's my setup: > >* tomcat 5.0.19, running on RedHat Linux 9.0 Pro > >* no customization to $CATALINA_HOME/conf/web.xml > > no customization to $CATALINA_HOME/conf/server.xml > > added my user account as a manager in > >$CATALINA_HOME/conf/tomcat-users.xml > >* I'm running tomcat using the $CATALINA_HOME/bin/startup.sh > >* I'm running tomcat as my normal login id, although I've also > >tried it as > > root just to make sure it wasn't a file permissions issue. > >* I'm able to use the Tomcat manager at > >http://localhost:8080/manager to > > start/stop/reload/deploy applications > >* The jsp-examples appear to work fine > > > >Here's what I'm trying to do: > >* Created the following "index.jsp" and placed it in > > $CATALINA_HOME/webapps/test > > > > > > > >What's your name? > >What's your email? > > > > > > > >* Created the following as $CATALINA_HOME/webapps/test/savename.jsp > > > > > > > >Name: <%= user.getUsername() %> > >Email: <%= user.getEmail() %> > > > > > >* Created a UserData.java file that defines a public class UserData > > with username and email fields as type String. Added public > > access methods for setUsername, getUsername, setEmail, getEmail. > > I compiled UserData.java using javac, and to produce UserData.class > > which I placed in $CATALINA_HOME/webapps/test/WEB-INF/classes. The > > UserData.java class does not define a package nor does it import > > anything (line 1 is "public class UserData") > > > >* deployed the "test" application using the tomcat manager and it shows > > that the application is deployed with no errors. > > > >* Using IE 6.0, I enter the url to test.jsp and it displays the form as > > expected. I enter a name and email value into the form and press the > > submit button and I get the following: > > HTTP Status 500 - > > exception > > org.apache.jasper.JasperException: Unable to compile class for JSP > > An error occurred at line: 1 in jsp file: /savename.jsp > > > > Generated sevlet error: > >[javac] Compiling 1 source file > > > ><...>/work/Catalina/localhost/test/org/apache/jsp/savename_jsp.java:42 > > symbol : class UserData > >location: class org.apache.jsp.savename_jsp > >UserDAta user = null > > > > > >I suspect this is a classpath issue but everything I read says > >that if you > >put your classes in /WEB-INF/classes, it will just work. > > > >There must be some basic thing I'm missing. Any help would be very much > >apprciated. > > > >Thanks in advance. > >-Andy. > > > >-- > >###
Re: Classpath problems with tomcat on Linux 9
Ah, if it was only that simple... The capital "A" is a typo in the email message, not in the actual error. I'm using IE on a WinXP box as my browser, but I sent my email from my Linux machine and I can't copy/paste between the two. -Andy. On Friday 16 April 2004 03:32 pm, Caldarale, Charles R wrote: > > From: Andy Wadsworth [mailto:[EMAIL PROTECTED] > > Subject: Classpath problems with tomcat on Linux 9 > > > > <...>/work/Catalina/localhost/test/org/apache/jsp/savename_jsp.java:42 > > symbol : class UserData > > location: class org.apache.jsp.savename_jsp > > UserDAta user = null > >^ > > > Seems awfully suspicious to have a capital A in the middle of the class > name... > > Are you sure the .jsp doesn't have a typo in it? > > - Chuck > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- ### # Andy Wadsworth # # # # BondMart Technologies, Inc. # # [EMAIL PROTECTED] # # # ### How To Make Love Endure... Don't forget your wife's name ... That will mess up the love. Erin, age 8 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Classpath problems with tomcat on Linux 9
I'm just getting started with my JSP and tomcat experience, and while learning how JSP works, I'm can't get tomcat to recognize supporting class definitions that I have placed in /WEB-INF/classes. Here's my setup: * tomcat 5.0.19, running on RedHat Linux 9.0 Pro * no customization to $CATALINA_HOME/conf/web.xml no customization to $CATALINA_HOME/conf/server.xml added my user account as a manager in $CATALINA_HOME/conf/tomcat-users.xml * I'm running tomcat using the $CATALINA_HOME/bin/startup.sh * I'm running tomcat as my normal login id, although I've also tried it as root just to make sure it wasn't a file permissions issue. * I'm able to use the Tomcat manager at http://localhost:8080/manager to start/stop/reload/deploy applications * The jsp-examples appear to work fine Here's what I'm trying to do: * Created the following "index.jsp" and placed it in $CATALINA_HOME/webapps/test What's your name? What's your email? * Created the following as $CATALINA_HOME/webapps/test/savename.jsp Name: <%= user.getUsername() %> Email: <%= user.getEmail() %> * Created a UserData.java file that defines a public class UserData with username and email fields as type String. Added public access methods for setUsername, getUsername, setEmail, getEmail. I compiled UserData.java using javac, and to produce UserData.class which I placed in $CATALINA_HOME/webapps/test/WEB-INF/classes. The UserData.java class does not define a package nor does it import anything (line 1 is "public class UserData") * deployed the "test" application using the tomcat manager and it shows that the application is deployed with no errors. * Using IE 6.0, I enter the url to test.jsp and it displays the form as expected. I enter a name and email value into the form and press the submit button and I get the following: HTTP Status 500 - exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 1 in jsp file: /savename.jsp Generated sevlet error: [javac] Compiling 1 source file <...>/work/Catalina/localhost/test/org/apache/jsp/savename_jsp.java:42 symbol : class UserData location: class org.apache.jsp.savename_jsp UserDAta user = null I suspect this is a classpath issue but everything I read says that if you put your classes in /WEB-INF/classes, it will just work. There must be some basic thing I'm missing. Any help would be very much apprciated. Thanks in advance. -Andy. -- ### # Andy Wadsworth # # # # BondMart Technologies, Inc. # # [EMAIL PROTECTED] # # # ### - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]