Tuesday, March 15, 2016

How to change an existing Java application to dynamic web application in Eclipse and deploy it to tomcat server?

I have an old application to enhance and want to convert it into dynamic web application in Eclipse.

1. Open the java application in eclipse. Right click on the project name, and then choose "properties".




2. Choose Project Facets on the left side. On the right side, check "Dynamic Web Module" and "Java" box. Then click OK button.



3. Now this project is a dynamic web project.

4. Deploy the application to local tomcat server. Go to properties again as step 1.

Choose Deployment Assembly on the left side, then in the right side, add the real source directory and deploy path. Then click ok.


5. Add web module into tomcat 8 server.
Right click the Tomcat server and choose Add and Remove, the in the pop up window, add left side application to the right side. Now we can restart tomcat server, the new application will be deployed to the server side and run.



Thursday, March 3, 2016

WSO2 ESB ERROR - ClientUtils The system cannot infer the transport information

After I tested my proxy service in ESB, I got the following error when it tried to save the message into a file.

ERROR - ClientUtils The system cannot infer the transport information from the vfs:file:///C:/Temp URL.  

The source code I am using is as below:

 <?xml version="1.0" encoding="UTF-8"?>  
 <sequence name="saveToFS" trace="disable" xmlns="http://ws.apache.org/ns/synapse">  
  <property  
   expression="fn:concat(get-property('SYSTEM_DATE', 'yyMMddHHmmss'), '-', get-property('filename'), '.xml')"  
   name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>  
  <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>  
  <call>  
   <endpoint>  
    <address trace="disable" uri="vfs:file:///c:/Temp"/>  
   </endpoint>  
  </call>  
  <log level="custom">  
   <property name="msg" value="File Saved to Disk"/>  
  </log>  
 </sequence>  

After research, I found the error is I need to enable vfs transport in the configuration file.
I enabled the following lines in wso2esb-4.9.0\repository\conf\axis2\axis.xml file. Then it works.

  <transportReceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener"/>  
 ......  
 <transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/>