Deploying the Personel Application on the J2EE Reference Server

  1. Update the environment of the J2EE Server so that it uses the newer XML classes referenced by the web application. These seem to conflict with the ones located in j2ee.jar

  2. file: setenv.bat
    set XALAN_HOME=c:\xalan
    set XMLJARS=%XALAN_HOME%\xerces.jar;%XALAN_HOME%\xalan.jar
    set CPATH=%CLASSESDIR%;%LOCALEDIR%;%XMLJARS%;%J2EEJARS%;%SYSTEMJARS%;.;%J2EE_CLASSPATH%;%CLOUDJARS%;%JAVAHELPJARS%
     
  3. Add some necessary accesses to lib/security/server.policy. I don't know extactly what this is needed for, but its late and it did the trick. I was getting access errors prior to adding this when I tried to access the DataSource.

  4. grant {
        permission java.lang.RuntimePermission "accessDeclaredMembers";
     
  5. Register the "jdbc/mydb" DataSource with the application server

  6. In file config.default.properties, make sure something like this is entered. Use your petStore entry as an example
    jdbc.datasources=jdbc/mydb|jdbc:cloudscape:rmi:CloudscapeDB;create=true
    -or-
    jdbc.datasources=jdbc/EstoreDB|jdbc:cloudscape:rmi:CloudscapeDB;create=true|jdbc/InventoryDB|jdbc:cloudscape:rmi:CloudscapeDB;create=true|jdbc/mydb|jdbc:cloudscape:rmi:CloudscapeDB;create=true
     
  7. Start the Cloudscape Database Server and J2EE Server
  8. Create the Person Table in the database

  9. The following is my attempt at converting the createJ2EEPersonel.pl script to a DOS .bat file. There may be errors in the translation.

    set J2EE_HOME=c:/j2sdkee1.2.1
    set CLOUD_HOME=%J2EE_HOME%/cloudscape
    set CLOUD_LIB=%J2EE_HOME%/lib/cloudscape

    set classpath=%CLOUD_LIB%/client.jar
    set classpath=%classpath%;%CLOUD_LIB%/tools.jar
    set classpath=%classpath%;%CLOUD_LIB%/cloudscape.jar
    set classpath=%classpath%;%CLOUD_LIB%/RmiJdbc.jar
    set classpath=%classpath%;%CLOUD_LIB%/license.jar

    set javaProps=-Dcloudscape.system.home=%CLOUD_HOME%
    set javaProps=%javaProps% -Dij.protocol=jdbc:cloudscape:
    set javaProps=%javaProps% -classpath %classpath%

    set javaClass=COM.cloudscape.tools.ij
    set javaArgs=personel_cloudscape.ddl

    set javaCommand=java %javaProps% %javaClass% %javaArgs%

    %javaCommand%

    The .ddl file looks something like this
    connect 'jdbc:rmi://localhost:1099/jdbc:cloudscape:CloudscapeDB;create=true'
    ;
    drop table Person
    ;
    create table Person (
       id int not null,
       fname varchar(80) not null,
       lname varchar(80) not null,
       address varchar(80) null,
       phone char(10) null,
       constraint pk_Person primary key(id)
    );
     

  10. Add some users and groups to the security realm

  11. realmtool -addGroup appadmin
    realmtool -add drzeus password appadmin
     
  12. Launch the deploytool

  13. deploytool
     
  14. Create an Enterprise Application File (EAR)

  15. File->New Application...
    call it personel.ear
     
  16. Add the Personel Web Application to the Enterprise Application

  17. File->Add Web WAR to Application...
    selected personel.war
     
  18. Map Users to Security Roles

  19. personel.ear:[Security Tab]:appadmin->Add...
    select user:drzeus and group:appadmin and press [OK]
     
  20. Assign the Web Application a context root

  21. personel.ear:[WEB Context Tab]:Personel Application
    type "personel" under Context Root
     
  22. Assign the external references to JNDI name(s)

  23. personel.ear:[JNDI names Tab]:Personel Application:jdbc/mydb
    type "jdbc/mydb" under JNDI Name
     
  24. Assign the appadmin role permission to access the protected page(s)

  25. Personel Application:[Security Tab]:Security Constraint:Authorized Roles->Edit...
    select appadmin and press OK
     
  26. Put the persistence.xml somewhere where the J2EE Server seems to want to find it.

  27. create a jar file contianing the ejava/webui/personel/web/persistence.xml
    personel:[General Tab]->Add Library Jar...
    input the location of the jar file contianing persistence.xml
     
  28. Deploy the Enterprise Application

  29. Tools->Deploy
    select Next for each entry
     
  30. Access the application

  31. http://localhost:8000/personel