Mar 18 2008

weblogic descriptor

adam

Just so I don’t have to google this again, here is how to fix the weblogic.xml descriptor when you get this message:

library is on the classpath of this project, but is not in the weblogic.xml file

Adding a library reference to the deployment descriptor

1. Select and expand the project in question in the Project Explorer view.
2. Locate the node labeled WebLogic Deployment Descriptor and expand it.
3. Find the node labeled J2EE Libraries.
4. Right-click on the J2EE Libraries node and select Add.
5. Click Browse and choose the library that should be referenced.
6. Adjust the reference information as necessary.
7. Click on the Ok button.


Feb 16 2008

Flex BlazeDS Spring an Integration Story

adam

At the Melbourne Spring User Group (MSUG) meeting in Feb I presented on integrating an Adobe Flex Rich Internet Application with a J2EE services tier using Spring as the integration glue and BlazeDS for lightweight binary data transfer using ActionScript message Format (AMF). I have made the slides from that presentation available here.

Many people seem to think that their has to be some hard decision made about whether to go with the sexy flash based user interface of a Flex application, or the robust, scalable dependability delivered by a Java based application. I say “Why not have the best of both worlds?”. The approach I outline is completely Open Source and free and it is trivially easy to configure BlazeDS to use the Spring bean factory to expose a standard Spring service facade to remoting calls by a Flex application.

Documentation for BlazeDS can be found here. An explanation of the Adobe example Spring factory can be found here. it contains the source code as well. You will need to copy it and paste it into your project source tree.

I hope this is useful to people.


Nov 11 2007

MyEclipse tomcat will not deploy

adam

This is really irritating. I can’t even count the number of times the MyEclipse hot deployment to Tomcat has gone pear shaped. Fixing this particular problem can really waste a lot of time.

Symptoms: Repeated message that MyEclipse cannot redeploy to Tomcat as the deployment is locked. Various recommendations follow that you stop tomcat and redeploy, ect and they all fail. When this really starts getting weird is when you undeploy remove the deployment in MyEclipse, restart Eclipse and Tomcat and still the same stuff happens.

Solution: You have to get really medieval on it.

  1. Remove the deployment.
  2. Stop tomcat
  3. Refresh the project
  4. Start Eclipse from the command line using the -clean flag i.e. $eclipse -clean or c:\eclipse.exe -clean (in windows)

Aug 27 2007

Eclipse plugins

adam

Below is a list of eclipse 3.2 plugins which I like and whos URLs I am constantly forgetting. hopefully I will never need to google these again :)

1. The Maven 2 plugin provides the ability to search the various Maven repos for dependecies. It also allows the prject to be built by the Maven builder, automatically manages your POM and will attach source if requested. This plugin was a little buggy initially but seems to be fine now. If you are building your project with Maven 2 I really recommend this.

Update site: http://m2eclipse.sonatype.org/update/

2.Emma plugin for eclipse. This provides full coverage analysis as a plugin for eclipse. It allows you to run your test suite under Emmas coverage analysis tool and provides immediate feedback as well as code highlighting to indicate sections of code which have not been visited by tests. This plugin is really useful for keeping you honest.

Update site: http://update.eclemma.org/

3. a) Subclipse is a subversion plugin from tigris. It is free and provides pretty much all the same features you are used to seeing for CVS, but for SVN. It also has some nice features for navigating into branches and branching with uncommited code, etc

The eclipse update site for this is: http://subclipse.tigris.org/update_1.4.x

b)Another Subversion plugin for elipse is Subversive. i changed to this plugin recently because it seems to resolve conflicts in a manner more like the old CVS conflict resolution tool. The icon set is not quite as nice as the Subclipse set, but it seems to perform slightly better for conflict resolution.

Update site: http://www.polarion.org/projects/subversive/download/1.1/update-site/

4. Veloedit is a Velocity template editor. Very basic, but better than nothing when you are writing velocity templates.

Update site: http://veloedit.sourceforge.net/updates/

5. XFire plugin. This is quite a useful plugin if you want IDE support for xFiring service endpoints.

Update site: http://dist.codehaus.org/xfire/update/

6. Spring IDE. If you are using Spring this is a must-have plugin. Provides bean file support for dependencies as well as making sure that class names are valid.

Update site: http://dist.springframework.org/release/IDE


Apr 24 2007

Maven Tests with Spring propertyPlaceHolderConfig

adam

This seemingly innocuous combination cost me almost a full day to debug. The error I was getting was:

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'mailSender' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Could not resolve placeholder 'smtp.host'

The configuration file was being found, however the properties were not being loaded into by the propertyPlaceHolder. The solution to this is to use the SystemClassLoader, which is not the default for the surefire plugin you can define it like this:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<excludes>
<exclude>
this dummy value is to override surefire’s default
</exclude>
</excludes>
</configuration>
</plugin>

Hopefully this is helpful to people trying to use this combination of Maven and the Spring propertyPlaceHolderConfig


Mar 7 2007

iTrack on Sourceforge

adam

The iTrack code base has now officially moved to sourceforge. I will soon build a war for people to download and deploy.

iTrack is a J2EE Web Based Bug Tracking and Issue Management tool which I began as an out of hours project at Groupware and was then taken up by groupware and developed further for managing software projects for clients. It is based on the Spring/Hibernate stack and uses OS Workflow, ACEGI Security, SpringLayout tags and Display tags.

It is currently aimed at Client/Developer relationship management but the next release will see support for anonymous defect logging on projets marked as Public.

The project’s homepage is now at: sourceforge


Feb 4 2007

Spring Layout Released

adam

Last week we deployed the first public release of the Spring Layout project. The project homepage is at sourceforge and is now available for download. I am looking forward to feedback from other developers and getting feedback from users.

I am currently working on the datagrid to enable multiple entries to be added without a post and writing a roadmap document so that we keep a coherent direction for future development.

Thanks to Groupware for providing time for developers to work on this framework.


Jan 28 2007

Spring Layout

adam

Over the past 18 months we have been expanding the tag library and Spring MVC extensions that we use to increase our velocity in Web Application development. We always intended to Open Source this stuff as soon as it was mature enough to be easily configured and used by someone without intimate knowledge on how they work and it looks like that time is now just around the corner.

We have a sourceforge project open now here
and will be migrating the source code, documentation and sample application there over the coming week. In general this framework provides integrated tags, much like the struts html tags which provide Spring binding and facilitate 3 modes of display: Read, Edit, and Multi. This allows for form data to be either displayed or provided in an editable format or to be switchable via clicking on the field or label. It provides a tightly integrated, extensible validation framework with simple client side/server side independent or cross field validation with both style sheet and message based error feedback.

In terms of Spring MVC extensions, it provides a Multi-Panel controller which allows for wizard-like multi form data gathering, field level security and controller support special components such as a Datagrid.


Jan 5 2007

Maven 2, MyEclipse & Tomcat Hot Deploy

adam

Recently we have been attempting to move away from manually managing libs for each project and move to a central repository for manging our jars and dependecies. Maven 2 seemed like the ideal tool for this and since it seems to have such a large body of support we thought that it would be reasonably easy to integrate into our current development processes. We even thought we might get quite a bit of leverage out of the other plugins available for Maven 2 which would allow things like automatic site generation for the project and documentation of dependencies.

Unfortunately getting Maven 2 integrated into our current development processes was anything but easy. We usually build Web applications and we use the MyEclipse plugin for eclipse to automate and speed up many of the repetitive tasks. Auto-deploying wars and hot-swapping code is one feature we consider absolutely critical to our rapid development process. The following is a description of how we eventually got this working, and now can in fact get setup quicker than we could our old way.

  1. First make sure that Maven 2 is installed and that it is in the path (see the Maven install instructions if you can find them).
  2. .Configure the M2_REPO variable in Eclipse to point to your maven repository (usually /.m2/repository). This can be configured in Eclipse under windows->preferences->Java->build path->Classpath
  3. Next, I have found that is easier to just follow the Maven folder conventions than to try and get maven to follow yours. This means that the normal src folder becomes src/main/java, all resources and configuration files go in src/main/resources, and the web root becomes src/main/webapp the test tree follows the same structure and becomes src/test/java and src/test/resources. In order for MyEclipse to live with this and do a hot deploy you need to tell the web deployer that your web context root folder is /src/main/webapp, this can be done when you give a project web capabilities but if your project already has web capabilities then you will need to modify the .mymetadata file in order to change it and restart eclipse.
  4. obviously your project needs to have a valid pom.xml in the project root. Under the part of your pom put the following: <plugin>
    <groupid>org.apache.maven.plugins</groupid>
    <artifactid>maven-eclipse-plugin</artifactid>
    <configuration>
    <buildoutputdirectory>src/main/webapp/WEB-INF/classes</buildoutputdirectory>
    <downloadsources>true</downloadsources>
    </configuration>
    </plugin>
  5. this tells eclipse to build to the classes folder under your web root WEB-INF folder (where they need to be for a hot deploy)
  6. Navigate to your project root on the command line and run mvn eclipse:eclipse this should build your .classpath file according to your pom.xml and even attach source code where available.

Most people should be able to hot-deploy as normal now using the MyEclipse server tools, however i have noticed some people have problems with servlet-api.jar and jsp-api.jar conflicts, if that is the case then the following steps should fix that:

  1. Right click on your project and go to the properties>java build path>libraries You will need to look through this list for servlet-api.jar and jsp-api.jar, remove them and add the J2EE library (You will need to do this each time you run the eclipse target or else your servlet-api.jar and jsp-api.jar will get deployed to your web server and may interfere with the one it already has in it’s classpath
  2. Next, still under the project properties item go to MyEclpse->Web->Deployment uncheck the ‘workbench default settings’ and ‘Jars in web Projects user Libraries’

you should now be able to do a normal MyEclipse hot-deploy…