This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

This Combination tested:#

(Latest versions of everything as at mid-December 2005)
  • Windows 2000 or XP
  • Java 1.5.0_06
  • JBoss 4.0.3 SP1
  • JSPWiki 2.3.57
  • Eclipse 3.1.1 and JBossIDE plugin. (Required for further jspwiki development only).

Assumptions#

  • You are already familiar enough with jboss to know how to get it up and running, and perform basic configuration tasks.

Preliminaries#

  • Remove log4j.jar from the jspwiki.war. This eliminates an error I was getting at startup time. (You want logging to be controlled by jboss log4j logger instance).
  • Comment out the line in jspwiki.properties that sets up the root logger. JBoss controls this, using its own conf/log4j.xml file.
#log4j.rootCategory=INFO,FileLog
  • Deploy the jspwiki.war contents to the correct jboss deploy folder. Recommend exploding the archive, although technically it does work either way. However, jboss will dynamically explode the war if you don't deploy in exploded form. This also means that any changes made to the UserDatabase, if you are using the default config, will be lost when the server is shut down.

Security#

  • By default, jspwiki uses an xml database for usernames, passwords and profile settings. This file is created automatically if necessary.
  • Have a good read of Security2.3.

JAAS Security#

To enable jboss container (jaas) security is pretty straight forward:
  • Uncomment the section in WEB-INF/web.xml as denoted by the comments.
  • Comment out the <resource-ref> section at the bottom unless you are actually using the JDBCUserDatabase. Otherwise you will get a jndi error at server bootup which may prevent jspwiki from properly starting up.
  • The jspwiki.jaas file has to be converted into a jboss-style xml configuration, and appended to jboss's conf/login-config.xml. This will look like this:
    <application-policy name="JSPWiki-container">
      <authentication>
        <login-module  code="com.ecyrd.jspwiki.auth.login.WebContainerLoginModule"
          flag="sufficient"/>
        <login-module  code="com.ecyrd.jspwiki.auth.login.CookieAssertionLoginModule"
          flag="sufficient"/>
        <login-module  code="com.ecyrd.jspwiki.auth.login.AnonymousLoginModule"
          flag="sufficient"/>
      </authentication>
    </application-policy>

    <application-policy name="JSPWiki-custom">
      <authentication>
        <login-module  code="com.ecyrd.jspwiki.auth.login.UserDatabaseLoginModule"
          flag="required"/>
      </authentication>
    </application-policy>
  • Unless you've already changed it, by default JBoss will use a very simple authentication database consisting of two properties files. Add user names and passwords (in the clear) to conf/users.properties and roles to conf/roles.properties. Do not use usernames with embedded periods, as the period is a delimiter in the syntax of roles.properties.

JDBC User Security#

A more sophisticated approach to managing users and wiki profiles is to hold this data in a database instead of xml files. This is quite easy to set up, and you can use a common database for both Jboss's general security as well as the Wiki specific profile settings. In this example, I used a JBoss HSQLDB service to create a simple relational database. The first thing be done is to create the database service in JBoss. This is achieved through the following entries in conf/hsqldb-ds.xml:
<datasources>

   <local-tx-datasource>

      <jndi-name>UserDS</jndi-name>
      <connection-url>jdbc:hsqldb:hsql://localhost:1702</connection-url>
      <driver-class>org.hsqldb.jdbcDriver</driver-class>
      <user-name>sa</user-name>
      <password></password>
      <min-pool-size>5</min-pool-size>
      <max-pool-size>20</max-pool-size>
      <idle-timeout-minutes>0</idle-timeout-minutes>
      <track-statements/>
      <metadata>
         <type-mapping>Hypersonic SQL</type-mapping>
      </metadata>
      <depends>jboss:service=Hypersonic</depends>
   </local-tx-datasource>

   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
     name="jboss:service=Hypersonic">
     <attribute name="Port">1702</attribute>
     <attribute name="Silent">true</attribute>
     <attribute name="Database">userDB</attribute>
     <attribute name="Trace">false</attribute>
     <attribute name="No_system_exit">true</attribute>
   </mbean>


</datasources>
This creates a new database service as well as a jndi data source called 'UserDS'. Once the service is running, you can connect to the database service through the HSQLDB jdbc driver, perhaps using a general purpose tool such as DBVisualizer.

Debugging with Eclipse 3.1.1#

I was able to set up the JBossIDE plugin for Eclipse, checkout jspwiki from the cvs repository, and build in the IDE using the ant script. I was then able to deploy the war file and start up debugging in the IDE. Set a breakpoint in either jsp files or other parts of jspwiki, and away it went! Under Windows, I had to ensure that the jdk\bin directory was on the path otherwise when the build script tries to launch jarsigner.exe it failed.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 18-Dec-2005 11:31 by Milt Taylor.