Compiling WebMail Examples
There are two versions of the Java 2 Platform available, the Standard and the Enterprise Editions. To compile and run the code examples in this book the Standard Edition will provide you with almost everything you need, except the JDBC Standard Extension which must be downloaded seperately.
The JavaTM 2 Platform Standard Edition v1.3 is available for download for Solaris (2.6/7/8), Linux and Microsoft Windows (95/98/2000/NT 4.0) from http://java.sun.com/j2se/1.3/. To get access to the downloads you may need to register as a member of the Java Developer Connection, which is free.
If you have any questions or problems regarding the download of the Java Software Development Kit, have a look at the Downloading FAQ at http://java.sun.com/feedback/faq/downloading.html
For the two Unix operating systems you'll need to ensure the following steps, not included in the install guides, have been completed to ensure that the Java SDK is properly configured.
$ set path $ set classpath
Operating System | Release | Installation Guide |
---|---|---|
Linux | http://developer.java.sun.com/developer/earlyAccess/j2sdk13/install-linux-re.html | |
Solaris | http://developer.java.sun.com/developer/earlyAccess/j2sdk13/install-solaris.html | |
Windows | http://java.sun.com/j2se/1.3/install-windows.html |
Once you've completed the download and finished the configuration you might like to test your Java installation by running one of the demo programs. They can be found under the directory /demo
in your java installation. If you're running a Windowing environment (Windows, X Windows or maybe MacOS) try the following demo:
java -jar Java2Demo.jar
which can be found under /demo/jfc/Java2D/
Detailed documentation for the Java Software Development Kit v1.3 is available on-line at http://java.sun.com/j2se/1.3/docs/. Alternatively this documentation can be download in HTML format from http://developer.java.sun.com/developer/earlyAccess/j2sdk13/docs.html
java
.
Tomcat, part of the Jakarta Project, is an implementation of Java Servlet and JavaServer Pages specifications. The TomCat homepage is located at http://jakarta.apache.org/ and from here you can download either the binaries or the source code.
It is our hearty recommendation that you read through the Minimalistic User's Guide before or while you download Tomcat. This Guide is deliberately concise but starts with a discussion of the three possible configurations when using Tomcat and, in some cases, the additional software required to support these differing configurations. It also includes instructions on how to install the Tomcat binaries.
At it's simplist, you need only download the binaries and set the TOMCAT_HOME environment variable to have a runable stand-alone servlet container.
set TOMCAT_HOME env variable
The examples in this book utilise combinations of the following extentions and APIs. To be able to successfully run all the examples in this book you will need to have in place the following:
* This is extention is included in the Java 2 Enterprise Edition, but not in the Java 2 Standard Edition.
All these extentsion will download as a compressed archive which will need to be uncompressed. The README file that accompanies most of these downloads should be you first port of call. They will provide you with help relating to their installation. Essentially they will contain supporting documentation and a Java jar
archive which needs to be locatable by the Java compiler(?).
It is usual to add the full path pointing each extension's jar
file to the environment variable CLASSPATH. But you may prefer to copy the jar
to the Java Runtime Environment's extension directory jre/lib/ext/
(or a symbolic link) instead of creating a sprawling CLASSPATH.
Oracle provides documentation detailing how to configure CORBA and EJB in Oracle's JServer. This discussion can be found in the Oracle 8i Enterprise JavaBeans and CORBA Developer's Guide under Chapter 4, Connections and Security. It is also available on-line at http://oradoc.photo.net/ora816/java.816/a81356/connsec.htm#1003139.
The minimum installation details the two following steps:
mts_dispatchers=\"(protocol=tcps)(presentation=oracle.aurora.server.SGiopServer)"
to the database's init.ora
(pfile).
listener.ora
config file.
listener= (description_list= (description= (address=(protocol=tcp)(host=sales1-server)(port=2481)) (protocol_stack= (presentation=giop) (session=raw) ) ) )
When running EJB clients on Linux, you must use the JRE supplied with Oracle (IBM JRE) and not the Sun JDK which we use elsewhere in the book.
A quick check to see if JServer has been installed into the database you wish to use can be performed by logging in to the database via SQL*Plus. Look for the JServer Release information.
Connected to: Oracle8i Enterprise Edition Release 8.1.6.1.0 - Production With the Partitioning option JServer Release 8.1.6.0.0 - Production SQL>
Next check to see if the listener has been set up to accept the Internet Inter-ORB Protocol (IIOP). Issuing the following:
sess_sh -user-password -service sess_iiop:// : :
e.g.
sess_sh -user ****** -password ******* -service sess_iiop://192.168.0.5:2481:atst
You should expect to see the following prmopt:
--Aurora/ORB Session Shell-- --type "help" at the command line for help message $
If you should need to install JServer then you can find a guide on how to do a manual installation in the Oracle8i Java Developer's Guide Release 2 (8.1.6), in Chapter 4 - Java Installation and Configuration. This documentation is also available on-line at http://oradoc.photo.net/ora816/java.816/a81353/05config.htm#1006897.
When installing JServer it's likely you will need >160mb free in the system table and you need keep an eye on the size and usage of your rollback segments during the install.
Make sure you include the following in the classpath:
export CLASSPATH=$CLASSPATH:$ORACLE_HOME/jdbc/lib/classes12_01.zip:$ORACLE_HOME/sqlj/lib/runtime.zip:$ORACLE_HOME/sqlj/lib/translator.zip:$ORACLE_HOME/JRE/lib/mail.jar:$ORACLE_HOME/JRE/lib/activation.jar
You may also need
call dbms_java.grant_permission('scott',
2 'java.io.FilePermission',
3 '/home/oracle/msgtst.txt',
4 'read');
if you see something like the following
SQL> call insertMessage('/home/oracle/tstmsg.txt');
java.security.AccessControlException: the Permission (java.io.FilePermission
/home/oracle/tstbsg.txt read) has not been granted by dbms_java.grant_permission
to SchemaProtectionDomain(SCOTT|PolicyTableProxy(SCOTT))
at java.security.AccessControlContext.checkPermission(AccessControlContext.java)
at java.security.AccessController.checkPermission(AccessController.java)
at java.lang.SecurityManager.checkPermission(SecurityManager.java)
at
oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java
)
at java.lang.SecurityManager.checkRead(SecurityManager.java)
at java.io.FileInputStream.(FileInputStream.java)
at java.io.FileInputStream.(FileInputStream.java)
at MailSystem.insertMessage(MailSystem.java:261)
Call completed.
If you want the permission setting to apply to a directory rather than a file,
try using '/home/oracle/*
.
Not seeing as much information returned from select
queries as you'd
expected? Try set long 10000
.