When I run my Java Web App, made using Netbeans, it runs perfectly with no problems, and everything seems to work, but if I leave it be, after some idle time, if wanted to do anything with it (mostly loading rows from database, jquery, ajax), nothing happens, when I refresh the page, I get this error.
I'm sorry because I couldn't post the log here, it was too big and my browser crashed every time I pasted, and when it worked Stackoverflow has a limit...so I uploaded it and here's the link.
http://www.crocko.com/99F6AEF8373B425A885BD379686EF2C5/server.log_2012-08-11T05-03-18
StandardWrapperValve[JoinPart]: PWC1406: Servlet.service() for servlet JoinPart threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:454)
at java.lang.Integer.parseInt(Integer.java:527)
at JoinPart.doGet(JoinPart.java:315)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770
EDIT: the current project was a copy of a previous project that contained a servlet JoinPart.java, after creating this copy, I deleted this servlet because I no longer needed it, I don't know if it still exist in some traces of this project, how can I get rid of it? this servlet is already deleted, I checked the javascript files, and none of them contains ajax requests on this servlet, I should have created a whole new project instead of copying, how can I get rid of any traces of this servlet?
Given the symptom and the very little information, I would guess that you are using something from the session. Leaving it for a time you timeout. Since you timed out on your next request you get a new session and it isn't setup the way you expect it to be anymore. You reference something in the session and it's null and you aren't checking for that situation. The stack trace should tell you where you are referencing that something.
Of course, this is just conjecture. When you give more information you will get better answers.
Never copy projects if you intend to work on something completely different, always create new projects!
Related
I am fairly new to using JSP but all I want to do at the minute is call a simple method from a JSP scriptlet. There are questions similar to this on this forum already, but any solution to those problems always seemed to be related to a simple typo, however as far as I can see, there is no typo in my code but I could be wrong.
Here is my JSP file (ShowBookings.jsp)-
This is the Controller class that I am attempting to call.
This is the HTTP Status 500 – Internal Server Error I get when I try to run the web page.
I used images instead of code snippets to give a better idea of exactly what I am seeing. When I type in "controller.;" in the jsp file, the methods appear in the intellisense including the sayHello() method, so it does seem to be visible from the jsp file but it is still throwing an error. Any help or advice would be greatly appreciated.
I have downloaded the source code of the loadtest demo from the Red5 server codebase and trying to set it up in my local. I am using FlashDevelop to setup the Flash Client. During the build phase I realized, this code is written long back, and hence, most of the latest SDKs and jars I am using needs to be replaced by older versions.
I am now able to successfully build the codebase in Eclipse and imported the project as a Flash(AS3) project in FlashDevelop. But, when I am running it in debug mode, I am getting lots of Error #1009: Cannot access a property or method of a null object reference errors. When I traced back with the debugger, what I found is, all the objects created in .mxml files, when they are getting used in the .as files, I am getting this error.
I am new to ActionScript/Flex. I did a lot of reading about this error online. What I found is, this happens when an object is getting used before being initialized. But, in this project everything seems to be fine.
So, I am suspecting it can be any kind of version issue of the Flash Player or something else. I am listing here some of the lines that encountered Error#1009:
Error Line 1 (requestDelay throwing Error#1009):
function.as: log('Load delay: '+requestDelay.text);
loadtest.mxml:
<mx:Label text="Request delay" fontWeight="bold"/>
<mx:TextInput id="requestDelay" text="1" width="30" toolTip="For a minimal delay input .1"/>
Error Line 2 (useAMF3 throwing Error#1009):
function.as: viewer.setEncoding(useAMF3.selected === true ? 3 : 0);
loadtest.mxml: <mx:CheckBox label="AMF3" fontWeight="bold" id="useAMF3" x="10" y="40" color="#000000"/>
During my test I am commenting each line where I am getting this error, and moving ahead. This way I encountered multiple such errors.
If it helps, let me know if I need to provide the function.as and loadtest.mxml files here. I don't want to clutter the message. Hence, not posting it right now.
Any help is appreciated! Thanks!
When a component is created it takes soem time until is ready, use the creationComplete event and add a handler to do your work,
I load the city and state from my database. I used the below code in JSP:
<s:action executeResult="true" name="LoadCities"> </s:action>
It works fine during the initial page loading, but gives me issue when I update the cities in my database. After the the update is successful I redirect this the same page.
But this time I am getting the following exception:
The server side component of the HTTP Monitor has detected a
java.lang.StackOverflowError. This happens when there is an infinite loop in
the web module. Correct the cause of the infinite loop before running
the web module again.
2014-03-18 15:51:02,965 WARN org.apache.struts2.components.Include.warn:49 -
Exception thrown during include of header.jsp javax.servlet.ServletException:
The server side component of the HTTP Monitor has detected a
java.lang.StackOverflowError. This happens when there is an infinite loop in
the web module. Correct the cause of the infinite loop before running
the web module again.
How could I fix this problem?
This happens because you are executing a result that maps to the same JSP used with s:action tag. You should be careful in mapping JSPs when using the s:action tag.
Actually you should reconsider the design your JSPs because this tag is rarely used and a few cases might apply to it. You can prepare the JSP on the server side using the only one action (also it could be chained but is not recommended here), but you can prepare many fragments or tiles in it.
So, you either don't use the s:action tag, or use it with executeResult="false", or choose one of the approaches above to split the design of the JSP pages.
Nowadays Ajax is very popular that can solve many problems with loading data on the client side and updating the content. So you have many possibilities to do that.
I am trying to display dynamic data in jsp. for that I am calling java method inside a jsp using jsp expression. this java method is taking much time but it is returning some value.(I cant reduce the method execution time.)
But my jsp is showing blank.
Can anybody explain what would be the reason and how to resolve.
This code is not written by me But I need to find out the root cause.
my jsp code look like
display.jsp
..... hello......start...
<%= obj.getDynamicData() %>
.....completed .... end
It's likely because you're (ab)using JSP to execute some raw Java code. When an exception is been thrown halfway sending the JSP's output, the remnant of the JSP won't be sent to the browser anymore. But the webserver cannot change the response into an error page with exception details anymore as well and the webbrowser will end up with a halfbaked HTML output which is often displayed as a blank page.
Any uncaught exception is usually logged into server's logfile. You need to dig in the server's logs for the exception and stacktrace so that you can fix the root cause of the problem. Exceptions contain worthful information about the cause of the problem.
A halfbaked HTML page is just an incomplete HTML page which caused the webbrowser not to understand how to display it properly. Rightclick the page in webbrowser and choos View Source. Verify if it is as expected, if necessary with help of the w3 validator.
Further, it may be worth the effort trying in different (better) webbrowsers like Firefox and Chrome. MSIE6/7 is namely known to choke like that when it has received an enormously HTML <table>. It has a poor table rendering engine.
To save yourself from future trouble like this, I suggest to move all that Java code out into a Servlet class so that you can get a more friendly (at least, it's better than digging in server's log files) error page in case of an exception in Java code. See also How to avoid Java code in JSP?
Based on the comments made in BalusC's answer:
When I comment the call to obj.getDynamicData(), jsp page rendered properly.
Either one of two things could be happening:
obj.getDynamicData() is throwing an exception which is not caught and handled
Your servlet container/server may be configured with some sort of "request timeout" that closes the HTTP connection if it takes more than a certain amount of time to process the request, and obj.getDynamicData() takes so long to execute that this timeout is being triggered.
Do you have any sort of logging in your code or JSP that tells you what happens server-side after this method finishes processing? A strong hint that #2 is occuring would be if you continue to see log activity from the thread processing the JSP request (and obj.getDynamicData()) after the browser has stopped waiting for the request / received the blank page.
And to rule out the simple things, are you sure that the server is actually returning an empty response, and not that your browser is showing a blank page because the server returned half an HTML page? Make sure to check View Source, use a tool like Firebug, and/or make the same HTTP request that you do in a browser from a command-line tool like
curl or wget.
I am trying to handle a file upload, and I'm using the
com.oreilly.servlet.multipart.MultipartParser class to parse the posted
data (in cos.jar). However, when I call the constructor for MultipartParser, I get this
exception:
java.io.IOException: Corrupt form data: premature ending
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:166)
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:94)
Has anyone seen this before? From what I read, this means that the
data ended before it found the boundary it was looking for. How can I
fix this?
I am using cos.jar version 1.0.
Thanks!
http://www.servlets.com/cos/faq.html
This indicates there was a problem
parsing the POST request submitted by
the client. There can be many causes
for the problem:
The client hit the STOP button (not really a problem, but it does cause a
premature ending)
A bug in the web form
A bug in the servlet
A bug in the web server
A bug in the browser
A bug in the com.oreilly.servlet library itself
History has shown the web server to be
the most frequent cause of problems
probably because there are so many
different servers and few vendors
appear to test their binary upload
capability.
First, make sure your client isn't
hitting the STOP button. Then, check
if your problem is already posted on
the "Servlet bugs you need to know
about" resource on this site. If it's
not well known, then you get to be
among the first to learn about it! And
you can share your discovery with us
here!
Second, see if the upload works using
the provided upload.html form and
DemoRequestUploadServlet.java class.
Some people have found bugs in their
form that caused problems. Testing
this combination will see if that's
the case. One user, Duke Takle, found
this exception was caused by a
redirect: I was experiencing the same
"premature ending" as Albert Smith.
What I've found is that the problem
was isolated to I.E. 5.0. The
application that troubled me was doing
a redirect after the construction of a
MultipartRequest. It looks like this
construction went well except on I.E.
5.0 the browser attempted to make the request again and by that time the
ServletInputStream was empty. I've
modified the application to simply
write the needed response instead of
redirecting. This problem was observed
and fixed as described in Tomcat 4.0
and Weblogic 6.1. Other users have
found bugs in their handling servlet
where they call request.getParameter()
instead of
multipartRequest.getParameter(), and
some servers falsely read the input
stream when their getParameter() is
called causing an "unexpected end of
part".
So, the problem was caused by me calling the MultipartParser constructor twice, by accident. It failed the second time, since the request had already been processed.