0 Replies Latest reply on Oct 18, 2002 2:45 AM by Jonathan Hull

    JBoss 3.0.2 and Firebird - how to get the Template

    Jonathan Hull Newbie

      Hi all,

      Disclaimer : I am new to JBoss (but not J2EE) so the following is just based on my own experiences. I am not really in a position to advise if my suggestions don't help, however I would love to hear of any improvements to my advice.

      I just suceeded getting the above to play together and sucessfully run the template web client to generate records. This took a bit of investigation, configuration, and trial and error so I thought in the spirit of Open Source I would write up my discoveries so someone else may benefit.

      I wanted to start with a persistent DB, so I created one in %JBOSS_HOME%\server\default\db\ibphoenix. I experienced problems using a Dialect 1 DB which went away once I switched the DB to Dialect 3. I recommend using Dialect 3 only.

      If you're like me you will like to use Firebird with a different username and password to the standard SYSDBA | masterkey. Remember to change these values in the appropriate places in in login-config.xml and firebird-service.xml.

      I noted that by changing the name of the data source from FirebirdDS to something else, there were quite a few other config files that you needed to adjust so I left it as it was - it's easier to personalize once things are working.

      At this point I thought it I placed the configured firebird-service.xml and firebirdsql.rar into %JBOSS_HOME%\server\default\deploy and promptly got a the error "org.jboss.deployment.DeploymentException: jboss.jca:service=FirebirdManager is not registered". This turns out to be due to the order of loading of the firebird files, and can be easily tested by leaving starting JBoss with the .rar in deploy but not firebird-service.xml, then placing firebird-service.xml into deploy once the AS has completed startup.
      The fix for this problem is to ensure the rar is loaded first by :
      - renaming firebirdsql.rar to 10firebirdsql.rar (or 001firebirdsql.rar ...)
      - renaming firebird-service.xml to 20firebird-service.xml (or 002firebird-service.xml...)
      - editing the %JBOSS_HOME%\server\default\conf\jboss-service.xml ,
      replacing :
      with :

      Restarting JBoss should now load things in the correct order and only warnings about "FirebirdDS does not implement any Service methods" should show in the log.

      Now, time to attempt the Template example and see if CMP can operate.

      I did not set the DefaultDS to firebird in standardjaws.xml, so the .ant.properties file in %JBOSS_EXAMPLES%\Template needed to change the following :
      The rest of the changes to this file should be obvious. I did however ensure that I uncommented the line to create the .war as I wanted to web-test JBoss J2EE.

      The next (and not so obvious) change necessary was to ensure the Template CMP maps the entitiy's 'password' property to a field in firebird that is not called 'Password', as firebird doesn't like it - it's a reserved word. I chose to call the field 'Passwrd' on the least typing principle. This is accomplished by editing the %JBOSS_EXAMPLES%\Template\src\main\ejb\test\entity\TestEntityBean.java file.
      Replace :
      * @jboss:column-name name="Password"
      with :
      * @jboss:column-name name="Passwrd"
      or whatever you want to call it.

      Finally, you need the Ant output files to be loaded in the deploy directory after the firebird rar and xml (see above). To acomplish this, edit the %JBOSS_EXAMPLES%\Template\build.xml file.
      Replace :
      with :
      and :
      with :

      Now, all you need to do (unless I forgot a step or 2) is do the Ant build - this should deploy the app and you should see all sorts of exciting things (if noy, don't forget about the debug flag in standardjaws.xml). If all goes as well with you as it finally did with me, you should be able to test the app by going to : http://localhost:8080/web-client/index.jsp

      Good Luck :)