PJ Crump

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

Recent posts by PJ Crump

I ask because there could be to solutions to the problem.. one via the usage of java technology and another if you implement database replication..
Also you would want to learn how to run an EXPLAIN on your query. Explains can aid you in determining how efficient the query is.
You never said what kind of database you are dealing with? Oracle, SqlServer, MySql, Db2???
I have a vendor application running on 5 servers in a WAS cluster. At cluster startup one of the nodes is designated dynamically as a Master JMS server.

What we have been seeing over time is that something is putting Large Objects on the JMS server, causing large uses of memory and longrunning GC's.

My question is, does anyone know how we can see the contents of this dynamically created JMS server?
14 years ago
I have a C++ program that has a pointer that is a reference to an image. I need to pass the pointer to a java program so that I can perform processing on the image. What I am finding is that calling C++ from Java is not a problem, but this has me stumped.. Does anyone have any examples of a C++ program calling Java??
[ September 17, 2007: Message edited by: PJ Crump ]
17 years ago
If you were using HttpClient then you would just say
httpClientInstance.getHostConfiguration().setProxy("proxyname");
18 years ago
I have been looking for an XML appender for log4j.. Anyone know of one out there?
[ February 07, 2006: Message edited by: PJ Crump ]
Since my initial post I attempted to wrap the request and make a copy of the stream so that I don't hit the error.. It works the first time getReader is called, however when it's passed into the doFilter method and the request finally gets to AXIS we have a problem. AXIS calls the getInputStream method and perhaps I screwed something up.. Here is the code..


public class GenericRequestWrapper extends HttpServletRequestWrapper {

HttpServletRequest origRequest;
byte[] reqBytes;
boolean firstTime = true;

/**
* @param arg0
*/
public GenericRequestWrapper(HttpServletRequest arg0) {
super(arg0);
origRequest = arg0;
// TODO Auto-generated constructor stub
}

public BufferedReader getReader() throws IOException {

if (firstTime) {
firstTime = false;
StringBuffer sbuf = new StringBuffer();
BufferedReader oreader = origRequest.getReader();
String line;
while((line = oreader.readLine()) != null) {
sbuf.append(line);
sbuf.append("\n\r");
}
reqBytes = sbuf.toString().getBytes();
}

InputStreamReader dave = new InputStreamReader(new ByteArrayInputStream(reqBytes));
BufferedReader br = new BufferedReader(dave);
return br;

}


public ServletInputStream getInputStream() throws IOException {

if (firstTime) {
firstTime = false;
StringBuffer sbuf = new StringBuffer();
BufferedReader oreader = origRequest.getReader();
String line;
while((line = oreader.readLine()) != null) {
sbuf.append(line);
sbuf.append("\n\r");
}
reqBytes = sbuf.toString().getBytes();
}

InputStreamReader dave = new InputStreamReader(new ByteArrayInputStream(reqBytes));

return an input stream..
}
}


*** Perhaps there is a problem w/ the input stream that I'm creating under the cover??
19 years ago
I have a servlet filter that sits in front of a webservice servlet (AXIS) - what I want the filter to do is to look at the content of the ServletRequest and if a particular string is located in the request, I want to call another service. Everything works just fine except (isin't there always an execept) that when I execute the following code in the filter:

BufferedReader inReader = request.getReader();
String line = null;
StringBuffer sbuf = new StringBuffer();
// Read the current request into a buffer

while((line = inReader.readLine()) != null) {
sbuf.append(line);
sbuf.append("\n\r");
}

if (sbuf.toString().indexOf("mystring") > -1) {
// I do some code
} else {
chain.doFilter(request, wrapper);
}


When I execute this code, at the chain.doFilter I get an "java.lang.IllegalStateException: getReader() has already been called for this request"

I know that this is because I obtained the Reader from the request. But my question is - How can I look at the request string so that I can evaluate it and not have this exception thrown..

Thx in advance...
[ October 05, 2005: Message edited by: PJ Crump ]
19 years ago
It never forwards the request to the 2nd server. The filter responds with the regular output. There is no exception that is thrown..
19 years ago
I have a soap message (axis) coming into a server. Because I don't
want to handle certain types of requests, I have created a servlet
filter to do the checking for me and to route the request to a <different> physical server. When the servlet filter kicks off
all is good until I try to redirect the request to the third server.
The redirect does not work. Here is the code from my filter..

....
//I check the request for the condition that I'm looking for
// if the condition exists, then i want to redirect this request to
another server..

HttpServletResponse servResp = (HttpServletResponse)response;
servResp.sendRedirect("http://otherserver:8080");
return;
...

Any ideas??
19 years ago
Running WAS 6.0 w/ IHS 2.x and the plugin.
How do I force the user to access my app thru the webserver and not through directly hitting the Websphere server? The plugin transport is encrypted (port 443) but that does not stop the user from pointing their browser at the App Server:443..

thx.
19 years ago
I have 1 file that has records in it and a directory that contains images (one image per data record).

I read the data record and then read the matching image and then merge them and create a new record that contains both. The issue is that when I write out the merged data and look at the image in a viewer it does not look right (it looks scrambled compared to the original)..

Basically, here is what I'm doing.. Got any hints??


Image image = Toolkit.getDefaultToolkit().getImage(dataRec.getPhotoFileName() );
ImageSizer.waitForImage(image);
int imageWidth = image.getWidth( null );
int imageHeight = image.getHeight( null );
if (imageWidth != maxImageWidth || imageHeight != maxImageHeight) {
System.out.println("Error image not sized correctly");
}


long length;
byte[] bytes = null;
InputStream is = null;

is = new FileInputStream(file);
length = is.available();

if (length > Integer.MAX_VALUE) {
throw new Exception("Error Converting File - File Too Large To Handle ("+file.getName()+"), length of file was "+length+" max allowable length is "+Integer.MAX_VALUE);
}

bytes = new byte[(int)length];

int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
}

if (offset < bytes.length) {
throw new IOException("Could not completely read file "+file.getName());
}


-- I then take the bytes and append them to the end of the output record..




byte[] bb = FiletoBytes.convert(dataRec.getPhotoFileName());

I then take the bytes and append them on to the end of the output record.
19 years ago
I inherited an app that uses MQ.jar to send and receive MQ messages to the mainframe. When I run transactions it seems as though there is some sort of polling time set so that records only come back to me every second (the code that pulls records off the respose queue is in a constant loop, w/ no waits).

Is there some sort of config parameter that controls how often records are available from the queue OR do I need to talk to our mainframe mq people?

Thanks - PJ
Save yourself a lot of time - use Struts..
19 years ago