Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Error when calling Servlet page

 
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
 
Sheriff
Posts: 6631
1254
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • 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.



 
Marshal
Posts: 25795
69
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?
 
Ranch Hand
Posts: 558
2
Hibernate Spring Java
  • 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
Marshal
Posts: 25795
69
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.
 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic