Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Ajay Reddy

Ranch Hand
+ Follow
since Apr 08, 2005
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 Ajay Reddy

I spent the last four days trying to figure this one and finally someone told me about this --

When starting up your JVM specify this option "-Dfile.encoding=ISO-8859-1"
This did the trick for me. I know this is an old post but thought people looking for this thread would find an answer.
14 years ago
1. I like CVS.
2. I am not sure what that is.
The solution for this is to zip up all the files together. I can only think of this as solution.
Basically my question comes down to, how can I download multiple excel files into one big excel file. On my web page I show the user a bunch of excel files. By clicking on a link all the check boxes next to the files
get checked and should start downloading into one big file.
Hello friends,
I have an web application that shows some excel reports that users
can download from the ftp server. The number of reports users can
download can be anywhere from 1 to 25. As its painfull to download
each file at a time, I provided a link so that users can download
all the reports into one single excel file when they click this
link. But when I click on this link only one file (with multiple
work sheets) is downloaded and written to the excel file but does
not write the contents of other files. Here is my code (I tried to
format the code but could not) --

for (int i = 0; i < fileNames.size(); i++) {
ftp.connect(p.getSetupParameters("FTPSERVERNAME"));
ftp.login(p.getSetupParameters("FTPUSERNAME"),
p.getSetupParameters("FTPPASSWORD"));
fileName = fileNames.get(i).toString();
String fname = fileName.substring(fileName.lastIndexOf("/") + 1);

if (fileName.substring(fileName.lastIndexOf(".") +
1).toUpperCase().equals("ZIP")) {
ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
}
else if (fileName.substring(fileName.lastIndexOf(".") +
1).toUpperCase().equals("XLS")) {
ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
}
else {
ftp.setFileType(FTPClient.ASCII_FILE_TYPE);
}
ftp.changeWorkingDirectory(path);

InputStream is = ftp.retrieveFileStream(fname);
if (ftp.getReplyCode() != 550) {
Logger.log("INFO", this, "Successful File Retrieval");
}
else {
ftp.disconnect();
continue;
}
int x;
if (ftp.getReplyCode() != 550 && reportFormat.equals("XLS")) {
while ((x = is.read()) > -1) {
out.write(x);
}
is.close();
}
ftp.disconnect();
}
out.flush();
out.close();
}

Any help will be appreciated.

Thanks,
Ajay
Login to the weblogic console and check the DB Connection Pool size. If the pool max. size has reached this behaviour is noticed. Try to increase if it does.
16 years ago
HttpSession class has a method called getMaxInactiveInterval(). You can get the session timeout interval.
16 years ago
Implement HttpSessionBindingListener interface. When ever the session times out the valueUnbound() method gets fired.

public class Connection implements HttpSessionBindingListener {

// implement what ever you like in this method when the session times out.
public void valueUnbound() {

}
}
16 years ago
Try using Struts Console. It will make life easier.
16 years ago
Here is a sample what I have done. Hope this helps.

/*
The main class that calls your implementation class.
*/
public class TimerTrigger extends Thread {

public TimerTrigger () {

long repeatTimer = 0;
Props prop = new Props();

repeatTimer = Long.valueOf(prop.getSetupParameters("REPORT_TIMER_REPEAT_SECONDS")).intValue();

Timer timer = new Timer();
timer.schedule(new ReportTask(), 0, repeatTimer);
}

public static void main (String[] args) {

TimerTrigger timerTrigger = new TimerTrigger();
Thread timerThread = new Thread(timerTrigger);
Logger.log("INFO", null, "Starting Timer Trigger Thread...");
timerThread.start();

try {
timerThread.join();
}
catch (InterruptedException e) {
DBLogger.log("ERROR", null, "Interrupted Exception Joining Timer Thread");
}
}
}

/*
Your implementation
*/
public class ReportTask extends TimerTask implements Runnable {

/* Implement your batch process here */
public void run() {

}
}
16 years ago
As far as I understand, the property file should not be part of the ear. It should be seperate and can be placed anywhere in your weblogic domain.
16 years ago
Okay now I know what CMS is, I did not know version control is called CMS.
16 years ago
I do not know what is CMS is but why do'nt you store the file path in a property file and then read the path from the property file.
16 years ago
I have the same problem. Basically the old war file is cached by weblogic even after deploying the old war file. I have to manually remove the cached war file. The work around is when deploying a new war, deploy it with a new name(like test.build#.war).
16 years ago
I do not follow the question, could you please explain a little more. Are you trying to run a job (i.e. like a batch process)? If that's the case then you can configure the class that does the job by setting it up as a startup class. When you login to the weblogic console you will see Startup and Shutdown under the section 'Your Deployed Resources'.
16 years ago