Friday, February 25, 2005

iTracker - Open source bug tracker

I am working on a Debt Reduction/Wealth Builder software project for Ideal Financial Solutions where the team is dispersed geopgraphically. We have two developers, two testers, and some project manager types in four locations. We made it through the initial development phase with weekly phone calls, emails, and a few in-person meetings, but when we hit the testing phase, we had some big problems.

We started out by tracking the bugs in a couple of Word documents that we would email back and forth. The developers would add their comments on the issues and email the docs to the testers and vice versa. This got unwieldy after a couple of weeks, not to mention the attachments of the emails kept getting larger and larger.

I decided to look for an open-source (free) bug tracking tool and found iTracker. We've only been using it a couple of days now, but what a difference it has and will make for us.

I think my biggest gripe is the lack of detailed documentation, but that is to be expected with most open-source software. I originally wanted to use a MS SQL Server database as the backend, but quickly discovered I would have to spend a weekend pouring over JBoss installation/configuration documents in order to understand exactly what the limited documentation was asking me to do. (I only have Tomcat experience.)

Thank goodness that iTracker ships with an "Express Install". The Express Install uses HSQL, not sure if that is a JBoss specific persistence mechanism, or another open-source package. Using the Express Install I was up and running in less than an hour. I still need to figure out why the email notification isn't working. It appears to be an SMTP server problem. I contacted my ISP and they gave me the SMTP server info, but email notification is still not working.

I remember seeing some posts at the iTracker forum regarding troubleshooting email notifications. I'll have to do a little research and get it going.

Update - Email notification now working
Since I was running outside of my ISP's network, I had to provide authentication information. After I specified that in the itrackerApplication.properties file I still had problems. The last thing I had to do was provide valid email addresses in itrackerApplication.properties. I had some bogus email address for the from and reply. After changing them to real email addresses, email notifications started working.

Friday, February 04, 2005

jTDS - The fastest JDBC driver for MSSQL

jTDS is an open source 100% pure Java (type 4) JDBC driver for Microsoft SQL Server. It claims to be the fastest JDBC driver around and backs the claim with some benchmarks. All you have to do is drop a jar in the classpath, change your jdbc driver settings and url, and you're good to go, or so they say.

I dropped the jar file, modified my jdbc connection info as specified in their FAQs, but now my app won't start. I suspect it's my fault somehow, but it is a bit perplexing.

My app has some startup code that loops through all the resources in the environment context "java:comp/env". For some reason, my jTDS datasource is not found in the environment. If I replace the Driver and URL with the original Microsoft driver values, it does show up in the environment.

Here is my resource entry in Tomcat server.xml file:

<resource type="net.sourceforge.jtds.jdbcx.JtdsDataSource" auth="Container" name="mypool">
<resourceparams name="mypool">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>50</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>25</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>username</name>
<value>the_user</value>
</parameter>
<parameter>
<name>password</name>
<value>the_password</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>net.sourceforge.jtds.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:jtds:sqlserver://server1:52500/dev_2.2;
user=the_user;password=the_password</value>
</parameter>
<parameter>
<name>validationQuery</name>
<value>SELECT 1</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>300</value>
</parameter>
</resourceparams>


And the code that fails is:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object obj = envCtx.lookup("mypool");

After the last line of code above, obj is null. For some reason, the datasource is not getting into the environment context.

I posted the above problem on a jTDS forum (http://sourceforge.net/forum/forum.php?thread_id=1226037&forum_id=104389) and received a suggestion that fixed the problem.

I needed to change "net.sourceforge.jtds.jdbcx.JtdsDataSource" to "javax.sql.DataSource" in the <resource> element. I think I misunderstood the jTDS documentation. There was a table that had two columns, one column had "javax.sql.DataSource" and the other had "net.sourceforge.jtds.jdbcx.JtdsDataSource". I thought it was a simple "search and replace" job, but not so.

Anyway, it's up and running now!

StrutsWS (Web Service)

StrutsWS is a relativley new open-source project on Sourceforge http://sourceforge.net/projects/strutsws/. Frank Zametti, the author, has mentioned it various times recently on the struts user list. He mentioned today that he had just released a new MAJOR update, so I decided to take a look.

Here is Frank's abstract of the project:

This project is an attempt to create a mechanism in Struts whereby existing business logic components of a Struts-based application can be exposed as rudimentary Web Services without the need to change any code. To do this, I have created a custom RequestProcessor class. This class recognizes a Web Service request, that is, a SOAP message over HTTP, performs some pre-processing on the request, and passes it along to the targeted Action in a form it will understand. It then generates a SOAP-based XML response to the request in place of the usual view components of the existing application.

I read through the overview document and it sounded like an interesting project. It's main strength, in my opinion, is that you can use your existing Actions and ActionForms. There is no need to rewrite business objects to make them web services. Unfortunately, if an application makes heavy use of Session data, like session-scoped ActionForms or for handling security, then the StrutsWS library is of little value, since you now cannot use existing Actions and ActionForms. To quote Frank, "And of course, anything requiring session will NOT work, since no session would exist for a one-off request like these. "

I need to investigate Apache Axis a bit more and see how complicated it is use install and use.

Thursday, February 03, 2005

Trying out formdef

I decided to try out Hubert Rabago's formdef Struts plugin. After working through some silly mistakes, like getting the correct version of the formdef library for Struts 1.1, I think I finally got it working.

The framework we originally put together did not address the issue of business objects and Struts ActionForms very well. We naively just added as a member variable to each ActionForm (ValidatorForm) a data transfer object (DTO). These DTOs were the same ones used by the data access layer, so the data types of the variables in these "beans" were data types that the database expected. This is not ideal, as web forms should typically only deal with strings and maybe booleans.

As we got further into implementation and development using this paradigm, we discovered that we had to worry about data type conversions for displaying the data on a web form. It got a little cumbersome as a developer.

I stumbled across the formdef Struts plugin and it sounded like a good option. It introduced us to Dyna forms, which we had read about, but never investigated much. They're actually quite nice and save the developer the time of having to create ActionForm classes for each form. formdef takes it one step further by creating your dyna ActionForms for you based on a DTO (bean) that you specify, so the ActionForms match the business objects.

formdef also provides built in conversion methods to move data from the DTO to the form and vice versa. It is a very flexible library, providing many hooks and overrideables, so it should serve us well.

There was a thread on the Struts user list Nov 2004 that talked about this subject a little. Here is the URL to the original post. You can step through the response using the "next in thread" option. http://marc.theaimsgroup.com/?l=struts-user&m=110001898604664&w=2

[UPDATE 27Aug05]
The past couple of days I have tried to use formdef in a real web application and have run into a few problems. First off, I don't think formdef supports multi-select lists, i.e., <select multiple="multiple">. Second, I'm not sure how to implement a one-to-many relationship using formdef. Let me explain...

I use iBATIS for the DAO and db connection functionality. One feature iBATIS provides is that I can populate a DTO object from a query and the DTO can have a List property that stores the "many" side of the relationship. iBATIS will populate that List property automatically for me with all the related db rows.

I have not had success in creating the DynaValidatorForm when I have a List object in my DTO. formdef seems to choke on it, because when I remove it, everything is fine. Maybe there is a better way to handle one-to-many relationships when using formdef, not sure ??

Tuesday, February 01, 2005

Initial Post

I decided to start my own blog! I'll be blogging stuff I learn and discover as I work on a variety of computer consulting/contracting jobs. It'll be nice to have a repository for such findings, but really, it just kinda makes me feel cool that I am a blogger now :)