Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error when calling Servlet page  RSS feed

 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If anyone could help me figure out what is going on with this, I would be grateful. I can't figure out why I am getting the error below. I have also included the servlet file, the xml file and the jsp file.





XML file


JSP file


Servlet file
 
Devaka Cooray
Marshal
Posts: 5323
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you have your compiled classes in /WEB-INF/classes directory? More likely your Login class is not compiled in the build. If you are using an IDE, try clean and rebuild.
 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devaka Cooray wrote:Are you sure you have your compiled classes in /WEB-INF/classes directory? More likely your Login class is not compiled in the build. If you are using an IDE, try clean and rebuild.


I am not sure. Following the example I was looking at, this is below is how I have everything. I created a package for the users class and a package for the servlet pages. I tried the clean and rebuild but it didn't seem like anything happened but when I ran it again, I got a different error. This is the first time I have ever messed with servlets and jsp files so I am sort of lost about the structure of it. I still haven't quite wrapped my head around the XML either.



 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I'm not looking at that picture straight, but it looks to me like the airline.javas package is under the src directory but the airline.servlets package isn't.
 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Maybe I'm not looking at that picture straight, but it looks to me like the airline.javas package is under the src directory but the airline.servlets package isn't.


That picture does look odd but the file structure is:

src --> airline -->
javas --> Users.java
servlets--> Login.java

So there is a src folder, then airline folder, then a javas folder and a servlets folder within the airline folder. Is this as it should be?
 
Kumar Raja
Ranch Hand
Posts: 548
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check at the deployment location (like tomcat deploy folder) or other server where you have deployed your application, under WEB-INF/classes folder and see if the class is actually existing. If not, then compiled class is not available. Also, do you have Airline.servlets.Login.java under src folder
 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it to work but now I have another problem. It's as if there are two sets of files. I can make changes to both the Users.java file and the Login.java file and nothing happens. It's as if I am editing one file and running another one when Tomcat runs.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do understand that when you change the source code, you have to compile it, rebuild the WAR file, and redeploy that to Tomcat before you can expect the changes to be reflected there?
 
Raymond Gillespie
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:You do understand that when you change the source code, you have to compile it, rebuild the WAR file, and redeploy that to Tomcat before you can expect the changes to be reflected there?


I finally realized that was the problem although any other time I have played with Java I didn't have to manually do this. I finally noticed that under the Project drop down, the Build Automatically selection was un-checked. Once I figured this out, all seems well.

Next up is to figure out how to have JavaScript navigate to a JSP servlet once it performs form validation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!