Friday, June 21, 2013

How to Run Maven Project as Dynamic Web Project in Eclipse

1. Convert Maven Project into Dynamic Web Project: 
Right click > Configure > Convert to Faceted Form image

2. Add Maven dependencies into classpath:
Right click > Properties > Deployment Assembly > Add > Java Build Path Entries > Maven Dependencies > Finish > Apply > Ok
This error will persist if Maven dependencies is not properly added to the project classpath

SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Note:
1. In case, some of JavaScrips files may cause JavaScript warnings, they can be turned off by excluding (ignoring) from Eclipse JavaScript plugin: Right click > Properties > JavaScript > Include Path > Excluded > Edit
2. In case, Tomcat is used as run time server and this error is shown

Stacktrace:] with root cause org.apache.jasper.JasperException: Unable to compile class for JSP:... 

The solution can be: add javax.servlet.jsp-api to Maven pom.
3. If this error is shown:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Solution: Project > Clean > Build All (may more than one time).

Friday, June 14, 2013

How to Use MySQL Workbench behind proxy/firewall

In this tutorial, the ssh session and workbench are configured to connect to MySQL instance provided by AmazonWS.
 
1. Make sure you have tunneling server you can ssh via port 443 or 80 (In most cases, only these two outbound ports are allowed go through corporate firewall/proxy).
2. Configure the putty ssh session for tunneling in order use MySQL Workbench to connect to the remote MySQL DB server
2.1. Shh session







Note:
 2.3. Connection > Proxy

 Note: port 3128 is used for this tutorial; for your case, you need to check your corporate proxy server port for the correct one.

2.3. SSH > Tunnels
 
 Note:

3. Configure MySQL Workbench to connect the DB server via the putty ssh session

Note: in this tutorial, the workbench is configured to connect to MySQL instance provided by AmazonWS.
Extra: this tunnel can be used to connect the DB in java code as follows:


Note: