Home Development Blog Real World Issues
Real World Issues PDF Print E-mail
User Rating: / 0
Monday, 18 October 2010 19:09

One major niggle, that I decided not to mention in the blog until after I had fixed it is that the invocation of the GWT modules involves passing in the Joomla user id without any extra authentication.   This is obviously open to abuse and needed changing.   Also, for performance reasons, it is necessary to move to a database connection pool, rather than direct connections.

Removing the user ID was not to difficult - I now pass over the Joomla session ID and that is used to look up the current user and from there it is all the same.   But now, someone picking up the URL that the Joomla site invokes will not get very far, since the session ID will only be valid for a limited amount of time - and if they had access to the session ID then they could use that session anyway through the normal interface.

Moving to a connection pool has turned into one of my bigger headaches.   Firstly, I got it working on my local tomcat server.   This was only really a question of some missing jar files, commons-DBCP and Commons-Pooling and then setting up the connection in context.xml in the META-INF directory.   This worked fine, but, I hear you ask, why did I do this before getting it working on my development system first?

Well, getting JNDI to work in the eclipse GWT hosted debugger is a pain.   I needed to add a couple more JARS, Jetty-naming and jettyplus, making sure that they are of matching versions.   Then I needed to pass in "-Djava.naming.factory.InitialContextFactory=org.mortbay.naming.InitialContextFactory" to the VM arguments in the debug configuration for my app.   If this was not a GWT app, then the eclipse projects would probably have had this already included, but the combination ofGWT and JNDI threw it a bit.   My thanks to humblecode.blogspot.com.

So, two down, one to go:   Mochahost.   I sent them my jndi resource declaration and they claim to have set it up, but it ain't working.   And it still isn't as of 18th October.   One thing I learnt is to separate the hibernate.cfg.xml from my jar file so that I can keep two versions, one for JNDI and one for a direct connection and then simply copy the right one in via ftp whenever I want to switch.

I have written as simple a jsp test page as I can imagine that accesses the connection and writes out a few bits of data from the DB - it doesn't work and so the ball is really in Mochahost's court at the moment.   One niggle, to get the jsp page using the jstl taglibs to run I had to change the format of my web.xml file to 2.4 - whatever that really signifies?   I hate magic, undocumented incantations!

One aside - taglibs (JSTL) in JSP pages are, as far as I can tell, an attempt to make the JSP pages look more like existing script pages (e.g. pHP) and they really do sever any conceptual connection between the JSP page and the java language.   Still, they make it simple to write the pages, and presumably simple to link in to java servlets, enterprise beans etc if you want to.

Anyway, for now, the site is running with direct database connections. Mochahost have sorted out the problem and the website is now running on jndi and a connection pool.

Copyright © 2023 Crypto League. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.