Java Development with Ant: Search Engine Application FAQ


How do I build without J2EE SDK installed?

You must at least have the J2EE JAR file, and can point the build to it by setting the j2ee.jar property:

ant -Dj2ee.jar=/path/to/my/j2ee.jar

How do I enable EJB support?

Set the Ant property use.ejb=true.

Will this application work with other J2EE containers?

Yes, but tweaks will likely need to be made to get the EJB piece deployable in an application server other than JBoss.  The non-EJB mode (use.ejb=false, the default) WAR file works in Tomcat and should work in other web containers too.  The EAR file (either with EJB enabled or disabled) works in JBoss.  As with all things J2EE, leave it to vendors to make this more difficult than it should be.  Regardless, if the application works for you in Tomcat or JBoss, please do not contact me with issues deploying to a different container.

Issues with other EJB containers can likely be solved by adding XDoclet @tags and adding the vendor sub-tasks to the build file in the ejbdoclet target.  Thank goodness for XDoclet in this respect - consider the alternative!

How do I add adapt this application to my own documentation?

The simplest way is to add another directory under the sites directory, create a config.properties file by copying the sample site and adjusting it to suit your needs.  This project is, of course, an example and would need to be adjusted substantially for most needs.  Run the build with the property site set to the directory name you created (e.g. ant -Dsite=personal).  You could have the site files live in another directory, but you will still need a config.properties file and you will then have to set the site property as before and the site.dir property accordingly.

Why are Struts action mappings not generated?

Because I feel it breaks model-view-controller to embed action mappings in Action subclasses.  Others feel differently, its simply a matter of preference.  I view action mappings as the "glue" between the view (JSP's / form beans) and the actions being performed.  XDoclet will happily generate action mappings for you though, and this could be a time saver, no question.

Have issues with JBoss running embedded Tomcat?

A user reported the following:
I figured out a workaround to make your app work in JBoss with embedded Tomcat. See the following bug:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14476

Turns out it is a known issue, but the Struts guys say that since it works in Tomcat standalone without any workarounds, that it is a JBoss bug and should be reported there.

What I did, specifically, to make things work is to put commons-validator.jar in JBOSS_HOME/server/default/deploy *before* starting JBoss. Then, I started JBoss and ran the "deploy-jboss" target like normal. Everything works now. Tested with jboss-3.0.5_tomcat-4.1.18.
Note that JBoss with embedded Jetty works fine.