📄 setup.jsp
字号:
<%
/**
* $RCSfile: setup.jsp,v $
* $Revision: 1.1.1.1 $
* $Date: 2002/09/09 13:50:31 $
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
%>
<%@ page import="java.io.*,
java.util.*,
java.lang.reflect.*"
%>
<%@ include file="include/global.jsp" %>
<%@ include file="include/header.jsp" %>
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td width="1%" valign="top">
<% // set sidebar properties
session.setAttribute("sidebar.0.active", new Boolean(true));
if (!GREEN.equals(getSessionString(session,"sidebar.0.light"))) {
session.setAttribute("sidebar.0.light", YELLOW);
}
%>
<%@ include file="include/sidebar.jsp" %>
</td>
<td width="99%" valign="top">
<b>Welcome to Jive Forums!</b>
<hr size="0">
<font size="-1">
Your server environment must pass all of the following checks before setup
can continue:
</font>
<ul>
<table border="0">
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<font size="-1">
Setup has detected that you are running
<%= application.getServerInfo() %>.
</font>
</td>
</tr>
<% // JDK check. See if they have Java2 or later installed by trying to
// load java.util.HashMap.
boolean isJDK1_2 = true;
try {
Class.forName("java.util.HashMap");
}
catch (ClassNotFoundException cnfe) {
isJDK1_2 = false;
}
if (isJDK1_2) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<font size="-1">
You are running JDK 1.2 or later.
</font>
</td>
</tr>
<% }
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td>
<td>
<font size="-1">
Your version of Java appears to be older than JDK 1.2. Therefore, setup
cannot continue. If possible, upgrade your version of Java and restart
this process.
</font>
</td>
</tr>
<% }
// Servlet version check. The appserver must support at least support
// the Servlet API 2.2.
boolean servlet2_2 = false;
if (application.getMajorVersion() >= 2 && application.getMinorVersion() >= 2) {
servlet2_2 = true;
}
if (servlet2_2) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<font size="-1">
Your server supports servlet version 2.2 or higher.
</font>
</td>
</tr>
<% }
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
<font size="-1">Your server does not appear to support servlet version 2.2 (or higher).</font>
</td></tr>
<%
}
%>
<%
// Jive
boolean jiveInstalled = true;
try { Class.forName("com.jivesoftware.forum.Forum"); }
catch (ClassNotFoundException cnfe) { jiveInstalled = false; }
// Lucene
boolean luceneInstalled = true;
try { Class.forName("com.lucene.document.Document"); }
catch (ClassNotFoundException cnfe) { luceneInstalled = false; }
// JavaMail
boolean javaMailInstalled = true;
try {
Class.forName("javax.mail.Address"); // mail.jar
Class.forName("javax.activation.DataHandler"); // activation.jar
Class.forName("dog.mail.nntp.Newsgroup"); // nntp.jar
}
catch (ClassNotFoundException cnfe) { javaMailInstalled = false; }
// JDBC std ext
boolean jdbcExtInstalled = true;
try { Class.forName("javax.sql.DataSource"); }
catch (ClassNotFoundException cnfe) { jdbcExtInstalled = false; }
boolean filesOK = jiveInstalled && luceneInstalled && javaMailInstalled &&
jdbcExtInstalled;
if (filesOK) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td><td>
<font size="-1">All application JAR files are installed correctly.
<% }
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
<font size="-1">One or more JAR application files is not installed.
<% } %>
<ul>
<img src="images/<%= jiveInstalled?"check.gif":"x.gif" %>" width="13" height="13">
Jive Forums core (jive.jar)
<br> <img src="images/<%= luceneInstalled?"check.gif":"x.gif" %>" width="13" height="13">
Lucene (lucene.jar)
<br> <img src="images/<%= javaMailInstalled?"check.gif":"x.gif" %>" width="13" height="13">
JavaMail and NNTP Provider (mail.jar, activation.jar, and nntp.jar)
<br> <img src="images/<%= jdbcExtInstalled?"check.gif":"x.gif" %>" width="13" height="13">
JDBC 2.0 Extensions (jdbc2_0-stdext.jar)
</ul>
</font>
</td></tr>
<%
//Check the status of JiveHome
boolean propError = false;
String errorMessage = null;
String jiveHome = null;
try {
Class jiveGlobals = Class.forName("com.jivesoftware.forum.JiveGlobals");
Method getJiveHome = jiveGlobals.getMethod("getJiveHome", null);
jiveHome = (String)getJiveHome.invoke(null, null);
if (jiveHome != null) {
// See if the jiveHome directory actually exists
try {
File file = new File(jiveHome);
if (!file.exists()) {
propError = true;
errorMessage = "The directory <tt>" + jiveHome + "</tt> " +
"does not exist. Please edit the <tt>jive_init.properties</tt> file " +
"to include the correct path to your jiveHome directory.";
}
}
catch (Exception e) {}
if (!propError) {
// See if jiveHome is readable and writable.
Method jiveHomeReadable = jiveGlobals.getMethod("isJiveHomeReadable", null);
boolean readable = ((Boolean)jiveHomeReadable.invoke(null, null)).booleanValue();
if (!readable) {
propError = true;
errorMessage = "The <tt>jiveHome</tt> appears to exist at <tt>" + jiveHome +
"</tt>, but your server does not have read access to it. Set the appropriate " +
"permissions on the directory to fix the problem.";
}
Method jiveHomeWritable = jiveGlobals.getMethod("isJiveHomeWritable", null);
boolean writable = ((Boolean)jiveHomeWritable.invoke(null, null)).booleanValue();
if (!writable) {
propError = true;
errorMessage = "The <tt>jiveHome</tt> directory appears to exist at <tt>" + jiveHome +
"</tt>, but your server does not have write access to it. Set the appropriate " +
"permissions on the directory to fix the problem.";
}
// Jive Home appears to exist and to be setup correctly. Make sure that all of the proper sub-dirs exist
// or create them as necessary.
File homeFile = new File(jiveHome);
String [] subDirs = new String [] { "search", "logs", "data" };
for (int i=0; i<subDirs.length; i++) {
File subDir = new File(jiveHome, subDirs[i]);
if (!subDir.exists()) {
subDir.mkdir();
}
}
}
}
else {
propError = true;
errorMessage = "The <tt>jiveHome</tt> directory is not properly specified. Please follow the " +
"Jive Forums documentation to ensure that the <tt>jive_init.properties</tt> file is " +
"configured correctly.";
}
}
catch (Exception e) {
e.printStackTrace();
propError = true;
errorMessage = "There was a general error checking the configuration of the <tt>jiveHome</tt> directory. " +
"Be sure that you have installed the latest Jive Forums code.";
}
if (!propError) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td><td>
<font size="-1">The</font> <tt>jiveHome</tt> <font size="-1">directory is properly configured and exists
at: </font><tt><%= jiveHome %></tt>.
</td></tr>
<%
}
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
<font size="-1"><%= errorMessage %><font>
</td></tr>
<%
}
%>
</table>
</ul>
<%
if (propError || !filesOK || !isJDK1_2 || !servlet2_2) {
%>
<font color="red" size="-1"><b>One or more errors occured in the initial setup checklist. Please correct
them, restart your application server, and then reload this page.</b></font>
<%
}
else {
// everything is ok, so update the sidebar variables in the session:
session.setAttribute("sidebar.0.light", GREEN);
%>
</font>
<form action="setup2.jsp">
<hr size="0">
<div align="center">
<input type="submit" value="Continue">
</form>
</div>
<%
}
%>
<jsp:include page="include/footer.jsp" flush="true"/>
</td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -