randal alan

Greenhorn
+ Follow
since Jun 14, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by randal alan

That is the line that is in question. I know it should be uploadForm.getFile1() but how do I get the others?

Is it as simple as this:
FormFile inputFile1 = uploadForm.getFile1();
FormFile inputFile2 = uploadForm.getFile2();
FormFile inputFile3 = uploadForm.getFile3();

If so, then what if only one file is uploaded? Do I just check all to see if they are null and pass on the one that is not null? I appologize if this is a very simple question. All the examples through google mentioned using a List or Collection.
18 years ago
URGENT!!!
Hello, can someone help me determine how to change my action class below to accept mulitple files being uploaded?

ACTION CLASS

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

ActionErrors errors = new ActionErrors();
ActionForward forward = new ActionForward(); // return value
UploadForm uploadForm = (UploadForm) form;

FormFile inputFile = uploadForm.getFile();
String fileName = inputFile.getFileName();


try {

MessageResources mr = getResources(request, "upload");

String location = mr.getMessage("location");
int max_size = NumberUtils.stringToInt(mr.getMessage("size"));

if (inputFile.getFileSize() > max_size) {
ActionErrors errors2 = new ActionErrors();
errors2.add(ActionErrors.GLOBAL_ERROR, new ActionError ("error.maxsize"));
saveErrors(request, errors2);
return mapping.findForward("failure");
}

InputStream inputStream = inputFile.getInputStream();

byte[] fileContents = new byte[inputFile.getFileSize()];
inputStream.read(fileContents);
File outputFile = new File (location + fileName);
FileOutputStream fos = new FileOutputStream(outputFile);
fos.write(fileContents);
fos.close();

} catch (FileNotFoundException e) {
e.printStackTrace();

ActionErrors errors2 = new ActionErrors();
// Report the error using the appropriate name and ID.
errors2.add(ActionErrors.GLOBAL_ERROR, new ActionError ("error.io"));
saveErrors(request, errors2);
return mapping.findForward("failure");
}

catch (IOException e) {
e.printStackTrace();

ActionErrors errors2 = new ActionErrors();
// Report the error using the appropriate name and ID.
errors2.add(ActionErrors.GLOBAL_ERROR, new ActionError ("error.io"));
saveErrors(request, errors2);
return mapping.findForward("failure");

}

return mapping.findForward("success");

}
}


ACTION FORM

public class UploadForm extends ActionForm

{

private FormFile file1 = null;

private FormFile file2 = null;

private FormFile file3 = null;

/**
* Get file1
* @return FormFile
*/
public FormFile getFile1() {
return file1;
}

/**
* Set file1
* @param <code>FormFile</code>
*/
public void setFile1(FormFile f) {
this.file1 = f;
}

/**
* Get file2
* @return FormFile
*/
public FormFile getFile2() {
return file2;
}

/**
* Set file2
* @param <code>FormFile</code>
*/
public void setFile2(FormFile f) {
this.file2 = f;
}

/**
* Get file3
* @return FormFile
*/
public FormFile getFile3() {
return file3;
}

/**
* Set file3
* @param <code>FormFile</code>
*/
public void setFile3(FormFile f) {
this.file3 = f;
}

public void reset(ActionMapping mapping, HttpServletRequest request) {

// Reset values are provided as samples only. Change as appropriate.

file1 = null;
file2 = null;
file3 = null;

}

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();
// Validate the fields in your form, adding
// adding each error to this.errors as found, e.g.

// if ((field == null) || (field.length() == 0)) {
// errors.add("field", new org.apache.struts.action.ActionError("error.field.required"));
// }
return errors;

}
}
18 years ago
Hello, I need to write a secure FTP client for windows and AIX using the FTPS protocol (not SFTP). I have a regular FTP client but it now needs to implement FTPS. I've read many of the postings so far but none seem to address my needs. I'm looking for open source Java code. What are the java APIs needed? The current code uses the unsupported sun.net.ftp package but I don't think they have a sun.net.ftps package. Has anyone tried this before?

I found a post on javaranch but the link is bad.

https://coderanch.com/t/326488/java/java/FTPS-Library

Please help....
I receive a Stale connection when I try to start WAS4.0 FP5 with efix. The server that I am using was working just fine before we changed the IP address of the machine and the IP address of the URL that points to the ORacle DB. I can not get into the Admin client console now to fix it. I hear that you can edit a particular file but I do not know what file to edit. PLEASE HELP!!!
************ Start Display Current Environment ************
WebSphere AE 4.0.5 ptf50246.04 running with process name localhost/__adminServer and process id 5199
Host Operating System is Linux, version 2.4.18-3
Java version = J2RE 1.3.1 IBM build cxia32131w-20021107 ORB130 (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM
server.root = /opt/WebSphere/AppServer
Java Home = /opt/WebSphere/AppServer/java/jre
ws.ext.dirs = /opt/WebSphere/AppServer/java/lib:/opt/WebSphere/AppServer/classes:/opt/WebSphere/AppServer/lib:/opt/WebSphere/AppServer/lib/ext:/oracleJDBC//jdbc/lib/classes12.zip:/oracleJDBC//jdbc/lib/nls_charset12.zip
Classpath = /opt/WebSphere/AppServer/properties:/opt/WebSphere/AppServer/lib/bootstrap.jar
Java Library path = /opt/WebSphere/AppServer/java/jre/bin:/opt/WebSphere/AppServer/java/jre/bin/classic:/opt/WebSphere/AppServer/java/jre/bin:/opt/WebSphere/AppServer/java/jre/bin/classic:/opt/WebSphere/AppServer//bin:/opt/WebSphere/AppServer//lib::/home/db2inst1/sqllib/lib:/usr/lib
Current trace specification = *=all=disabled
************* End Display Current Environment *************
[6/25/03 20:37:57:655 CEST] 67d5006c Server U Version : 4.0.5
[6/25/03 20:37:57:657 CEST] 67d5006c Server U Edition: Advanced Edition for Multiplatforms
[6/25/03 20:37:57:666 CEST] 67d5006c Server U Build date: Fri Nov 22 00:00:00 CET 2002
[6/25/03 20:37:57:666 CEST] 67d5006c Server U Build number: ptf50246.04
[6/25/03 20:37:58:076 CEST] 67d5006c ORBRas W com.ibm.CORBA.iiop.Util Util P=277798 =0:CT JORB0012: Pass by reference has been set to: true (NoLocalCopies = true)
[6/25/03 20:38:04:212 CEST] 67d5006c ConnectionPoo X CONM6009E: Failed to get connection to the database from datasource (DBMgr).
[6/25/03 20:38:04:219 CEST] 67d5006c StaleConnecti A CONM7007I: Mapping the following SQLException, with ErrorCode 17,002 and SQLState <null>, to a StaleConnectionException: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:361)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
at java.sql.DriverManager.getConnection(DriverManager.java:543)
at java.sql.DriverManager.getConnection(DriverManager.java:194)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:117)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:98)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
at com.ibm.ejs.cm.pool.JDBC1xConnectionFactory.createConnection(JDBC1xConnectionFactory.java:42)
at com.ibm.ejs.cm.pool.ConnectionPool.createConnection(ConnectionPool.java:1077)
at com.ibm.ejs.cm.pool.ConnectionPool.createOrWaitForConnection(ConnectionPool.java:983)
at com.ibm.ejs.cm.pool.ConnectionPool.findFreeConnection(ConnectionPool.java:921)
at com.ibm.ejs.cm.pool.ConnectionPool.findConnectionForTx(ConnectionPool.java:789)
at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:723)
at com.ibm.ejs.cm.pool.ConnectionPool.getConnection(ConnectionPool.java:322)
at com.ibm.ejs.cm.DataSourceImpl$1.run(DataSourceImpl.java:135)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:133)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:102)
at com.ibm.ejs.sm.util.db.DBMgr.initialize(DBMgr.java:206)
at com.ibm.ejs.sm.server.AdminServer.initializeConnectionManager(AdminServer.java:1178)
at com.ibm.ws.runtime.Server.initializeRuntime0(Server.java:945)
at com.ibm.ejs.sm.server.ManagedServer.initializeRuntime0(ManagedServer.java:408)
at com.ibm.ejs.sm.server.AdminServer.initializeRuntime0(AdminServer.java:1147)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:884)
at com.ibm.ejs.sm.server.AdminServer.main(AdminServer.java:401)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
[6/25/03 20:38:04:261 CEST] 67d5006c DBMgr F SMTL0026E: Failure to create a data source: com.ibm.websphere.ce.cm.StaleConnectionException: Io exception: The Network Adapter could not establish the connection
at java.lang.reflect.Constructor.newInstance(Native Method)
at com.ibm.ejs.cm.portability.PortabilityLayerImpl.translateException(PortabilityLayerImpl.java:263)
at com.ibm.ejs.cm.portability.PortabilityLayerImpl.translateException(PortabilityLayerImpl.java:155)
at com.ibm.ejs.cm.pool.ConnectionPool.createConnection(ConnectionPool.java:1090)
at com.ibm.ejs.cm.pool.ConnectionPool.createOrWaitForConnection(ConnectionPool.java:983)
at com.ibm.ejs.cm.pool.ConnectionPool.findFreeConnection(ConnectionPool.java:921)
at com.ibm.ejs.cm.pool.ConnectionPool.findConnectionForTx(ConnectionPool.java:789)
at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:723)
at com.ibm.ejs.cm.pool.ConnectionPool.getConnection(ConnectionPool.java:322)
at com.ibm.ejs.cm.DataSourceImpl$1.run(DataSourceImpl.java:135)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:133)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:102)
at com.ibm.ejs.sm.util.db.DBMgr.initialize(DBMgr.java:206)
at com.ibm.ejs.sm.server.AdminServer.initializeConnectionManager(AdminServer.java:1178)
at com.ibm.ws.runtime.Server.initializeRuntime0(Server.java:945)
at com.ibm.ejs.sm.server.ManagedServer.initializeRuntime0(ManagedServer.java:408)
at com.ibm.ejs.sm.server.AdminServer.initializeRuntime0(AdminServer.java:1147)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:884)
at com.ibm.ejs.sm.server.AdminServer.main(AdminServer.java:401)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
----- Begin backtrace for next
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:361)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
at java.sql.DriverManager.getConnection(DriverManager.java:543)
at java.sql.DriverManager.getConnection(DriverManager.java:194)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:117)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:98)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
at com.ibm.ejs.cm.pool.JDBC1xConnectionFactory.createConnection(JDBC1xConnectionFactory.java:42)
at com.ibm.ejs.cm.pool.ConnectionPool.createConnection(ConnectionPool.java:1077)
at com.ibm.ejs.cm.pool.ConnectionPool.createOrWaitForConnection(ConnectionPool.java:983)
at com.ibm.ejs.cm.pool.ConnectionPool.findFreeConnection(ConnectionPool.java:921)
at com.ibm.ejs.cm.pool.ConnectionPool.findConnectionForTx(ConnectionPool.java:789)
at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:723)
at com.ibm.ejs.cm.pool.ConnectionPool.getConnection(ConnectionPool.java:322)
at com.ibm.ejs.cm.DataSourceImpl$1.run(DataSourceImpl.java:135)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:133)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:102)
at com.ibm.ejs.sm.util.db.DBMgr.initialize(DBMgr.java:206)
at com.ibm.ejs.sm.server.AdminServer.initializeConnectionManager(AdminServer.java:1178)
at com.ibm.ws.runtime.Server.initializeRuntime0(Server.java:945)
at com.ibm.ejs.sm.server.ManagedServer.initializeRuntime0(ManagedServer.java:408)
at com.ibm.ejs.sm.server.AdminServer.initializeRuntime0(AdminServer.java:1147)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:884)
at com.ibm.ejs.sm.server.AdminServer.main(AdminServer.java:401)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
21 years ago
Not sure if this will help but here's some info regarding the ClassCastException. I hope this is useful.
Classloader Mode
Specifies whether the classloader searches in the parent classloader or in the application classloader first to load a class. The standard for JDK classloaders and WebSphere Application Server classloaders is PARENT_FIRST. By specifying PARENT_LAST, your application can override classes contained in the parent classloader, but this action can potentially result in ClassCastException or LinkageErrors if you have mixed use of overridden classes and non-overridden classes.
The options are PARENT_FIRST and PARENT_LAST. The default is to search in the parent classloader before searching in the application classloader to load a class.
21 years ago
I am trying to run two EAR files on a WAS 4 server and it has been very problematic. Are there any gotchas that I should be aware of for WAS 4 or 5. Thanks....
21 years ago
I took a class a few weeks ago and the professor kept speaking of this XP book. I haven't read the book yet but since there's thread for book listings I figured what the heck.....
Kent Beck. Extreme Programming Explained. Embrace Change. Addison Wesley 2000.
My experience with XP was by happenstance. It occurred at a customer site where a myself and a coworker from IBM Taiwan were required to gather requirements, help design and implement a solution within a weeks time. At the time, it appeared that the only way to accomplish the work within the allotted time was to split the work load, and constantly check that each other was headed in the right direction. What we noticed was that the more we "checked each other" the more we were able to flush out flaws and bugs effortlessly. By the end of the first day, we quickly decided that we would make better progress if we worked on the same thing together checking each other, instead of going opposite directions. We finished our project one day ahead of schedule and learned something about XP without even knowing it.
randala@us.ibm.com