1 |
2778
|
jones
|
<html>
|
2 |
|
|
<%@ page contentType="text/html; charset=utf-8"
|
3 |
|
|
import="java.io.InputStream,
|
4 |
|
|
java.io.IOException,
|
5 |
|
|
javax.xml.parsers.SAXParser,
|
6 |
|
|
java.lang.reflect.*,
|
7 |
|
|
javax.xml.parsers.SAXParserFactory"
|
8 |
|
|
session="false" %>
|
9 |
|
|
<%
|
10 |
|
|
/*
|
11 |
|
|
* Copyright 2002,2004,2005 The Apache Software Foundation.
|
12 |
|
|
*
|
13 |
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14 |
|
|
* you may not use this file except in compliance with the License.
|
15 |
|
|
* You may obtain a copy of the License at
|
16 |
|
|
*
|
17 |
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18 |
|
|
*
|
19 |
|
|
* Unless required by applicable law or agreed to in writing, software
|
20 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 |
|
|
* See the License for the specific language governing permissions and
|
23 |
|
|
* limitations under the License.
|
24 |
|
|
*/
|
25 |
|
|
%>
|
26 |
|
|
|
27 |
|
|
<%!
|
28 |
|
|
/*
|
29 |
|
|
* Happiness tests for axis. These look at the classpath and warn if things
|
30 |
|
|
* are missing. Normally addng this much code in a JSP page is mad
|
31 |
|
|
* but here we want to validate JSP compilation too, and have a drop-in
|
32 |
|
|
* page for easy re-use
|
33 |
|
|
* @author Steve 'configuration problems' Loughran
|
34 |
|
|
* @author dims
|
35 |
|
|
* @author Brian Ewins
|
36 |
|
|
*/
|
37 |
|
|
|
38 |
|
|
/**
|
39 |
|
|
* test for a class existing
|
40 |
|
|
* @param classname
|
41 |
|
|
* @return class iff present
|
42 |
|
|
*/
|
43 |
|
|
Class classExists(String classname) {
|
44 |
|
|
try {
|
45 |
|
|
return Class.forName(classname);
|
46 |
|
|
} catch (ClassNotFoundException e) {
|
47 |
|
|
return null;
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
/**
|
52 |
|
|
* test for resource on the classpath
|
53 |
|
|
* @param resource
|
54 |
|
|
* @return true iff present
|
55 |
|
|
*/
|
56 |
|
|
boolean resourceExists(String resource) {
|
57 |
|
|
boolean found;
|
58 |
|
|
InputStream instream=this.getClass().getResourceAsStream(resource);
|
59 |
|
|
found=instream!=null;
|
60 |
|
|
if(instream!=null) {
|
61 |
|
|
try {
|
62 |
|
|
instream.close();
|
63 |
|
|
} catch (IOException e) {
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
|
|
return found;
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
/**
|
70 |
|
|
* probe for a class, print an error message is missing
|
71 |
|
|
* @param out stream to print stuff
|
72 |
|
|
* @param category text like "warning" or "error"
|
73 |
|
|
* @param classname class to look for
|
74 |
|
|
* @param jarFile where this class comes from
|
75 |
|
|
* @param errorText extra error text
|
76 |
|
|
* @param homePage where to d/l the library
|
77 |
|
|
* @return the number of missing classes
|
78 |
|
|
* @throws IOException
|
79 |
|
|
*/
|
80 |
|
|
int probeClass(JspWriter out,
|
81 |
|
|
String category,
|
82 |
|
|
String classname,
|
83 |
|
|
String jarFile,
|
84 |
|
|
String description,
|
85 |
|
|
String errorText,
|
86 |
|
|
String homePage) throws IOException {
|
87 |
|
|
try {
|
88 |
|
|
Class clazz = classExists(classname);
|
89 |
|
|
if(clazz == null) {
|
90 |
|
|
String url="";
|
91 |
|
|
if(homePage!=null) {
|
92 |
|
|
url=getMessage("seeHomepage",homePage,homePage);
|
93 |
|
|
}
|
94 |
|
|
out.write(getMessage("couldNotFound",category,classname,jarFile,errorText,url));
|
95 |
|
|
return 1;
|
96 |
|
|
} else {
|
97 |
|
|
String location = getLocation(out, clazz);
|
98 |
|
|
|
99 |
|
|
if(location == null) {
|
100 |
|
|
out.write("<li>"+getMessage("foundClass00",description,classname)+"</li><br>");
|
101 |
|
|
}
|
102 |
|
|
else {
|
103 |
|
|
out.write("<li>"+getMessage("foundClass01",description,classname,location)+"</li><br>");
|
104 |
|
|
}
|
105 |
|
|
return 0;
|
106 |
|
|
}
|
107 |
|
|
} catch(NoClassDefFoundError ncdfe) {
|
108 |
|
|
String url="";
|
109 |
|
|
if(homePage!=null) {
|
110 |
|
|
url=getMessage("seeHomepage",homePage,homePage);
|
111 |
|
|
}
|
112 |
|
|
out.write(getMessage("couldNotFoundDep",category, classname, errorText, url));
|
113 |
|
|
out.write(getMessage("theRootCause",ncdfe.getMessage(), classname));
|
114 |
|
|
return 1;
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
/**
|
119 |
|
|
* get the location of a class
|
120 |
|
|
* @param out
|
121 |
|
|
* @param clazz
|
122 |
|
|
* @return the jar file or path where a class was found
|
123 |
|
|
*/
|
124 |
|
|
|
125 |
|
|
String getLocation(JspWriter out,
|
126 |
|
|
Class clazz) {
|
127 |
|
|
try {
|
128 |
|
|
java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
|
129 |
|
|
String location = url.toString();
|
130 |
|
|
if(location.startsWith("jar")) {
|
131 |
|
|
url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
|
132 |
|
|
location = url.toString();
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
if(location.startsWith("file")) {
|
136 |
|
|
java.io.File file = new java.io.File(url.getFile());
|
137 |
|
|
return file.getAbsolutePath();
|
138 |
|
|
} else {
|
139 |
|
|
return url.toString();
|
140 |
|
|
}
|
141 |
|
|
} catch (Throwable t){
|
142 |
|
|
}
|
143 |
|
|
return getMessage("classFoundError");
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
/**
|
147 |
|
|
* a class we need if a class is missing
|
148 |
|
|
* @param out stream to print stuff
|
149 |
|
|
* @param classname class to look for
|
150 |
|
|
* @param jarFile where this class comes from
|
151 |
|
|
* @param errorText extra error text
|
152 |
|
|
* @param homePage where to d/l the library
|
153 |
|
|
* @throws IOException when needed
|
154 |
|
|
* @return the number of missing libraries (0 or 1)
|
155 |
|
|
*/
|
156 |
|
|
int needClass(JspWriter out,
|
157 |
|
|
String classname,
|
158 |
|
|
String jarFile,
|
159 |
|
|
String description,
|
160 |
|
|
String errorText,
|
161 |
|
|
String homePage) throws IOException {
|
162 |
|
|
return probeClass(out,
|
163 |
|
|
"<b>"+getMessage("error")+"</b>",
|
164 |
|
|
classname,
|
165 |
|
|
jarFile,
|
166 |
|
|
description,
|
167 |
|
|
errorText,
|
168 |
|
|
homePage);
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
/**
|
172 |
|
|
* print warning message if a class is missing
|
173 |
|
|
* @param out stream to print stuff
|
174 |
|
|
* @param classname class to look for
|
175 |
|
|
* @param jarFile where this class comes from
|
176 |
|
|
* @param errorText extra error text
|
177 |
|
|
* @param homePage where to d/l the library
|
178 |
|
|
* @throws IOException when needed
|
179 |
|
|
* @return the number of missing libraries (0 or 1)
|
180 |
|
|
*/
|
181 |
|
|
int wantClass(JspWriter out,
|
182 |
|
|
String classname,
|
183 |
|
|
String jarFile,
|
184 |
|
|
String description,
|
185 |
|
|
String errorText,
|
186 |
|
|
String homePage) throws IOException {
|
187 |
|
|
return probeClass(out,
|
188 |
|
|
"<b>"+getMessage("warning")+"</b>",
|
189 |
|
|
classname,
|
190 |
|
|
jarFile,
|
191 |
|
|
description,
|
192 |
|
|
errorText,
|
193 |
|
|
homePage);
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
/**
|
197 |
|
|
* get servlet version string
|
198 |
|
|
*
|
199 |
|
|
*/
|
200 |
|
|
|
201 |
|
|
public String getServletVersion() {
|
202 |
|
|
ServletContext context=getServletConfig().getServletContext();
|
203 |
|
|
int major = context.getMajorVersion();
|
204 |
|
|
int minor = context.getMinorVersion();
|
205 |
|
|
return Integer.toString(major) + '.' + Integer.toString(minor);
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
/**
|
209 |
|
|
* what parser are we using.
|
210 |
|
|
* @return the classname of the parser
|
211 |
|
|
*/
|
212 |
|
|
private String getParserName() {
|
213 |
|
|
SAXParser saxParser = getSAXParser();
|
214 |
|
|
if (saxParser == null) {
|
215 |
|
|
return getMessage("couldNotCreateParser");
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
// check to what is in the classname
|
219 |
|
|
String saxParserName = saxParser.getClass().getName();
|
220 |
|
|
return saxParserName;
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
/**
|
224 |
|
|
* Create a JAXP SAXParser
|
225 |
|
|
* @return parser or null for trouble
|
226 |
|
|
*/
|
227 |
|
|
private SAXParser getSAXParser() {
|
228 |
|
|
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
|
229 |
|
|
if (saxParserFactory == null) {
|
230 |
|
|
return null;
|
231 |
|
|
}
|
232 |
|
|
SAXParser saxParser = null;
|
233 |
|
|
try {
|
234 |
|
|
saxParser = saxParserFactory.newSAXParser();
|
235 |
|
|
} catch (Exception e) {
|
236 |
|
|
}
|
237 |
|
|
return saxParser;
|
238 |
|
|
}
|
239 |
|
|
|
240 |
|
|
/**
|
241 |
|
|
* get the location of the parser
|
242 |
|
|
* @return path or null for trouble in tracking it down
|
243 |
|
|
*/
|
244 |
|
|
|
245 |
|
|
private String getParserLocation(JspWriter out) {
|
246 |
|
|
SAXParser saxParser = getSAXParser();
|
247 |
|
|
if (saxParser == null) {
|
248 |
|
|
return null;
|
249 |
|
|
}
|
250 |
|
|
String location = getLocation(out,saxParser.getClass());
|
251 |
|
|
return location;
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
/**
|
255 |
|
|
* Check if class implements specified interface.
|
256 |
|
|
* @param Class clazz
|
257 |
|
|
* @param String interface name
|
258 |
|
|
* @return boolean
|
259 |
|
|
*/
|
260 |
|
|
private boolean implementsInterface(Class clazz, String interfaceName) {
|
261 |
|
|
if (clazz == null) {
|
262 |
|
|
return false;
|
263 |
|
|
}
|
264 |
|
|
Class[] interfaces = clazz.getInterfaces();
|
265 |
|
|
if (interfaces.length != 0) {
|
266 |
|
|
for (int i = 0; i < interfaces.length; i++) {
|
267 |
|
|
if (interfaces[i].getName().equals(interfaceName)) {
|
268 |
|
|
return true;
|
269 |
|
|
}
|
270 |
|
|
}
|
271 |
|
|
}
|
272 |
|
|
return false;
|
273 |
|
|
}
|
274 |
|
|
%>
|
275 |
|
|
|
276 |
|
|
<%@ include file="i18nLib.jsp" %>
|
277 |
|
|
|
278 |
|
|
<%
|
279 |
|
|
// initialize a private HttpServletRequest
|
280 |
|
|
setRequest(request);
|
281 |
|
|
|
282 |
|
|
// set a resouce base
|
283 |
|
|
setResouceBase("i18n");
|
284 |
|
|
%>
|
285 |
|
|
|
286 |
|
|
<head>
|
287 |
|
|
<title><%= getMessage("pageTitle") %></title>
|
288 |
|
|
</head>
|
289 |
|
|
<body bgcolor='#ffffff'>
|
290 |
|
|
|
291 |
|
|
<%
|
292 |
|
|
out.print("<h1>"+ getMessage("pageTitle") +"</h1>");
|
293 |
|
|
out.print("<h2>"+ getMessage("pageRole") +"</h2><p/>");
|
294 |
|
|
%>
|
295 |
|
|
|
296 |
|
|
<%= getLocaleChoice() %>
|
297 |
|
|
|
298 |
|
|
<%
|
299 |
|
|
out.print("<h3>"+ getMessage("neededComponents") +"</h3>");
|
300 |
|
|
%>
|
301 |
|
|
|
302 |
|
|
<UL>
|
303 |
|
|
<%
|
304 |
|
|
int needed=0,wanted=0;
|
305 |
|
|
|
306 |
|
|
/**
|
307 |
|
|
* the essentials, without these Axis is not going to work
|
308 |
|
|
*/
|
309 |
|
|
|
310 |
|
|
// need to check if the available version of SAAJ API meets requirements
|
311 |
|
|
String className = "javax.xml.soap.SOAPPart";
|
312 |
|
|
String interfaceName = "org.w3c.dom.Document";
|
313 |
|
|
Class clazz = classExists(className);
|
314 |
|
|
if (clazz == null || implementsInterface(clazz, interfaceName)) {
|
315 |
|
|
needed = needClass(out, "javax.xml.soap.SOAPMessage",
|
316 |
|
|
"saaj.jar",
|
317 |
|
|
"SAAJ API",
|
318 |
|
|
getMessage("criticalErrorMessage"),
|
319 |
|
|
"http://ws.apache.org/axis/");
|
320 |
|
|
} else {
|
321 |
|
|
String location = getLocation(out, clazz);
|
322 |
|
|
|
323 |
|
|
out.print(getMessage("invalidSAAJ",location));
|
324 |
|
|
out.print(getMessage("criticalErrorMessage"));
|
325 |
|
|
out.print(getMessage("seeHomepage","http://ws.apache.org/axis/java/install.html",getMessage("axisInstallation")));
|
326 |
|
|
out.print("<br>");
|
327 |
|
|
}
|
328 |
|
|
|
329 |
|
|
needed+=needClass(out, "javax.xml.rpc.Service",
|
330 |
|
|
"jaxrpc.jar",
|
331 |
|
|
"JAX-RPC API",
|
332 |
|
|
getMessage("criticalErrorMessage"),
|
333 |
|
|
"http://ws.apache.org/axis/");
|
334 |
|
|
|
335 |
|
|
needed+=needClass(out, "org.apache.axis.transport.http.AxisServlet",
|
336 |
|
|
"axis.jar",
|
337 |
|
|
"Apache-Axis",
|
338 |
|
|
getMessage("criticalErrorMessage"),
|
339 |
|
|
"http://ws.apache.org/axis/");
|
340 |
|
|
|
341 |
|
|
needed+=needClass(out, "org.apache.commons.discovery.Resource",
|
342 |
|
|
"commons-discovery.jar",
|
343 |
|
|
"Jakarta-Commons Discovery",
|
344 |
|
|
getMessage("criticalErrorMessage"),
|
345 |
|
|
"http://jakarta.apache.org/commons/discovery/");
|
346 |
|
|
|
347 |
|
|
needed+=needClass(out, "org.apache.commons.logging.Log",
|
348 |
|
|
"commons-logging.jar",
|
349 |
|
|
"Jakarta-Commons Logging",
|
350 |
|
|
getMessage("criticalErrorMessage"),
|
351 |
|
|
"http://jakarta.apache.org/commons/logging/");
|
352 |
|
|
|
353 |
|
|
needed+=needClass(out, "org.apache.log4j.Layout",
|
354 |
|
|
"log4j-1.2.8.jar",
|
355 |
|
|
"Log4j",
|
356 |
|
|
getMessage("uncertainErrorMessage"),
|
357 |
|
|
"http://jakarta.apache.org/log4j");
|
358 |
|
|
|
359 |
|
|
//should we search for a javax.wsdl file here, to hint that it needs
|
360 |
|
|
//to go into an approved directory? because we dont seem to need to do that.
|
361 |
|
|
needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl",
|
362 |
|
|
"wsdl4j.jar",
|
363 |
|
|
"IBM's WSDL4Java",
|
364 |
|
|
getMessage("criticalErrorMessage"),
|
365 |
|
|
null);
|
366 |
|
|
|
367 |
|
|
needed+=needClass(out, "javax.xml.parsers.SAXParserFactory",
|
368 |
|
|
"xerces.jar",
|
369 |
|
|
"JAXP implementation",
|
370 |
|
|
getMessage("criticalErrorMessage"),
|
371 |
|
|
"http://xml.apache.org/xerces-j/");
|
372 |
|
|
|
373 |
|
|
needed+=needClass(out,"javax.activation.DataHandler",
|
374 |
|
|
"activation.jar",
|
375 |
|
|
"Activation API",
|
376 |
|
|
getMessage("criticalErrorMessage"),
|
377 |
|
|
"http://java.sun.com/products/javabeans/glasgow/jaf.html");
|
378 |
|
|
%>
|
379 |
|
|
</UL>
|
380 |
|
|
<%
|
381 |
|
|
out.print("<h3>"+ getMessage("optionalComponents") +"</h3>");
|
382 |
|
|
%>
|
383 |
|
|
<UL>
|
384 |
|
|
<%
|
385 |
|
|
/*
|
386 |
|
|
* now the stuff we can live without
|
387 |
|
|
*/
|
388 |
|
|
wanted+=wantClass(out,"javax.mail.internet.MimeMessage",
|
389 |
|
|
"mail.jar",
|
390 |
|
|
"Mail API",
|
391 |
|
|
getMessage("attachmentsError"),
|
392 |
|
|
"http://java.sun.com/products/javamail/");
|
393 |
|
|
|
394 |
|
|
wanted+=wantClass(out,"org.apache.xml.security.Init",
|
395 |
|
|
"xmlsec.jar",
|
396 |
|
|
"XML Security API",
|
397 |
|
|
getMessage("xmlSecurityError"),
|
398 |
|
|
"http://xml.apache.org/security/");
|
399 |
|
|
|
400 |
|
|
wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory",
|
401 |
|
|
"jsse.jar or java1.4+ runtime",
|
402 |
|
|
"Java Secure Socket Extension",
|
403 |
|
|
getMessage("httpsError"),
|
404 |
|
|
"http://java.sun.com/products/jsse/");
|
405 |
|
|
/*
|
406 |
|
|
* resources on the classpath path
|
407 |
|
|
*/
|
408 |
|
|
/* add more libraries here */
|
409 |
|
|
|
410 |
|
|
%>
|
411 |
|
|
</UL>
|
412 |
|
|
<%
|
413 |
|
|
out.write("<h3>");
|
414 |
|
|
//is everythng we need here
|
415 |
|
|
if(needed==0) {
|
416 |
|
|
//yes, be happy
|
417 |
|
|
out.write(getMessage("happyResult00"));
|
418 |
|
|
} else {
|
419 |
|
|
//no, be very unhappy
|
420 |
|
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
421 |
|
|
out.write(getMessage("unhappyResult00",Integer.toString(needed)));
|
422 |
|
|
}
|
423 |
|
|
//now look at wanted stuff
|
424 |
|
|
if(wanted>0) {
|
425 |
|
|
out.write(getMessage("unhappyResult01",Integer.toString(wanted)));
|
426 |
|
|
} else {
|
427 |
|
|
out.write(getMessage("happyResult01"));
|
428 |
|
|
}
|
429 |
|
|
out.write("</h3>");
|
430 |
|
|
%>
|
431 |
|
|
<UL>
|
432 |
|
|
<%
|
433 |
|
|
|
434 |
|
|
//hint if anything is missing
|
435 |
|
|
if(needed>0 || wanted>0 ) {
|
436 |
|
|
out.write(getMessage("hintString"));
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
out.write(getMessage("noteString"));
|
440 |
|
|
%>
|
441 |
|
|
</UL>
|
442 |
|
|
|
443 |
|
|
<h2><%= getMessage("apsExamining") %></h2>
|
444 |
|
|
|
445 |
|
|
<UL>
|
446 |
|
|
<%
|
447 |
|
|
String servletVersion=getServletVersion();
|
448 |
|
|
String xmlParser=getParserName();
|
449 |
|
|
String xmlParserLocation = getParserLocation(out);
|
450 |
|
|
%>
|
451 |
|
|
<table border="1" cellpadding="10">
|
452 |
|
|
<tr><td>Servlet version</td><td><%= servletVersion %></td></tr>
|
453 |
|
|
<tr><td>XML Parser</td><td><%= xmlParser %></td></tr>
|
454 |
|
|
<tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr>
|
455 |
|
|
</table>
|
456 |
|
|
</UL>
|
457 |
|
|
|
458 |
|
|
<% if(xmlParser.indexOf("crimson")>=0) { %>
|
459 |
|
|
<p>
|
460 |
|
|
<%= getMessage("recommendedParser") %>
|
461 |
|
|
</p>
|
462 |
|
|
<% } %>
|
463 |
|
|
|
464 |
|
|
<h2><%= getMessage("sysExamining") %></h2>
|
465 |
|
|
<UL>
|
466 |
|
|
<%
|
467 |
|
|
/**
|
468 |
|
|
* Dump the system properties
|
469 |
|
|
*/
|
470 |
|
|
java.util.Enumeration e=null;
|
471 |
|
|
try {
|
472 |
|
|
e= System.getProperties().propertyNames();
|
473 |
|
|
} catch (SecurityException se) {
|
474 |
|
|
}
|
475 |
|
|
if(e!=null) {
|
476 |
|
|
out.write("<pre>");
|
477 |
|
|
for (;e.hasMoreElements();) {
|
478 |
|
|
String key = (String) e.nextElement();
|
479 |
|
|
out.write(key + "=" + System.getProperty(key)+"\n");
|
480 |
|
|
}
|
481 |
|
|
out.write("</pre><p>");
|
482 |
|
|
} else {
|
483 |
|
|
out.write(getMessage("sysPropError"));
|
484 |
|
|
}
|
485 |
|
|
%>
|
486 |
|
|
</UL>
|
487 |
|
|
<hr>
|
488 |
|
|
<%= getMessage("apsPlatform") %>:
|
489 |
|
|
<%= getServletConfig().getServletContext().getServerInfo() %>
|
490 |
|
|
</body>
|
491 |
|
|
</html>
|