Friday, May 21, 2010

Unix commands

Search in all directories and subdirectories for stringToFind
find . | xargs grep -s stringToFind

Cron jobs are located in /var/spool/cron/crontabs
crontab -l

Search for files

find . -name "filename.ext" -print 2> /dev/null

Create Axis Web Service stubs/artifacts using soapUI

It is very easy to generate Axis web service stubs (artifacts) using soapUI tool. NOTE: This can also be done using the commands

Put file in C:\Projects\Jars\axis-1_4\lib
cd C:\Projects\Jars\axis-1_4\lib
java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java -p<packageName> <WSDLFileName/ URL>

soapUI is a web service, SOA, SOAP testing tool which provides a GUI for generating these stubs for those who do not like the command line. soapUI is a free open source desktop application for inspecting contract, invoking, developing, testing (functional, load, compliance, simulation) web services.

First in File-> Preferences->Tools tab set the Axis 1.x directory where you have downloaded the library files. Axis libraries can be downloaded out here : http://www.apache.org/dyn/closer.cgi/ws/axis/1_4

image

Tools->Axis 1.0 Artifacts

image

Put in the WSDL and the directory where you want the stubs to be located

image

In the Advanced tab you can specify the package where stubs should be placed

image

Generate button will start the task of generating stubs

image

image

image

In the following articles I will demonstrate how I called the web service using these stubs.

Tuesday, May 18, 2010

dwr 3.0 with Spring 3.0

dwr 3.0 is still in development stages but after checking out dwr 2.0 which requires XML configuration I was willing to take the risk of diving into a release candidate library under heavy development.

web.xml

  1:   <context-param>
  2:     <param-name>contextConfigLocation</param-name>
  3:     <param-value>/WEB-INF/applicationContext.xml</param-value>
  4:   </context-param>
  5:   <listener>
  6:     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  7:   </listener>
  8:   <servlet>
  9:     <servlet-name>dispatcher</servlet-name>
 10:     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 11:     <load-on-startup>2</load-on-startup>
 12:   </servlet>
 13:   <servlet-mapping>
 14:     <servlet-name>dispatcher</servlet-name>
 15:     <url-pattern>*.do</url-pattern>
 16:   </servlet-mapping>
 17:   <servlet-mapping>
 18:     <servlet-name>dispatcher</servlet-name>
 19:     <url-pattern>*.html</url-pattern>
 20:   </servlet-mapping>
 21:   <servlet-mapping>
 22:     <servlet-name>dispatcher</servlet-name>
 23:     <url-pattern>/dwr/*</url-pattern>
 24:   </servlet-mapping>




Notice there is no DwrServlet. Everything goes to Spring’s DispatcherServlet



dispatcher-servlet.xml



  1: <?xml version="1.0" encoding="UTF-8"?>
  2: <beans xmlns="http://www.springframework.org/schema/beans"
  3:   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
  4:   xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  5:   xmlns:context="http://www.springframework.org/schema/context"
  6:   xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
  7:   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  8:        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
  9:      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
 10:        http://www.springframework.org/schema/context
 11:        http://www.springframework.org/schema/context/spring-context-2.5.xsd
 12:        http://www.directwebremoting.org/schema/spring-dwr 
 13:        http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
 14: 
 15:   <!-- Annotation-based configuration-->
 16:   <context:annotation-config />
 17: 
 18:   <!--
 19:     To remove the explicit bean definitions: Spring can scan package names
 20:     to find beans to manage as follows
 21:   -->
 22:   <context:component-scan base-package="*" />
 23: 
 24:   <!-- Enable DWR AJAX functionality-->
 25:   <dwr:configuration />
 26:   <dwr:annotation-config />
 27:   <dwr:annotation-scan />
 28:   <dwr:url-mapping />
 29:   <dwr:controller id="dwrController" debug="true" />
 30: 
 31:   <!--AnnotationMethodHandler-->
 32:   <bean
 33:     class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
 34:   <!-- bean
 35:     class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /-->



  • Note line number 6, 12, 13. This is to enable DWR namespace


  • Note the order of lines 25-29. If you miss annotation-scan your bean converters will not work and instead of the JSON output you will get the following error



  • I have commented line 9.  This issue has more to do with Spring configuration than DWR. Since you are specifying the AnnotationMethodHandlerAdapter the normally provided (by default) BeanNameUrlHandlerMapping is no longer provided (Spring does not provide it if another handler is specified. Error message thrown is :-



    • 2010-05-18 09:21:39,640 ERROR [dispatcher]:{StandardWrapperValve.java:253} - Servlet.service() for servlet dispatcher threw exception

      javax.servlet.ServletException: No adapter for handler [org.directwebremoting.spring.DwrController@1352447]: Does your handler implement a supported interface like Controller?


          at org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:982)


          at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:770)


          at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)


          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)


          at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)


          at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)


          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)


          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)


          at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:401)


          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)


          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)


          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)


          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)


          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)


          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)


          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)


          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)


          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)


          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)


          at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)


          at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)


          at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)


          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)


          at java.lang.Thread.run(Thread.java:595)


    • Read more here :






DwrService



  1: package service.impl;
  2: 
  3: import java.util.ArrayList;
  4: 
  5: import org.directwebremoting.annotations.RemoteMethod;
  6: import org.directwebremoting.annotations.RemoteProxy;
  7: import org.springframework.beans.factory.annotation.Autowired;
  8: import org.springframework.stereotype.Service;
  9: 
 10: import beans.Printer;
 11: import dao.jdbc.VmecsDaoJdbc;
 12: 
 13: @Service
 14: @RemoteProxy
 15: public class DwrService {
 16: 
 17: 	@Autowired
 18: 	private DaoJdbc db;
 19: 
 20: 
 21: 	@RemoteMethod
 22: 	public ArrayList<Printer> getPrinters() {
 23: 		return this.db.getPrinters();
 24: 	}
 25: }


Bean converter



  1: package beans;
  2: 
  3: import org.directwebremoting.annotations.DataTransferObject;
  4: import org.directwebremoting.annotations.RemoteProperty;
  5: import org.directwebremoting.convert.BeanConverter;
  6: 
  7: @DataTransferObject(converter = BeanConverter.class)
  8: public class Printer {
  9: 	@RemoteProperty
 10: 	private String printerName;
 11: 	@RemoteProperty
 12: 	private String queueName;
 13: 
 14: 	/**
 15: 	 * @return the printerName
 16: 	 */
 17: 	@RemoteProperty
 18: 	public String getPrinterName() {
 19: 		return this.printerName;
 20: 	}
 21: 
 22: 	/**
 23: 	 * @param printerName
 24: 	 *            the printerName to set
 25: 	 */
 26: 	public void setPrinterName(String printerName) {
 27: 		this.printerName = printerName;
 28: 	}
 29: 
 30: 	/**
 31: 	 * @return the queueName
 32: 	 */
 33: 	@RemoteProperty
 34: 	public String getQueueName() {
 35: 		return this.queueName;
 36: 	}
 37: 
 38: 	/**
 39: 	 * @param queueName
 40: 	 *            the queueName to set
 41: 	 */
 42: 	public void setQueueName(String queueName) {
 43: 		this.queueName = queueName;
 44: 	}
 45: 
 46: }


Browse to the test page:-



image



Enter input (if required) and hit Execute. The output is JSON



image



I have not explained the annotations since they seem to be self-explanatory. If you have any questions leave a comment.

Monday, May 17, 2010

Change default Eclipse workspace

  1. Go to installed directory eg. c:\Program Files\Eclipse
  2. Go to configuration directory
  3. Look out for config.ini
  4. Change the value of osgi.instance.area.default

eg. osgi.instance.area.default=c:/Projects

Friday, May 14, 2010

Microsoft Office Live Workspace does not work for FireFox

image

Office Live Workspace is back…again?

Look what I received in my email today. Last time I used Offlice Live Workspace beta – My editing rights were removed without informing me that the beta period had expired. I found out the hard way. When I click on a word doc it used to prompt me to download!

At present, I use Ms Office Live Workspace as a backup for my Google docs account. Should I try Ms again? That depends on whether it is beta and the “soon” factor


Microsoft Office Live 
Workspace
Arrow icon

Your Office Live Workspace account will be upgraded for free.

Good news!

Your Microsoft Office Live Workspace beta account is about to become even better. You already know it’s a great way to store and share documents, and soon it will come together with Windows Live SkyDrive to become a great way to view, create, and edit documents from virtually anywhere.

In the coming months, you’ll receive notification when your Office Live Workspace account will be upgraded, along with further details. Until then, there’s no need for you to do anything.

With your SkyDrive account, you’ll get 25 GB of online storage for sharing both documents and photos. Your SkyDrive account is designed to work smoothly with other Windows Live services like Hotmail and Messenger. And you’ll be able to view and edit documents from virtually anywhere* using new Microsoft Office Web Apps.

Questions? Visit the Office Live Workspace upgrade center.

* An appropriate device, Internet connection, and Internet Explorer, Mozilla Firefox, or Safari browser are required.

Microsoft

©Microsoft Corporation. One Microsoft Way, Redmond, WA 98052-6399, USA
All rights reserved. Legal | Trademarks | Privacy

Wednesday, May 12, 2010

How to downgrade grails to previous version

  1. Manually delete the new Grails installation from c:\grails and override it with older grails installation
  2. Delete version related upgraded plugin zips from C:\grails\plugins. This is very easy to identify by the suffix eg. grails-tomcat-1.2.2.zip works for Grails version 1.2.2 and grails-tomcat-1.3.zip works for Grails version 1.3
  3. Delete zip and directory in C:\Documents and Settings\vsanzgiri\.grails\<old_version>\projects\<ProjectName>\plugins
  4. Delete zip from C:\Documents and Settings\vsanzgiri\.grails\<old_version>\plugins
  5. Delete directory C:\Documents and Settings\vsanzgiri\.grails\<new_version>

Replace all orange items with Project specific, version specific and system specific settings

You might have to uninstall and reinstall some plugins depending on the plugins that are complaining when you run clean, upgrade or run-app command.

grails –clean

“Resolve plugins” if you are using Netbeans

grails –upgrade

NOTE: This is not a foolproof way to downgrade grails version. These are just some notes I remember from my ordeal.

Tuesday, May 11, 2010

JavaScript:history.go(-1) not working in Firefox

 

If you want to go to the last page or referer application history.go(-1) works for IE but it does not work in FireFox.

<a href="javascript:void(0);" onClick="JavaScript:history.go(-1);">Back</a>

The fix is to use history.back(); return false; as shows below:-

<a href="javascript:void(0);" onclick="history.back(); return false;">Back</a>

Reference: https://developer.mozilla.org/En/DOM/Window.history

Monday, May 10, 2010

Upgrade Grails

To upgrade grails on a project I download the latest distribution binary zip from http://grails.org/Download and unzip it over my old installation on c:\grails to override my older installation.

On starting Netbeans it automatically downloads the updated dependencies:-

Welcome to Grails 1.3.0 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: c:\grails

Base Directory: C:\Projects\ProjectEditor
Resolving dependencies...
Downloading: c:\grails\lib\gpars-0.9.jar ...
Download complete.
Downloading: c:\grails\dist\grails-docs-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-bootstrap-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-scripts-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-core-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-resources-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-web-1.3.0.jar ...
Download complete.
Downloading: c:\grails\lib\groovy-all-1.7.2.jar ...
Download complete.
Downloading: c:\grails\dist\grails-crud-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-gorm-1.3.0.jar ...
Download complete.
Downloading: c:\grails\dist\grails-spring-1.3.0.jar ...
Download complete.
Downloading: c:\grails\lib\junit-4.8.1.jar ...
Download complete.
Downloading: c:\grails\dist\grails-test-1.3.0.jar ...
Download complete.
Dependencies resolved in 63984ms.

I then run the upgrade command on individual projects:-

grails upgrade


Running script c:\grails\scripts\Upgrade.groovy

Environment set to development



                WARNING: This target will upgrade an older Grails application to 1.3.0.

                Are you sure you want to continue?


                                    (y, n)


NOTE: Your application currently expects grails version [1.2.2], this target will upgrade it to Grails 1.3.0 ...



y



   [delete] Deleting directory C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\resources

     [copy] Copying 1 file to C:\Projects\ProjectEditor\web-app\WEB-INF


     [copy] Copying 1 file to C:\Projects\ProjectEditor\web-app\WEB-INF


     [copy] Copying 4 files to C:\Projects\ProjectEditor\web-app\WEB-INF\tld


Installing zip c:\grails\plugins\grails-hibernate-1.3.0.zip... ...


    [mkdir] Created dir: C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\hibernate-1.3.0


    [unzip] Expanding: c:\grails\plugins\grails-hibernate-1.3.0.zip into C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\hibernate-1.3.0


Installed plugin hibernate-1.3.0 to location C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins/hibernate-1.3.0. ...


Resolving plugin JAR dependencies ...


Executing hibernate-1.3.0 plugin post-install script ...


Plugin hibernate-1.3.0 installed


Installing zip c:\grails\plugins\grails-tomcat-1.3.0.zip... ...


    [mkdir] Created dir: C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\tomcat-1.3.0


    [unzip] Expanding: c:\grails\plugins\grails-tomcat-1.3.0.zip into C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins\tomcat-1.3.0


Installed plugin tomcat-1.3.0 to location C:\Documents and Settings\vsanzgiri\.grails\1.3.0\projects\ProjectEditor\plugins/tomcat-1.3.0. ...


Executing tomcat-1.3.0 plugin post-install script ...


Plugin tomcat-1.3.0 installed


Plugin provides the following new scripts:


------------------------------------------


grails tomcat


Please make sure you view the README for important information about changes to your source code. ...


Project upgraded

Sunday, May 09, 2010

Install reCAPTCHA image verification for PHP

The reCAPTCHA PHP Library provides a simple way to place a CAPTCHA image verification on your PHP website, helping you stop bots from abusing it. The library wraps the reCAPTCHA API.

  1. Download the reCAPTCHA Library, unzip it, and copy recaptchalib.php to the directory where your forms live.
  2. sign up for an API key.
  3. Add code to display the CAPTCHA:
    require_once('recaptchalib.php');
    $publickey = "..."; // you got this from the signup page
    echo recaptcha_get_html($publickey);



  4. In the code that processes the form submission, you need to add code to validate the CAPTCHA. Otherwise, the CAPTCHA will appear, but the answers won't be checked. The validation code looks like:
    require_once('recaptchalib.php');
    $privatekey = "...";
    $resp = recaptcha_check_answer ($privatekey,
    $_SERVER["REMOTE_ADDR"],
    $_POST["recaptcha_challenge_field"],
    $_POST["recaptcha_response_field"]);

    if (!$resp->is_valid) {
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
    "(reCAPTCHA said: " . $resp->error . ")");
    }




This tip is when you use ssl (https). reCAPTCHA code by default is not for ssl and hence IE8 would show the following popup:-



image



Now if you click Yes – you will not get the reCAPTCHA code since it is http code and if you click No – you will see reCAPTCHA.



Code for reCAPTCHA looks like this :-




require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);



The reCAPTCHA website does not have any code to explain this. But if you go through the library you will see that you have to change the last line of the above code to say:-




echo recaptcha_get_html($publickey,null,true);




First parameter is your public key, second is your error string and third is whether ssl is enabled. We have used reCAPTCHA for our Asha for Education donation page

Wednesday, May 05, 2010

<form:label/> in Spring should have MessageSource support

If you have used any version of Spring upto 3.0 you would be surprised when using form:label tag:-

<form:label path="foo.bar"/>  
does not render anything in HTML. You would not see the data in foo.bar in the resultant HTML. In fact the html equivalent would be <label for="foo.bar"></label>

For the text to show in your view use <form:label path="foo.bar">The actual label</form:label>
eg. <form:label path="foo.bar">${command.foo.bar}</form:label>

There is already a Spring JIRA issue for the MessageSource support: http://jira.springframework.org/browse/SPR-2566

Monday, May 03, 2010

Toad for Oracle 10.5 upgrade

Toad for Oracle 10.5 released in mid-April 2010 and I decided to give the (not so easy) update a shot.

Help->Check for Updates on 10.1 said there was no upgrade available

image

Based on my prior experience you need to manually download the latest executable from their website https://support.quest.com/MySupportLink/MySupportLink.aspx  This requires a Site ID which validates your license and your profile.

After logging in search for ‘Toad for Oracle’

image

Click on the Downloads tab

image

You would need to know your licensed products. Quest allows you to download all executables if you are not licensed it will only show up as a trial version. I used the Toad for Oravle 10.5 Commercial Installer

image

image

Toad does not upgrade the previous version. After installing you will have to import settings from the older version and then uninstall the older version

image

I had to change the folder to make it work

image

The Quest SQL Optimizer for Oracle requires you to have .Net Framework. What’s weird about this is there is no version of .Net Framework named 2.1. I received this error message even after I installed 4.0

image

image

image

image

image

I love Toad and I am going to give its Toad for MySQL freeware a try : http://www.quest.com/toad-for-mysql/

Sunday, May 02, 2010

How to solve - SEVERE: Error listenerStart


Ever get the SEVERE: Error listenerStart and can't find the error? Logs don't seem to help since this is a container start up problem.

May 3, 2010 3:01:09 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_07\bin;C:\Program Files\Tomcat\5.5\bin;C:\oracle\ora10_2\BIN
May 3, 2010 3:01:10 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 3, 2010 3:01:10 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 984 ms
May 3, 2010 3:01:10 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 3, 2010 3:01:10 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.26
May 3, 2010 3:01:10 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
May 3, 2010 3:01:15 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 3, 2010 3:01:15 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/CameraProject] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.

May 3, 2010 3:01:15 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 3, 2010 3:01:16 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
May 3, 2010 3:01:16 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63  config=null
May 3, 2010 3:01:16 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
May 3, 2010 3:01:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6391 ms

Start Tomcat
=========
I'm using tomcat - and whilst I understand Jetty is meant to be good for development, it doesn't seem to yet support eclipse 3.2. You probably have a script to start and restart tomcat or using a plugin to restart it. I'm using sysdeo (http://www.eclipseplugincentral.com/...k-cid-120.html) which seemed to me to be the most common. With the sysdeo plug in I can start my tomcat in eclipse which can link in to the debugger. In this case I have used MyEclipse to reproduce the error.

Attach the source
==============
in your build path (project properties, java build path) select the libraries tab and the spring jar. Expand the + and click on source attachment, and edit the path to be the spring source 'src' directory. I manually downloaded spring 3.0 release with the sources and pointed to that jar file : http://www.springsource.com/download/community


Set Breakpoint in ContextLoaderListener
=========================
In the spring jar on the build path, find org.springframework.web.context and the ContextLoaderListener class. Set a breakpoint at line which will read this.contextLoader.initWebApplicationContext(event .getServletContext()); This will be around line 47 (Spring 3.0)


find the error!
==========
Now when you start tomcat from within an eclipe plugin it will stop at the above. Choose to 'step return' once and then wait for the container to load everything up and find an error. If there is an error you will now be at standardcontext.listenerstart and you can now look at the error in the variable window under 't'. There are 'cause' error, make sure you take a look at them all since some can be wrapped/hidden. If you're using hibernate, I find that this does show the hbm mapping file problems, but the actual bean which causes the error can be wrong - it seems to just take the first bean in its list!

 

StandardContext

In my case the error was :-

java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist