-
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
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%
-
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.
grant {
permission java.lang.RuntimePermission "accessDeclaredMembers";
-
Register the "jdbc/mydb" DataSource with the application server
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
-
Start the Cloudscape Database Server and J2EE Server
-
Create the Person Table in the database
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)
);
-
Add some users and groups to the security realm
realmtool -addGroup appadmin
realmtool -add drzeus password appadmin
-
Launch the deploytool
deploytool
-
Create an Enterprise Application File (EAR)
File->New Application...
call it personel.ear
-
Add the Personel Web Application to the Enterprise Application
File->Add Web WAR to Application...
selected personel.war
-
Map Users to Security Roles
personel.ear:[Security Tab]:appadmin->Add...
select user:drzeus and group:appadmin and press [OK]
-
Assign the Web Application a context root
personel.ear:[WEB Context Tab]:Personel Application
type "personel" under Context Root
-
Assign the external references to JNDI name(s)
personel.ear:[JNDI names Tab]:Personel Application:jdbc/mydb
type "jdbc/mydb" under JNDI Name
-
Assign the appadmin role permission to access the protected page(s)
Personel Application:[Security Tab]:Security Constraint:Authorized
Roles->Edit...
select appadmin and press OK
-
Put the persistence.xml somewhere where the J2EE Server seems to want to
find it.
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
-
Deploy the Enterprise Application
Tools->Deploy
select Next for each entry
-
Access the application
http://localhost:8000/personel