• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag throwing null

 
Benjamin Madore
Greenhorn
Posts: 11
Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, this is my first time posting here, this place has been coming up on my searches for a while now and it seems pretty friendly.

Here's my problem - I've inherited a web application that does assignments and homework, and the server was updated just before I started, leaving me to chase bugs around.

My latest problem is with a tag, and I'm not very sure what it is trying to tell me. (I'm no means a Java expert, I had been using PHP for the last few years.)



I've chased down several NULL-related issues already, it seems that newer versions are much more strict then the when the app was created, and the author(s) used a lot of NULL checks and assignments.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The information in the stack trace, specifically:

at org.apache.jsp.tag.web.organization.assignStep0_tag.doTag(assignStep0_tag.java:505)

says that a null pointer exec potion is being thrown at line 505 of the assignStep0_tag.java class. What's there?
 
Benjamin Madore
Greenhorn
Posts: 11
Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's also confusing me, and forgive me if I don't have tags figured out yet, the assignStep0.tag file is 257 lines long. (below) I'm not sure if it's expanding somewhere, or if I have the wrong place.

 
Benjamin Madore
Greenhorn
Posts: 11
Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is the relevant part:

They're set as follows:

And they're all objects, is that affecting it? Could there be an embedded null?
 
Benjamin Madore
Greenhorn
Posts: 11
Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, in the file "assignStep0.tag" when it does this:


could that be causing the tag error, or am I off.

Is there some intermediate file I need to find?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the many many reasons that scriptlets in JSPs have been discredited for 10 years now (they were replaced with the JSTL and EL with JSP2 in 2002!) is the difficulty in diagnosing problems such as this.

When modern JSPs contain only JSTL and EL, it's almost impossible for these types of errors to occur.

My advice at this point can only be to update your JSP knowledge with JSTL and EL and move all that Java code out of your JSPs and tags.

You might want to read this article for information on structuring modern web apps.
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you find anything by looking at the JSP source file directly under the tomcat work directory? I don't know how and where your tomcat is set up, but to give you an idea:
/web/apache-tomcat-6.0.29/work/Catalina/yourwebsite/_/org/apache/jsp/assignHomework_jsp.java
 
Benjamin Madore
Greenhorn
Posts: 11
Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Koen,

That helps a lot! I understand the file names now.

505 is:

I'm guessing the description is either returning null error or a null string, I'll look into it. I recall from looking around one "fix" in a java update was to strictly enforce some nulls in strings.
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're getting a NullPointerException at that line, then either out is null or questionType is null.

The former is inconceivable so it follows that questionType is null. So just go through that big clump of Java/scriptlet/JSP and find where it's used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic