Archive for March 2006

Friday 31 March 06

Found out this morning that our JISC Design for Learning bid has been successful, so that’s really good news 🙂 From my point of view, this news means that we’ll be able to make Sled & CopperCore much more robust (though there are other aspects to the bid too!). Further information about the bid can be found in the proposal document.

Wednesday 29 March 06

Now that I’ve got my tomcat application linked up to my database, I’ve been having a go at generating webservices to interact with it. I had previously just been using the command line (as demonstrated in the Enterprise SDK minimal deployment instructions), but thought I’d try and make things a bit more automatic (and easier!) for myself be writing an ant task to do all the soapification of my java classes.

After a little fiddling around I managed to get to create an ant task which will auto generate the webservices, get a copy of the script I used.

Monday 27 March 06

Have spent some time this morning looking at linking up a MySQL database up to Tomcat 4.1, using database connection pooling (DBCP). I had a fair bit of teething troubles getting it to work (using the instructions that I’d found to edit the tomcat server.xml)  as I kept getting the message that:

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class ” for connect URL ‘null’

It seems that this is quite a common problem (from all the forum postings about it), and different solutions appear to work for different people (depending I guess on exactly what version of tomcat, which database etc etc). So anyway, here’s what worked for me in the end…. (for info, here I’m using Tomcat v4.1 on Windows, and the MySQL connector in mysql-connector-java-3.1.12.jar – which I put in $CATALINA_HOME/common/lib/)

I did not edit the $CATALINA_HOME/conf/server.xml file, instead I created an xml file in the webapps directory named the same as my webapp that would like to use the database (joinindb.xml). This file looks contains this (for info, this is the entire file)

<Context path="/joinindb" docBase="joinindb"
        debug="5" reloadable="true" crossContext="true">

  <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_JoinInDB_log." suffix=".txt"
             timestamp="true"/>

  <Resource name="jdbc/JoinInDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/JoinInDB">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <!– Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         –>
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>

    <!– Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.
         –>
    <parameter>
      <name>maxIdle</name>
      <value>30</value>
    </parameter>

    <!– Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         –>
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>

    <!– MySQL dB username and password for dB connections  –>
    <parameter>
     <name>username</name>
     <value>myusername</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value>xxxxxxxxxx</value>
    </parameter>

    <!– Class name for mm.mysql JDBC driver –>
    <parameter>
       <name>driverClassName</name>
       <value>org.gjt.mm.mysql.Driver</value>
    </parameter>

    <!– The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
         connection.  mysqld by default closes idle connections after 8 hours.
         –>
    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/joinin?autoReconnect=true</value>
    </parameter>
  </ResourceParams>
</Context>

I then added the following to my webapp web.xml file (this was added just before the closing </web-app> tag):

 <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/JoinInDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
</resource-ref>

I created a class to test the connection and the method that is used is as follows… (it just returns the name of the class):

public String testConnection() {
        String retvar="nothing here";
        try {
            Context context = new InitialContext();
            if (context == null ) {
                retvar = "Boom – No Context";
            }
            DataSource datasource = (DataSource)context.lookup("java:comp/env/jdbc/JoinInDB");
            if (datasource == null ) {
                retvar= "Boom – No DataSource";
            }
            retvar= "Database connected!";
            retvar = datasource.getConnection().getClass().getName();
    } catch (Exception e) {
            e.printStackTrace() ;
            retvar = "Database Not Available…. aarrgh …. why? – see the stack trace" ;
    }
        return retvar;
    }

When I called this method from a JSP in my webapp, the code run without error returned the value: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper as the classname.

Monday 27 March 06

Eventually figured out what the problem was when I was trying to register the service with axis on the Enterprise minimal deployment example. It turned out that I needed to add ‘.’ to the axis class path so that the current directory was also included in the class path. See the full background on the IMS Enterprise SDK SF forums

I also started a new thread on the IMS Enterprise SDK SF forum regarding being able to ‘get at’ the wsdl for the web services generated, as I was getting error messages when I tried to view the wsdl. The solution appears to be to use the es-client.jar for the communication between the client and server. However for our project we can’t the es-client.jar because the client will be Moodle (written in php). So we’ve got a couple of options (unfortunately Scotts option of using the SOAPless approach won’t work as we need read & write access)….

  1. Try to figure out how to read the output from the webservice in php – I’m guessing this is what Scott means when he says that we could construct the SOAP + XML messages and deal with them.
  2. Create the client in java, then write a wrapper around this to provide a simpler webservice, and we could then let Moodle & LAMS commmunicate with this stripped down version.
  3. Create our own basic webservice (which passed out IMS Enterprise XML, rather than using IMS Enterprise Webservices), but this would mean not using the Enterprise SDK at all

My feeling at the moment is that (1) would take up too much time in this short project, and we wouldn’t get chance to do the grouping stuff that we’re meant to be doing! Option 2 would be a good compromise given the time we have, with option 3 as a fallback option so we could actually deliver something that worked, just not exactly in the way we would have liked.

Need to have a bit of a think about all this and the best way to go 🙂

Thursday 23 March 06

I’ve been looking again at getting the minimal deployment of the IMS Enterprise SDK running and looking at the experiences that Carol has been having (see: the MINTED blog and the posting on the SF forum). I did have some problems getting it running and I’m sure it was a classpath issue (it your interested in the exact problem I posted it up to the SF forum). However, I had also asked Carol to email me the whole war file that she had compiled and got running. Once I put her version of the war file in my tomcat deployment directory it ran fine.

I’m now looking at extending this war to make it do something useful, and Scott has provided me with some sample code of how to do this, so I’ll have a look through this this and will post up here how I’m getting along.

We’ve also arranged to spend a morning face-to-face with Scott so that we can go over any problems we are having with him, as I’m sure many of the problems/issues that Carol and I have been having would be very easily solved f2f. I sure that this will be really valuable, and will save us a lot of time.

Thursday 23 March 06

I’ve had a query from someone looking at running Sled and CopperCore with their students and they have asked me about how to set up the services (eg forum, search etc), and I thought this might be useful for others, so I’m posting my response here…

There are some demo services implemented on our Sled demo site: http://sled.open.ac.uk , but you would probably want to link up sled to your own actual service providers (esp for the forum). There are a variety of different ways in which you could do this (all with varying degrees of work involved!), here’s a basic overview (starting with the option requiring most effort!):

  1. Link the player up to your institutions service provider (or any other provider you would like to use), this would not be insignificant work, as (taking the forum as an example) you would need to write a new class in the CCSI module to “translate” the functions that your service provides to the ones (currently) required by Sled. Out of all three of these options this one requires the most work, and would require some java development on the CCSI module.
  2. Make use of the Moodle forum integration (obviously only relevant if you are just wanting to get a forum service running!), instructions and the code required for this is available on the Sled website. To do this you woul dfirst need to install and setup Moodle, then install our forum code. Finally you would then just update the ccsi.xml configuration file so that the MoodleForumAdapter was used instead of the KNForumAdapter.
  3. This last option is perhaps the easiest to set up, and would involve just updating the Sled XSL files so that rather than connecting to the Sled forum/search interface, you just link out directly to your service provider URL. So for example, you would edit the sled_envtree.xsl file so that when an index-search environment activity was required in the menu, a link to Google would be provided, rather than linking to SearchForm.do – a similar process could be used for linking to another forum application.

You might also want to note that the generic service functions currently provided by CCSI & Sled are quite basic, and were built in mainly to give a working example, though of course there is no reason why this couldn’t be extended further to add in additional functionality.

Wednesday 22 March 06

Finally fixed a little problem we’ve been having on our web servers running ColdFusion where cfgraph tags weren’t displaying the graphs at all, although neither were errors being thrown. It’s not been a big problem, just something that was nice to get finished. I found lots of forum posts from other people having this same issue with cfgraph (and specifically IIS6), and eventually found the ‘right’ solution (well, right for me!), it was to do with the CFIDE not having all the necessary templates included and to fix the problem you need to add a couple of empty files. The full instructions are here: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_18516 and just follow the instructions noted in section 4 ("Create zero-byte files for internal ColdFusion processes").

Tuesday 21 March 06

 I’ve been very quiet for the last couple of weeks on the JoinIn project, mainly as I;ve had a lot of internal OU work to be doing, but I should be getting back into it a little over the next week or so. Had a quick look earlier (and had a couple of emails from) the Minted group at Sussex and Carol there seems to be getting the Cetis-WS working now, so I’ll have a better read through her blog tomorrow and see what I can get running here.

Tuesday 21 March 06

Been a bit slack over the last 2 or 3 weeks getting anything posted up here, as I’ve been away for a few days and most of the work I’ve been doing probably isn’t that interesting to anyone else! I’ve spent a fair bit of time moving a lot of our web and database services over to our new cluster system and getting all of that tested out. I’ve been updating some of the code within the Knowledge Network to make it a bit easier to move. The KN was previously using the eWebEditPro inline html editor, a we’ve had that a fair while now (about 5 years), but we’ve now decided to switch to using the FCKEditor as it seems to be getting a lot of use and seems pretty good (and it’s open source & free!). We’ve been using the FCKEditor on one of our other sites and have had no issues with it- that was using v2 RC3, so I’ve now got it all upgraded to use the most recent version (v2.2). The only slightly fiddly bit was getting the image upload to work exactly how I wanted it, as we’ve got the images on another server to the web cluster, so I had to play around with the security settings.
The other couple of things I’ve done with the KN is finally got it searching PDF documents properly, we’re using SQL Server full text indexing, so inserting the actual files into the database for indexing, so we can also search and filter the results easily (which we couldn’t do with a file system search). Installing the Adobe IFilter for indexing was all a bit of a doddle really!
Finally, the last thing I did was update the external site search. We were previously using Swish to index other sites we wanted to offer search results from, but this of course meant building and maintaining our our indexes of these sites, so I’ve switched over to using the OU’s own search engine to get these results.
All this seems to be working well (so far!)

Friday 3 March 06

I’ve spent the last couple of days sorting out how we’re going to move some of our websites and databases to our new cluster server and database server, this all seems to be going quite well, and I’ve moved 4 of the sites over to the cluster already, but several more to go. Apart from that I’ve spent the last couple of weeks doing work on the JoinIn project and on our internal project planning database.