📄 org_apache_catalina_startup_catalina--rosonsandy.htm
字号:
File file = configFile();<BR> try
{<BR>
InputSource is
=<BR>
new InputSource("file://" +
file.getAbsolutePath());<BR>
FileInputStream fis = new
FileInputStream(file);<BR>
is.setByteStream(fis);<BR></FONT><FONT
style="BACKGROUND-COLOR: #ffffff">
//watch out!now on the top of stack is this(catalina)</FONT></P>
<P><FONT style="BACKGROUND-COLOR: #999999"><FONT
style="BACKGROUND-COLOR: #ffffff">
<SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
roman?;="" new="" times="" ar-sa?="" zh-cn;="" en-us;="" ?times=""
mso-bidi-font-family:="" mso-ansi-language:="" mso-fareast-language:=""
mso-bidi-language:="">//watch out!now on the top of stack is
this(catalina)</SPAN><BR>
digester.push(this);<BR>
digester.parse(is);<BR>
<BR>
fis.close();<BR> } catch (Exception
e) {</FONT><BR></FONT><FONT
style="BACKGROUND-COLOR: #ffffff">
System.out.println("Catalina.start: " +
e);<BR>
e.printStackTrace(System.out);<BR>
System.exit(1);<BR> }</FONT></P>
<P><FONT
style="BACKGROUND-COLOR: #ffffff">
// provide tomcat's
javaURLContextFactory.<BR> <SPAN
lang=EN-US
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
roman?;="" new="" times="" ar-sa?="" zh-cn;="" en-us;="" ?times=""
mso-bidi-font-family:="" mso-ansi-language:="" mso-fareast-language:=""
mso-bidi-language:="">// </SPAN><SPAN
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
roman?;="" new="" times="" ar-sa?="" zh-cn;="" en-us;="" ?times=""
mso-bidi-font-family:="" mso-ansi-language:="" mso-fareast-language:=""
mso-bidi-language:="">更改为<SPAN lang=EN-US>Tomcat</SPAN>自己提供的<SPAN
lang=EN-US>javaURLContextFactory</SPAN></SPAN></FONT></P>
<P><SPAN
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
roman?;="" new="" times="" ar-sa?="" zh-cn;="" en-us;="" ?times=""
mso-bidi-font-family:="" mso-ansi-language:="" mso-fareast-language:=""
mso-bidi-language:=""><SPAN lang=EN-US></SPAN></SPAN><FONT
style="BACKGROUND-COLOR: #ffffff">
if (!useNaming)
{<BR>
System.setProperty("catalina.useNaming",
"false");<BR> } else
{<BR>
System.setProperty("catalina.useNaming",
"true");<BR>
String value =
"org.apache.naming";<BR>
String oldValue
=<BR>
System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);<BR>
if (oldValue != null)
{<BR>
value = value + ":" +
oldValue;<BR>
}<BR>
System.setProperty(javax.naming.Context.URL_PKG_PREFIXES,
value);<BR>
value =
System.getProperty<BR>
(javax.naming.Context.INITIAL_CONTEXT_FACTORY);<BR>
if (value == null)
{<BR>
System.setProperty<BR>
(javax.naming.Context.INITIAL_CONTEXT_FACTORY,<BR>
"org.apache.naming.java.javaURLContextFactory");<BR>
}<BR> }</FONT></P>
<P><FONT style="BACKGROUND-COLOR: #999999"><FONT
style="BACKGROUND-COLOR: #ffffff">
// If a SecurityManager is being used, set properties
for<BR> // checkPackageAccess() and
checkPackageDefinition<BR> if(
System.getSecurityManager() != null )
{<BR> String
access =
Security.getProperty("package.access");<BR>
if( access != null && access.length() > 0
)<BR>
access +=
",";<BR>
else<BR>
access =
"sun.,";<BR>
Security.setProperty("package.access",<BR>
access +
<BR>
"org.apache.catalina.,org.apache.jasper.");<BR>
String definition =
Security.getProperty("package.definition");<BR>
if( definition != null && definition.length() > 0
)</FONT><BR></FONT><FONT
style="BACKGROUND-COLOR: #ffffff">
definition +=
",";<BR>
else<BR>
definition =
"sun.,";<BR>
Security.setProperty("package.definition",<BR>
// FIX ME package "javax." was removed to prevent
HotSpot<BR>
// fatal internal
errors<BR>
definition +
<BR>
"java.,org.apache.catalina.,org.apache.jasper.,org.apache.coyote.");<BR>
}</FONT></P>
<P><FONT
style="BACKGROUND-COLOR: #ffffff">
// Replace System.out and System.err with a custom
PrintStream<BR> SystemLogHandler log
= new
SystemLogHandler(System.out);<BR>
System.setOut(log);<BR>
System.setErr(log);</FONT></P>
<P><FONT
style="BACKGROUND-COLOR: #ffffff">
//define for the below and make sure clearly
shutdown<BR> Thread shutdownHook =
new CatalinaShutdownHook();</FONT></P>
<P><FONT
style="BACKGROUND-COLOR: #ffffff">
// Start the new server<BR> if
(server instanceof Lifecycle)
{<BR> try
{</FONT><FONT style="BACKGROUND-COLOR: #ffffff"><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
mso-bidi-font-family: mso-ansi-language: mso-fareast-language:
mso-bidi-language: AR-SA? ZH-CN; EN-US; Roman?; New ?Times
Times>.</SPAN></FONT><FONT
style="BACKGROUND-COLOR: #ffffff"><BR>
server.initialize(); <SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
mso-bidi-font-family: mso-ansi-language: mso-fareast-language:
mso-bidi-language: AR-SA? ZH-CN; EN-US; Roman?; New ?Times
Times>//StandardServer.initialize().</SPAN><BR>
((Lifecycle) server).start(); <SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: "
mso-bidi-font-family: mso-ansi-language: mso-fareast-language:
mso-bidi-language: AR-SA? ZH-CN; EN-US; Roman?; New ?Times Times>//
StandardServer.start().</SPAN><BR>
try
{<BR>
// Register shutdown
hook<BR>
Runtime.getRuntime().addShutdownHook(shutdownHook);<BR>
} catch (Throwable t)
{<BR>
// This will fail on JDK 1.2. Ignoring, as Tomcat can
run<BR>
// fine without the shutdown
hook.<BR>
}<BR>
// Wait for the server to be told to shut
down<BR>
server.await();<BR></FONT><FONT
style="BACKGROUND-COLOR: #ffffff">
} catch (LifecycleException e)
{<BR>
System.out.println("Catalina.start: " +
e);<BR>
e.printStackTrace(System.out);<BR>
if (e.getThrowable() != null)
{<BR>
System.out.println("----- Root Cause
-----");<BR>
e.getThrowable().printStackTrace(System.out);<BR>
}<BR>
}<BR> }</FONT></P>
<LI>
<P><FONT
style="BACKGROUND-COLOR: #ffffff">
// Shut down the server<BR> if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -