ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

What now?!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What now?!

    Can anyone tell me where the best place would be for me to look to solve the following exception?

    2008-05-20 14:57:57 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
    at org.apache.jsp.detailpagecc_jsp._jspService(detail pagecc_jsp.java:3857)
    at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)
    Thanks,
    LittlePD << Java noob
    "Time passes, but sometimes it beats the <crap> out of you as it goes."

  • #2
    Re: What now?!

    Can I see your Servlet code ?
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: What now?!

      Originally posted by bryce4president View Post
      Can I see your Servlet code ?
      First, let's be clear on this. This is not my servlet code! I inherited this crap from a guy who spent 8 months on an 8 week project, then quit before it was finished.
      Attached Files
      "Time passes, but sometimes it beats the <crap> out of you as it goes."

      Comment


      • #4
        Re: What now?!

        All I have to say is WOW! What a hell of a mess. I'm not even sure where to begin looking. This is considering the fact that this is a jsp page, not a "servlet" by definition.

        My guess is that after one of the sql statements is executed (probably a select) the program is trying to grab the value from the result set and it is null. And you can't plug null into a primitive variable. Have you checked that there aren't any null values being returned by any of the sql statements? You may have to do some coalescing

        I do not envy our job right now. That thing is UGLY. I'd go so far as to say that its uglier than AS400Pro after a night of drinking with his Russian bride.
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment


        • #5
          Re: What now?!

          One thing I noticed. He is making like 5 connections to the DB in this thing. If you just make one connection and then use that same connection to run all the sql statements it will work sooooo much better for one.

          I imagine that this thing take forever to run. I have to admit that the more I look at this code the more intrigued it makes me, it kind of makes me want to fix it up... This thing should NOT be a single jsp. This needs to be broken out into servlets and other classes and methods.

          I'll take another 10 minutes and see if I can see anything else that is really obvious that will help, but then I need to do some of my own work

          Think of this guy as job security
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: What now?!

            One other thing.... there should NOT be ANY inline styles. They should ALL be removed and put into a single CSS.
            Your future President
            Bryce

            ---------------------------------------------
            http://www.bravobryce.com

            Comment


            • #7
              Re: What now?!

              All the embedded <script>document.writeln statements should be pulled out. There should NOT be ANY embedded javascript in the page like that. It would probably take me a week just to pull this thing apart, rewrite the pieces and put it back together again.


              What is <td width="2"> ???? 2 what? pixels? ems? inches? &#37;?

              by the way that would be <td class="empty"></td> Then in the CSS you can have td.empty{width="2px"};

              and tables inside of tables?

              Ok...I'm done now. If you want some help with this thing I could possibly try to pull some of it apart over my lunch breaks. I don't know what your deadline is for this thing...but....whew....
              Your future President
              Bryce

              ---------------------------------------------
              http://www.bravobryce.com

              Comment


              • #8
                Re: What now?!

                Originally posted by bryce4president View Post
                What is <td width="2"> ???? 2 what? pixels? ems? inches? %?
                the default for HTML widths is pixels...but i'm with you on the css thing...why inline? if you need to make a change you have to go mod code vs. make a change to a single text file....ewww.
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment


                • #9
                  Re: What now?!

                  I know that the default is pixels, I was just trying to make a point that you should always be explicit....

                  Kind of like school....
                  Teacher: "Who can tell me the distance between point A and point B?"
                  Me: "5"
                  Teacher: "Nope."
                  Me: "What do you mean? I just did the math, 8 - 3 = 5."
                  Teacher: "Yes, but 5 what?"
                  Me: "5 pain in the @#%@#%@#% teachers... that's my unit of measure right now."
                  Last edited by bryce4president; May 21, 2008, 12:06 PM.
                  Your future President
                  Bryce

                  ---------------------------------------------
                  http://www.bravobryce.com

                  Comment


                  • #10
                    Re: What now?!

                    LOL...true that's one of my little pet peeves..specify what you mean. i've responded to many posts on various forums to put the data type in your d specs for clarity...it's only one extra key stroke per field definition fer cryin' out loud...
                    I'm not anti-social, I just don't like people -Tommy Holden

                    Comment


                    • #11
                      Re: What now?!

                      Thanks Bryce and Tom.

                      Unfortunately, they promoted this thing into production last Thursday, so right now my main concern is fixing the bug(s). I'll get to rewriting the whole application (there are 100+ other jsp files, most of which look just like this!) when I can come up for air!

                      Thing is, this code worked on the dev server and the QA server, so why doesn't it work now? I'll check the data to make sure there are no nulls, but it's DB2 on a System i. I'm pretty sure none of those tables has any null-capable fields.

                      There are some MySQL tables being queried; maybe one of them is the culprit. I wish I knew how to tell which line of code was causing the error. That kind of help would be most beneficial. You know the old saying: don't give me a fish, teach me how to fish for myself. But don't think for one split second that all of your help is not appreciated.

                      Thanks,
                      Michael
                      "Time passes, but sometimes it beats the <crap> out of you as it goes."

                      Comment


                      • #12
                        Re: What now?!

                        debugging a JSP like this can be a nightmare. Since the servlet gets compiled and the actual servlet code looks nothing like what you see in the jsp. Does this error happen during compile time or run time? (once again, sometimes tough to tell). I would place it in debug and debug from the very first statement. If you can get that far you might be able to step through it.
                        Your future President
                        Bryce

                        ---------------------------------------------
                        http://www.bravobryce.com

                        Comment


                        • #13
                          Re: What now?!

                          Originally posted by littlepd View Post
                          I'll check the data to make sure there are no nulls, but it's DB2 on a System i. I'm pretty sure none of those tables has any null-capable fields.
                          don't always assume that DB2/400 (or whatever you wanna call it) has supported null=capable fields for years now. i've seen them used (and is one reason i want true null support in RPG!!!)
                          I'm not anti-social, I just don't like people -Tommy Holden

                          Comment


                          • #14
                            Re: What now?!

                            I never understood the use of NULL in a database. Give the @#%@#%@#%@#% field a value. Whether it be 0 or ''. Having fields as Null (atleast in my opinion because a lot of people i've seen don't know how to handle them properly) causes countless bugs. just my $.0123.... @#%@#%@#%@#% economy is devaluing my opinions...
                            Your future President
                            Bryce

                            ---------------------------------------------
                            http://www.bravobryce.com

                            Comment


                            • #15
                              Re: What now?!

                              Originally posted by bryce4president View Post
                              I never understood the use of NULL in a database. Give the @#%@#%@#%@#% field a value. Whether it be 0 or ''. Having fields as Null (atleast in my opinion because a lot of people i've seen don't know how to handle them properly) causes countless bugs. just my $.0123.... @#%@#%@#%@#% economy is devaluing my opinions...
                              hehehe...what economy??

                              as far as nulls...i don't like 'em i know how to use them but in RPG it's just plain ol' ugly...
                              Code:
                              /free
                                   If %nullind(myfield);
                                      %nullind(myfield) = *Off;
                                       myfield = 'now i can put data in this frigging thing';
                                   endif;
                              this would be better
                              Code:
                              /free
                                  if myfield = null;
                                    myfield = 'this is my crap data'; // null indicator 
                                                                                      // is implicitly off
                                  endif;
                              I'm not anti-social, I just don't like people -Tommy Holden

                              Comment

                              Working...
                              X