Sridhar Gollapalli

Greenhorn
+ Follow
since Sep 14, 2006
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 Sridhar Gollapalli

Hi All,
<br>
Please help me
<br><br><p>
My requirement is to transfer file from server to server transfer using ftp, since files are located in one server and need to transfer to another server. I am using Apache commons net ftp to transfer files. My application resides in another third server. All the 3 servers(my application, files located server, destination location server) are linux boxes and using vsftp 2.0.1 version for ftp.
<br><p>
Since I am from j2ee background i have less idea on ftp.
I need to establish the client/server(2 servers) communication between two servers to transfer file, since my application resides in third server. I could connect to two servers and change to working directory. Problem is I am making one of the server (files located server) to listen the client (destination location server) by making passive command.

<br><br>
Below is output of small program
<br><br>


Connecting FTP1 55
<br>
220 (vsFTPd 2.0.1)
<br><br>
USER oracle9i
<br><br>
331 Please specify the password.
<br><br>
PASS oracle9i
<br><br>
230 Login successful.
<br><br>
Connecting FTP2 43
220 (vsFTPd 2.0.1)
<br><br>

USER oracle9i
<br><br>

331 Please specify the password.
<br><br>

PASS oracle9i
<br><br>

230 Login successful.
<br><br>

CWD /opt/oracle/cp360data/dev/fgr_manfacture
<br><br>

250 Directory successfully changed.
<br><br>

replyCode 1 : 250
CWD /cp360data/dev/rxpfs/SPAN/GISFEntity_TXT4/
<br><br>

250 Directory successfully changed.
<br><br>

replyCode 2 : 250<br>
PASV
<br><br>

227 Entering Passive Mode (192,168,21,43,52,77)
<br><br>

FtpClient2 is in Passive mode<br>
FtpClient2 Host : /192.168.aa.bb<br>
FtpClient2 Port : 13389<br>
FtpClient1 is entering RemoteActive Port : <br>
PORT 192,168,21,43,52,77<br>
<br><br>

500 Illegal PORT command.
<br><br>

FtpClient1 is entering RemoteActive : <br>
FtpClient1 is NOT in Active mode<br>
FtpClient1 Remote verification : true<br>
FtpClient2 Remote verification : true<br>
Couldn't initiate transfer. Check that filenames are valid.<br>
250<br>
Disconnecting FTP1<br>
Disconnecting FTP2<br>
Finished FTP

<br><br>
Below code
<br>
public void ftping(){<br>
FTPClient ftpClient1 = new FTPClient();<br>
FTPClient ftpClient2 = new FTPClient();<br>
ProtocolCommandListener listener;<br>
try{<br>
listener = new PrintCommandListener();<br>
ftpClient1.addProtocolCommandListener<br>(listener);<br>
ftpClient2.addProtocolCommandListener(listener);<br>

System.out.println("Connecting FTP1 55");<br>
ftpClient1.connect("192.168.aa.bb");<br>
ftpClient1.login("user", "pwd");<br>
if (!FTPReply.isPositiveCompletion(ftpClient1.getReplyCode())) {<br>
String errMsg = "User : oracle9i could not connect. FTP server refused connection.";<br>
System.out.println(errMsg);<br>
}<br>

System.out.println("Connecting FTP2 43");<br>
ftpClient2.connect("192.168.cc.dd");<br>
ftpClient2.login("user1", "pwd");<br>
if (!FTPReply.isPositiveCompletion(ftpClient2.getReplyCode())) {<br>
String errMsg = "User : oracle9i could not connect. FTP server refused connection.";<br>
System.out.println(errMsg);<br>
}<br>


String fromPath = "/opt/oracle/cp360data/dev/fgr_manfacture";<br>
String toPath = "/cp360data/dev/rxpfs/SPAN/GISFEntity_TXT4/";<br>
//String filePath = "GISFEntity_TXT5";<br>
String file1 = "GISF_20070327-1432.XML";<br>
String file2 = "GISF_20070327-1432.XML";<br>



int replyCode = ftpClient1.cwd(fromPath);<br>
System.out.println("replyCode 1 : "+replyCode);<br>
if (!FTPReply.isPositiveCompletion(replyCode)) {<br>
String errMsg = "Could not change to directory : "
+ fromPath;<br>
System.out.println(errMsg);<br>
}<br>

int replyCode2 = ftpClient2.cwd(toPath);<br>
System.out.println("replyCode 2 : "+replyCode2);<br>
if (!FTPReply.isPositiveCompletion(replyCode2)) {<br>
String errMsg = "Could not change to directory : "
+ toPath;<br>
System.out.println(errMsg);<br>
}<br>

_main: <br>
try{<br>
boolean isPassive = ftpClient2.enterRemotePassiveMode();<br>
boolean isActive = false;<br>

if(isPassive){<br>
System.out.println("FtpClient2 is in Passive mode");<br>
System.out.println("FtpClient2 Host : "+ftpClient2.getPassiveHost());<br>
System.out.println("FtpClient2 Port : "+ftpClient2.getPassivePort());<br>
System.out.println("FtpClient1 is entering RemoteActive Port : ");<br>
isActive = ftpClient1.enterRemoteActiveMode(InetAddress.getByName(ftpClient2.getPassiveHost()), ftpClient2.getPassivePort());<br>
if(isActive)<br>
{<br>
System.out.println("FtpClient1 is in Active mode");<br>
}<br>
else<br>
{<br>
System.out.println("FtpClient1 is NOT in Active mode");<br>
}<br>
System.out.println(" FtpClient1 Remote verification : "+ftpClient1.isRemoteVerificationEnabled());<br>
System.out.println(" FtpClient2 Remote verification : "+ftpClient2.isRemoteVerificationEnabled());<br>
}<br>
else<br>
{<br>
System.out.println("FtpClient2 is NOT in Passive mode");<br>
}<br>

/*boolean remoteRet = ftpClient1.remoteRetrieve(file1);<br>
boolean remoteStore = ftpClient2.remoteStoreUnique(file2);<br>
ftpClient1.completePendingCommand();<br>
ftpClient2.completePendingCommand();<br>

System.out.println("FtpClient1 remote Retrive "+remoteRet);<br>
System.out.println("FtpClient2 remote Store "+remoteStore);*/<br>

if (ftpClient1.remoteRetrieve(file1) && ftpClient2.remoteStoreUnique(file2))
{<br>
System.out.println("File Transferring ...");<br>
//if(ftp1.remoteRetrieve(file1) && ftp2.remoteStore(file2)) {<br>
// We have to fetch the positive completion reply.<br>
ftpClient1.completePendingCommand();<br>
ftpClient2.completePendingCommand();<br>
}<br>
else<br>
{<br>
System.out.println("Couldn't initiate transfer. Check that filenames are valid.");<br>
break _main;<br>
}<br>
} catch(Exception e){<br>
<br>
}<br>






System.out.println(replyCode);<br>
System.out.println("Disconnecting FTP1");<br>
ftpClient1.disconnect();<br>
System.out.println("Disconnecting FTP2");<br>
ftpClient2.disconnect();<br>
System.out.println("Finished FTP");<br>



} catch(Exception e){<br>
System.out.println("Exception Occured");<br>
if (ftpClient1.isConnected())<br>
{<br>
try
{<br>
ftpClient1.disconnect();<br>
}<br>
catch (IOException f)<br>
{<br>
// do nothing<br>
}<br>
}<br>
if (ftpClient2.isConnected())<br>
{<br>
try<br>
{<br>
ftpClient2.disconnect();<br>
}<br>
catch (IOException f)<br>
{<br>
// do nothing<br>
}<br>
}<br>
System.out.println("Error : "+e);<br>
}<br>
}<br>

<br><br>
Please help me in setting configurations at vsftp side.
Hi Everybody,

In my application, I am uploading a file by using struts upload. My application configuration is Weblogic 8.1 sp2 and jdk 1.4. I am getting 2 errors when uploading the file

1) org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. EOF after reading only: '0' of: '1477' promised bytes, out of which at least: '0' were already buffered
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:429)
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:233)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)

2) org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Read timed out
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:429)
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:233)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1209)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)

This actually application server throws before it goes to Action class.

Can any body please suggest us what need to be done. I can not even catch the exceptions and user who uploaded thinks that file is uploaded. Can any body please help for this.

I really appreciate for the help.

Thanks in Advance.

Sriha
17 years ago
Hi Cameron,

I really appreciate for your reply. As i said, we are using the spring framework, so we are defining the datasource in application-context.xml(Spring config file).

I am using Web Sphere Admin Console to deploy war file. The war file is generated by eclipse.

I dont have any deployment problems. Server Started fine with out any errors. But we access the index.jsp, then it is reporting the above error in Server1_exception.

We are not using JNDI, since spring provides the DataSource object to access the DB.

I have no idea about the dumpnamespace utility. Thanks for your help.

Thanks In Advance,

Sridhar
17 years ago
Hi All,

We are migrating Tomcat V5.0 to Web Sphere Application Server V 6.0. I have successfully deployed and started with out any error. But When I trying to access the index.jsp page, it is showing blank page.

Application Details :

Struts
Spring
DAO
WS App Server V6.0
DB2 Data Base V 8.2


SystemOut log file shows no error. But the Server1_Exception shows the below error.

Index Count Time of last Occurrence Exception SourceId ProbeId
------+------+---------------------------+--------------------------
1 1 06.09.14 11:48:01:438 ICT javax.naming.NameAlreadyBoundException com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_bind_new_corba_context 1042------+------+---------------------------+--------------------------
+ 2 1 06.09.14 11:48:01:453 ICT org.omg.CosNaming.NamingContextPackage.AlreadyBound com.ibm.ws.naming.jndicos.CNContextImpl.doCreateSubcontext 2155
+ 3 1 06.09.14 11:48:01:469 ICT javax.naming.NameAlreadyBoundException com.ibm.ws.naming.jndicos.CNContextImpl.createSubcontext 756
+ 4 1 06.09.14 11:48:04:234 ICT org.omg.CosNaming.NamingContextPackage.NotFound com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.bind_new_corba_context 944
+ 5 1 06.09.14 11:48:04:250 ICT org.omg.CosNaming.NamingContextPackage.NotFound com.ibm.ws.naming.jndicos.CNContextImpl.doCreateSubcontext 2161
+ 6 1 06.09.14 11:48:04:266 ICT javax.naming.NameNotFoundException com.ibm.ws.naming.jndicos.CNContextImpl.createSubcontext 756
+ 7 1 06.09.14 11:48:04:453 ICT javax.naming.NameNotFoundException com.ibm.ws.naming.urlbase.UrlContextImpl.lookup 1226
+ 8 1 06.09.14 11:48:04:469 ICT javax.naming.NameNotFoundException com.ibm.ws.naming.urlbase.UrlContextImpl.lookup 1252
+ 9 1 06.09.14 11:48:04:484 ICT javax.naming.NameNotFoundException com.ibm.ws.wsgw.component.WSGWComponent.startWorkArea 166
+ 10 1 06.09.14 11:48:15:094 ICT java.lang.ClassNotFoundException com.ibm.ws.classloader.CompoundClassLoader.loadClass 248

Strange thing i could not figure out what is the problem. I am struggling to find out the problem. I will be glad, if any one throws some light on this.

Please help me.

I really appreciate for your reply.

Thanks In Advance,
Sridhar
17 years ago