Friday, August 3, 2012

When clicking on a community page, liferay opens a download window instead of displaying portlet

Why liferay opens a download window instead of displaying portlet when you click on a particular page?

This problem occurs only when the page doesnt have any portlet or webcontent to display or the previous one is deleted/undeployed

try to add a portlet and access page, it works.

Wednesday, August 1, 2012

Debugging the dreaded "SEVERE: Error listenerStart" and "SEVERE: Error filterStart" tomcat error messages

Just a quick post that I hope might benefit others. If you have been developing web applications on tomcat for a while you have likely come the two error messages mentioned in the title.

SEVERE: Error listenerStart

Occurs when an exception is thrown in the contextInitialized method of a ServletContextListener

SEVERE: Error filterStart

Occurs when an exception is thrown in the init method of a Filter

Unfortunately by default, tomcat won't provide you with any details about the cause of the error. Infact it wont even tell you which filter or listener is failing. This can be big problem in applications of significant size that have many filters and listeners configured. Fortunately there is a solution. In your webapplication's WEB-INF/classes folder you can create a logging.properties file with the following contents

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

Now you will be presented with the stacktrace

Tuesday, May 8, 2012

How to remote debug Tomcat (JPDA) when server has multiple virtual hosts running


Running Tomcat with remote debugging enabled
  • deploy the application you need to debug as usually
  • start Tomcat by executing the catalina.bat script and providing the "jpda" argument 
(ex.: D:\Develtools\apache-tomcat-7.0.26\bin>catalina jpda start)

Then, all you need to do is to create a remote Java application in Eclipse through these few steps : 

1° Open the debug configurations 
2° Create a new Remote Java application : 


3° Specify the project you're debugging (in my example, I've configured remote debugging for one on my sample projects, named "Blog - Remote Tomcat debugging")
4° Specify the host on which the application to debug is deployed
5° Specify the port that is opened for debugging purpose (same as the one configured as JPDA_ADDRESS in the catalina.bat file from Tomcat)
6° Launch the Remote application by clicking on "Debug" 

At this point, you could set breakpoints wherever you want in the project's source code and if the code marked with your breakpoints is executed, the running thread will be suspended and you'll be able to watch variables' value, execute expression, and so on.

Thursday, January 12, 2012

Content Assist for xhtml pages

If you are reading this means your experiencing problem with content assist for xhtml pages.
First thing to have the content assist for xhtml or jspx pages in the Eclipse IDE, you need Jboss tools for html or Jboss tools for Jsp editor pluging. To install that plugin add the following site address in the Eclipse IDE

This plugin helps to get the content assist by default fot .jspx files but not .xhtml file.

To enable content assist for other files open web project properties and then look for "Jboss tools knowledge base" and check the "Jboss tools knowledge base support"

thats it enjoy the day.