Category Archives: tomcat

Getting tomcat running again

It has been a hell of a struggle to upgrade the server (which hosts this site) from Fedora 13 to Fedora 17. The last step was to get my flying apps running in Tomcat again. I confess I don’t track what happens in the java world very closely. And it is a very active world – lots of stuff happening. So it is no surprise I suppose that when you jump four releases there are some adjustments to be made.

To get tomcat running I had to make the following adjustments, in addition to the obvious stuff of adding the FlightPlan war file to /usr/share/tomcat/webapps, installing the mysql jdbc connector, and updating /etc/tomcat/tomcat-users.xml.

Tomcat was unable to find org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory. I had to add:  JAVA_OPTS=”$JAVA_OPTS -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory” in /etc/sysconfig/tomcat. It may be that this is a problem of my own making somehow. In an earlier post I commented about the ongoing evolution in the methods available to connect java apps/servlets with databases. My servlets now use java Datasources, which I think are the “latest thing”, and I’m a little surprised that I have to make special provision for finding the classes. This makes me think it probable that if I understood this better, and did things according to “best practice” in the java world, I wouldn’t have this problem. But as I said before, catching up with all the advancements in java over 7 years is a tall order.

Then Tomcat was unable to find apache-commons-pool.jar, so I had to add a symlink: commons-pool.jar -> /usr/share/java/apache-commons-pool.jar in /usr/share/tomcat/lib. This is less surprising I think. The reference to this part of apache commons is coming from the previous (BasicDataSourceFactory) classes. If the former aren’t there, we don’t need this.

The flying apps seem to be running properly now.

Adding maps to my java flying apps

Just for fun I explored the Google Maps API and put maps into the flying apps. The google maps aren’t FAA charts or course, but on a multiple leg trip it is quite handy to be able to see the various stops laid out on a map. I also added maps to the page that shows the list of checkpoints. I think this is pretty handy in flight planning, as the alternative is to mark up a hardcopy chart.

Another nice new feature is airport lookup. This is a jquery enabled box on the pages that are asking for an airport ID. If you are planning to fly to some city but don’t know the ID of the airport there, you can just type in the name of the city. It is an autocomplete thing which does an ajax lookup in the airport database as you are typing, giving you a progressively narrower list of airports in cities that match what you have typed. Once you select an airport the ID is automatically put into the field.

Try the flight planner to see these new features.

Flying Apps updated

I finally got around to writing the code to decode TAFs. A lot of the code for decoding individual terms is shared with the Metar decoder. Metars are actually a bit more complex. The only complexity with TAFs is dealing with a sequence of forecasts for different time periods.
I also updated the ADF Tester applet a little to bring it into this century. It is quite an interesting thing to note how much java’s internal mechanisms mutate over a period as small as 5 years.
The flying apps are on the Flying page.

Deploying Tomcat from Eclipse

I truly do not understand all I know about this, but I’ve been tripped up by this several times now.
After working on a java servlet in Eclipse on a home machine (which happens to be Windows in this case), when I’m ready to deploy I export a WAR file and upload it to Tarragon, the Fedora box that serves this site. I copy the WAR file into /usr/share/tomcat6/webapps, and tomcat redeploys it. Then I have to fix the context.xml to change the datasources from the test database to the real database. Naturally I do this in /usr/share/tomcat6/webapps/<app>/META-INF/context.xml. Then I fire it up, and it fails. Continue reading Deploying Tomcat from Eclipse

Standalone java apps vs JNDI datasources

This is another post as a memory jogger for me.

Whenever I switch back to java I have trouble remembering the evolving history of setting up mysql connections. Back in the dark ages, you used to do this with Class.forName. But by the time I started writing servlets initially, it was being done instead with DriverManager. Then along came DataSources which could be set up in JNDI. A much more elegant solurtion, as long as you have a container to offer the JNDI service. Most of the active java I have is servlets running in Tomcat, and these are happily set up to use DataSource objects, and the DataSources are all described in the context and picked off from there. Continue reading Standalone java apps vs JNDI datasources

Try out the flight planner

The new flight planner is available as of 4/25/12 on the FLYING page. I’m sure there are still plenty of bugs.

There is also a Metar Decoder and a Query Tool that retrieves airports, fixes and navaids from the FAA database.

There are plenty of tools for doing similar things. The Flight Planner is a little unique in that it is airplane sensitive, which makes it much more useful to me than other such tools, but equally makes it less useful for anyone else.