Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 18th, 2005, 10:53 AM
jfburg jfburg is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 jfburg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 16 sec
Reputation Power: 0
Tomcat, Jsp and Java Files

I am new to java and trying to implement a application on to Tomcat 5.5.9. Recievings the following errors.

java.lang.NullPointerException
training.rules.TrainingSession.getJobTitleIds(Trai ningSession.java:1062)
org.apache.jsp.searchJob_jsp._jspService(org.apach e.jsp.searchJob_jsp:339)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:362)

Here snippet of where the code error:

public MultiValue getJobTitleIds() {

Hashtable validityTables = SessionManager.get(getApplication()).getValidityTa bles();
KeyedList validJobTitles = ((KeyedList )validityTables.get("Job_Table"));

if (!validJobTitles.isValid()) {

try {

getValidJobTitles();

}
catch (IOException e) {} // We did the best we could to repopulate the cache.

} // end of if

return(jobTitleIds);

} // end of method 'getJobTitleIds'

Reply With Quote
  #2  
Old July 18th, 2005, 11:34 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
First of all : any NullpointerException means that you're trying to access an object that doesn't exist (yet).
To be honest : I'm just a java amateur and I must admit I haven't worked with KeyedList. So, I can't say where your error is.

But then, the error message is giving you a clue : it mentions searchJob_jsp:339.
You must know that every JSP is translated first into a servlet. So, I suppose you have a searchJob.jsp. This will be translated in a searchJob_jsp.java, then it will be compiled into a searchJob_jsp.class file.

So, to know where it went wrong, you should take a look at the java file which corresponds to your JSP.
Where can you find it ?
Well, in my case I have a web application which is located at C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco.
The translated JSP's can be found at C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\gco.

So, look up the java file searchJob_jsp.java and look at line 339. This will give you a clue about which object hasn't been created yet.

Reply With Quote
  #3  
Old July 18th, 2005, 11:40 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
Just to help you out a bit. If you're new to java and JSP's, you should know this.
You can write java web applications with only java server pages. And in each JSP you can connect to the database and look up the necessary data and show it to the user.
Imagine you have a web app containg about 15 JSP's. The day you're changing your database, you will have to change 15 JSP's.

Or you can follow the MVC or Model-View-Controller design pattern. That way, you're dividing your application into the following components :
- model : these are the javabeans which contain properties and getters and setters. These javabeans correspond to the concepts the user of the web app knows. For instance, a web app made to sell products, will surely contain the javabeans Customer, Product, Order, Invoice, Payment.
- view : this is the collection of JSP's. The only thing a JSP has to do is to show the information contained inside the javabeans. Who makes those javabeans ? Well, that's the third part.
- controller : this is the heart of the web application. The controller is the servlet(s) who accept a request and decide which response should be given.

If you're looking for a free book, go to www.coreservlets.com. You can download the first edition of this classic book of Marty Hall for free.

Another great book is the "Apache Tomcat Bible". The title is a bit misleading, since it explains a lot more : how to download java, MySQL, Tomcat, Eclipse.
ANd it gives an overview of the MVC and how to implement it. A must have !

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Tomcat, Jsp and Java Files


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT