Madhu Kaparapu

Ranch Hand
+ Follow
since Jul 04, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Madhu Kaparapu

Hi,

We have a custom Servlet Engine (Similar to Tomcat) which has configurable numbers of "Worker Threads" to handle HTTP request. The issues here is, this engine hangs if the "Worker Threads" are BLOCKED for long time. So I wanted to interrupt these "Worket Threads".

When I took the thread dump with "jstack <pid>" will give the all the Worker Thread's name, address, tid , nid, and state. So, having these thread info can we build thread object to interrupt blocked threads and any other approach to interrupt BLOCKED threads.

Please suggest your thoughts.

Thanks,
Madhu K.
Hi Team,

I have a service/thread which reads the xml data from the given RSS XML feed URL and writes to a file. This service got hangs sometime twice in a week and by looking at the jstack process dump it seems a thread lock appears during the RSS xml Feed URL connection for getting XML feed data.

Please see the below jstack information:

"Thread-3" prio=10 tid=0x08264400 nid=0x207b runnable [0x8bf99000..0x8bf99e20]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
- locked <0xb1955e28> (a java.io.BufferedInputStream)
at sun.net.www.http.ChunkedInputStream.fastRead(ChunkedInputStream.java:221)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:662)
- locked <0xb1958b00> (a sun.net.www.http.ChunkedInputStream)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2391)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
- locked <0xb194a228> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
- locked <0xb194a228> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at com.xxx.util.XMLResponseReadAndWrite.getResponse(XMLResponseReadAndWrite.java:44)
at com.xxx.AggregationProcess.run(AggregationProcess.java:132)
at java.lang.Thread.run(Thread.java:619)

Each time i have to kill the process manaully... . Please find the attached full jstack dump and help in trouble shooting this issue.

15 years ago
When I click on the image form element
<INPUT type=image name=mapImg src="/images/map.png">
mapImg.x and mapImg.y values get submitted to the server
specifying where on the image I have clicked.

Is there any way, not to send/submit x and y coordinates to server (and prevent that from happening)?

Regards,
Madhu K
Set your array list object to request object with a unique name as shown below. And using requestdispatcher you can forward this attribute (ie arraylist object) to desired jsp page. At jsp page your access that attribute and display the information.

request.setAttribute("arraylist",yourArrayListObject);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(<<myPage.jsp>> ;
dispatcher.forward(request, response);
17 years ago
Hai

I want to convert txt file to postscript file
I have tried with following code but "No suitable factories" are available it displays. Can any one help me how to convert txt file to postscript using
javax.print api or any other api



public class PrintTexttoSream {

public static void main(String args[]) {

/* Use the pre-defined flavor for a Text from an InputStream */
DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII;
System.out.println(flavor.getMimeType());

/* Specify the type of the output stream */
String psMimeType = DocFlavor.INPUT_STREAM.POSTSCRIPT.getMimeType();
System.out.println(psMimeType);

/* Locate factory which can export a text stream as Postscript */
StreamPrintServiceFactory[] factories =
StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor, psMimeType);

if (factories.length == 0) {
System.err.println("No suitable factories");
System.exit(0);
}

try {
/* Load the file */
FileInputStream fis = new FileInputStream("E:\\temp\\ReadMe.txt");
/* Create a file for the exported postscript */
String filename = "E:\\temp\\ing1txt.ps";
FileOutputStream fos = new FileOutputStream(filename);

/* Create a Stream printer for Postscript */

StreamPrintService sps = factories[0].getPrintService(fos);

/* Create and call a Print Job for the Text */
DocPrintJob pj = sps.createPrintJob();
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new Copies(2));
aset.add(MediaSizeName.ISO_A4);
aset.add(Sides.TWO_SIDED_LONG_EDGE);
aset.add(Finishings.STAPLE);

Doc doc = new SimpleDoc(fis, flavor, null);

pj.print(doc, aset);
System.out.println("Successfully converted to postscript");
fos.close();

} catch (PrintException pe) {
System.err.println(pe);
} catch (IOException ie) {
System.err.println(ie);
}
}
}
18 years ago
I have to develop an appplication which uploads rtf,word,excel file and i need to convert all formats to pdf.
can anyone help me in how i can write the code using JAVA.IT is very urgent

I have seen jakarta poi (which does the excel java api) and then apache fop or itext library for the pdf creation.

is there any direct library which converts pdf ??
18 years ago
Hai
i would like to know the difference between Applet and JApplet?
18 years ago
<%@page import="package.package1.yourClass" %>
<%
<yourClass> obj = new YourClass();
obj.method1();
'
'...
%>
18 years ago
JSP
What to do, to get browser compatible with swing components?
18 years ago
Hai
I have a CustomerManagement jsp page which consists customer details, primary address, billing address and credit card address these are the three sections in a CustomerManagement jsp page so i have to set these form variable to bean
i have two ways for it:-
1) write String array in bean for all address variable except customer details and assume that first field is for primary address and second field for billing address and third for credit card address

say: private String[] streetno;
private String[] streetname;
private String[] buildingtype;
private String[] zip; ....

2) writing CustomerBean for customer details and AddressBean for address section, but here how can set the form variable to AddressBeans.
we have to create three instance of AddressBeans for the corresponding address sections and set the corresponding values to the beans

i am in confusion which one is better or any other way to do it;
18 years ago
JSP
Hai
Sorry for the mistake leave the earlier topic;

I have to show all the database in oracle
in Mysql we have the query that shows all the databases
mysql> show databases;
like that i have to list all the databases in oracle
i don't know the query please let me know
18 years ago
Hai
I have to show all the databases present in OracleDatabase;
i don't know the syntax or query to get this
18 years ago
What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface?
Explain me with suitable example

Regards
Madhu Kumar
18 years ago
Here is the code snippet that will authnticate for usename and password

Session session = Session.getDefaultInstance(props, null);

// Get the store
Store store = session.getStore("pop3");

// Connect to store
store.connect(host, username, password);

// Get folder
Folder folder = store.getFolder("INBOX");

but my program can't able to find the host which i am giving; i have to tell
yuu search through the given proxy ip address for the given host address
18 years ago
Hai to all
I have to retrive list of message from gmail,rediffmail etc,. using pop3 and display the ID and Subject
I am connecting the internet through proxy I can able to send the message,
also retrive the list of message from local mail server but i am not able to retrive messages from gmail,rediffmail etc,. through proxy my program cannot able to find gmail.com or rediffmail.com
I don't know how to set the proxy ip and port to the properties

give the possible solution please
18 years ago