Tom Rispoli

Ranch Hand
+ Follow
since Aug 29, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Tom Rispoli

Environment:
Solaris11 OS
Glassfish 2.1.1 app server
struts2 framework
A 2-way compression filter is used

Problem:
When requests are sent to the application I work on, it appears that occasionally the body of the POST request is lost. I am lead to believe this because I get reports of errors that generate stack traces that all fail the at the first line of code for the action that relies on the existence of a required request parameter. This appears to happen on multiple (probably all) actions that the application handles. The problem only seems to occur once every few thousand requests or so. In an attempt to narrow down the problem I put some logging into one of the actions that is kicked off if the first required request parameter is null. In this method I attempt to log any relevant values from HttpServletRequest object, all of the http request header, all of the http request parameters, and I try to read the request as a file and write it out to the log file (although I'm not sure I'm doing that right). When I do this, what I see in the log file is that there are no request parameters but the content length is around 20K - 25K. I'm confident that the code that I wrote to write out the request parameters is correct as it works correctly when I try use it with requests that contain data. The code I wrote to write out the request read from a file doesn't seem to work, I've tried different variations but it looks something like this:



Even when there is data in the request, this just writes out:

Starting content:
-1
ending content

I realize this isn't a lot to go on, but I'm not sure where to go with this from here. Does anyone have any ideas on this or suggestions on how to better diagnose the problem? I assume the content-length was computed by the browser and sent in the header, so feel like the fact that I have no parameters indicates that either the content didn't reach the server or that it got garbled along the way (maybe a problem with decompression or decryption?) to the point where glassfish couldn't parse it into request parameters. Let me know if you have any ideas.

Thanks,
Tom
11 years ago
Posting the full stacktrace of the error message might help.
13 years ago
If I understand your problem correctly, you are using the same action class for all of your events, but you are returning a different result for each event and using the struts.xml file to control which directory's JSP the application uses to display the data. If this is correct, then you maybe be able to solve your problem by having a single result that your action class uses any time it completes successfully. This result will go to a JSP that has a jsp:include tag in it that gives control to the correct JSP. I've never put anything dynamic in the "page" attribute of a jsp:include, so I'm not exaclty sure what your options are. I doubt you can use s:property tag, EL might work, if all that fails, you could write a scriptlet (shame on me for saying that).

Alternatively, I you want to automatically update the struts.xml file, I think you can reload it with:

Dispatcher.getInstance().getConfigurationManager().getConfiguration().rebuildRuntimeConfiguration();

I've never done this, but if that works better for you, you might want to give it a try.
13 years ago
I think it may be finding your struts.xml file but the app is having trouble loading it. This could be a problem with permissons or an error in your .xml file. Is there any more information in your log about this? Like an error stack?
13 years ago
It would help if you could be more detailed in what you are talking about. I still have no idea what batch files you are talking about. What are the names of these files? Where are they located? When are you using them?
13 years ago
You are correct, both JSP and and form are part of the view layer, however, the intent of the form is normally to serve as a conduit to move data between the MVC layers. Putting HTML into it is normally inappropriate as this is what JSPs are designed to do. It is easier to maintain html in a JSP than it is in a java class. If you have some repetitive HTML work to do, and there is no custom tag in struts for it, you may want to write your own custom tag. I don't know the intent of the html you are writting, but I think its likely that you want to put it in your JSP rather than in your form.
13 years ago
You can't bypass giving "control" to your web.xml, your web.xml should be where you specified your servlet that runs your struts app. Are you sure you have the filter configured correctly? Posting your web.xml and the URL that the server is processing might help. Also, posting the code for your filter might help as well. Once you send your request to the other app, are you continuing with the filter chain? If so then it will probably still run the initial app.
13 years ago
There are no custom tags in struts to let you call a method in your form that I know of. You can write a scriptlet to do it though (although that should be avoided). Why do you need to call a method in your form class to "return dynamic HTML text"? It sounds likely that you have "View" code written in your "Model" class which is something you should usually avoid in an MVC framework.
13 years ago
what batch files are you refering to?
13 years ago
It sounds like you gone back to your earlier problem where you are trying to put a value into the first bind variable in a prepared statement but the prepared statement doesn't have any bind variables.

after this line:

psat=conn.prepareStatement("update ams_login set password='?' where loginname='?';");

try putting in some code to write psat.toString() to your log file, I wonder if the statement isn't being created correctly.

I'm not exactly sure what this will print out, but I read that postgres should write out the text of your prepared statement.

Let us know what it shows.
13 years ago
My questions from my previous post still apply. All we really know is that you are trying to use a reference that is null on line 49. Can you determine which variable on line 49 is null and why?
13 years ago
Can you post the full stack trace exception message?
13 years ago
Ok, at first glance the config looks right too. Can you put some logging into your action class after

dtList=loadDomainType;

to verify that dtList is actually being populated with some values?
13 years ago
At first glance this looks right, how are you calling the loadDomainType method in your action class? Can you please show the code or config that is doing it? Have you verified that it is getting called?
13 years ago
Call getStack() on the ActionInvocation object that is passed into the intercept() method of your interceptor.
13 years ago