Running iBatis ContactManager app

This app uses Google Guice, iBatis and Stripes framework. The URL to use isn’t obvious when you download and try to run this app from Eclipse with M2E and M2E WTP plugins. Stripes converts the qualified class name to a URL. So the class org.sample.stripes.actions.ContactAction becomes actions/Contact.action which will execute the list method. So the URL I used is : http://localhost:8080/ROOT/actions/Contact.action

Advertisements

Build and Deploy Spring PetCare in Eclipse without STS using M2E.

Get  http://dist.springsource.org/release/AJDT/configurator for m2e to configure aspectj plugin (this comes by default STS). Also install AspectJ plugin from market place. Then import the project via Maven. If you do not install AJDT, you will run into this error: No marketplace entries found to handle aspectj-maven-plugin:1.2:compile in Eclipse

More on that error here: https://jira.springsource.org/browse/DATAGRAPH-104

SVN Path: https://src.springframework.org/svn/spring-samples/petcare/trunk  Version : 496

 

 

Building Spring jPetstore from SVN, version 136

Obtain the source from https://src.springframework.org/svn/spring-samples/jpetstore/trunk/org.springframework.samples.jpetstore
Change spring.version to 3.0.5.BUILD-SNAPSHOT
Add an SLF4j implimentation. This is what I added to pom.xml

        <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>

mvn eclipse:eclipse and m2e eclipse import – Errors in Web project – Richfaces showcase example – OutOfMemoryError

If you convert a maven project to eclipse using eclipse:eclipse, like richfaces showcase, and try to open it in eclipse, it might lead to ClassNotFound errors when you run the app in Tomcat. To fix that, delete the ‘.settings’ directory and install m2e plugin, and m2e webtools plugin (wtp). Then import the project into eclipse via maven. Then run the project in Tomcat server in Eclipse. If you run into “java.lang.OutOfMemoryError: PermGen space”, set permsize arguments for Tomcat as shown:
-XX:PermSize=64m -XX:MaxPermSize=128m

eclipse socks proxy pains

Since I am behind a corporate firewall, I need to enter proxy setting to update my eclipse installation. I entered the proxy settings for http,https, and SOCKS and selected Manual. When I try to connect to a site, eclipse takes a while and returns a SOCKS error. And there was no option to uncheck socks proxy. A was able to fix this by clicking on ‘clear’ next to SOCKS.

Automatic proxy configuration using WPAD

Windows looks up the proxy details by looking up the file at http://wpad/wpad.dat . More on that here: http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol

Never use 32bit DLL with 64bit JVM

If you try that you will get a “Can’t load IA 32-bit .dll on a AMD 64-bit platform” error. So make your runtime a 32 bit JVM or switch to a 64bit DLL on a 64bit JVM.

IIS 7 – The process cannot access the file because it is being used by another process – 0x80070020

Turns out Skype was using port 80. Quitting Skype fixed the problem. Used this command to find out what was using port 80
netstat -aon | find “:80”
Then used Task manager to find out what that process was. More on this here: http://support.microsoft.com/kb/973094

Relative file location in a J2EE server or any java process.

If you create file using File f=new File(“direc/file.txt”), you won’t know where it creates the file. So use f.getAbsolutePath() to print the location of the file the Java api thinks the file should be in.

Eclipse current working directory for file or directory operations

This is the Project directory. So if you have a class MyClass that creates a file called “xyz.txt” and MyClass is a class under MyProject then the file xyz.txt will be under MyProject/xyz.txt . You will have refresh the project to see the newly created file.