diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-26 07:16:49 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-26 07:16:49 +0000 |
commit | 578a548c73282c33a948c86ef0dabf15a96223cf (patch) | |
tree | a734c2a141c36f7627d75e84319e76d2d48bce21 /java/sca | |
parent | 1f2ec8e427f96f0a332f27ebbd53634342aa5808 (diff) |
Add some logging and fix finding server.xml in Tomcat v5
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@778589 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
3 files changed, 16 insertions, 5 deletions
diff --git a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java index a2e15cd68d..ff5d9f2f47 100644 --- a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java +++ b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.tomcat;
import java.io.File;
+import java.util.logging.Logger;
import org.apache.catalina.Container;
import org.apache.catalina.LifecycleEvent;
@@ -42,7 +43,7 @@ import org.apache.catalina.startup.HostConfig; * <Listener className="org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener"/>
*/
public class TuscanyLifecycleListener implements LifecycleListener {
-// private static transient Log log = LogFactory.getLog(StandardContext.class);
+ private static final Logger log = Logger.getLogger(TuscanyLifecycleListener.class.getName());
public static final String TUSCANY_WAR_PROP = "org.apache.tuscany.sca.tomcat.war";
@@ -53,16 +54,17 @@ public class TuscanyLifecycleListener implements LifecycleListener { public TuscanyLifecycleListener() {
running = true;
+ log.info("Apache Tuscany initilizing");
}
public void lifecycleEvent(LifecycleEvent event) {
if ("init".equals(event.getType()) && (event.getSource() instanceof StandardServer)) {
File webappDir = findTuscanyWar();
if (webappDir == null) {
-// log.warn("Tuscany disabled as Tuscany webapp not found");
+ log.severe("Tuscany disabled as Tuscany webapp not found");
} else {
System.setProperty(TUSCANY_WAR_PROP, webappDir.getAbsolutePath());
-// log.info("Using Tuscany webapp: " + webappDir.getAbsolutePath());
+ log.info("Using Tuscany webapp: " + webappDir.getAbsolutePath());
StandardServer server = (StandardServer)event.getSource();
StandardService catalina = (StandardService)server.findService("Catalina");
for (Connector connector : catalina.findConnectors()) {
@@ -71,7 +73,7 @@ public class TuscanyLifecycleListener implements LifecycleListener { for (LifecycleListener listener : ((StandardHost)container).findLifecycleListeners()) {
if (listener instanceof HostConfig) {
((HostConfig)listener).setContextClass("org.apache.tuscany.sca.tomcat.TuscanyStandardContext");
-// log.info("TuscanyStandardContext set for connector: " + container.getName() + ":" + connector.getPort());
+ log.info("Tuscany enabled on connector: " + container.getName() + ":" + connector.getPort());
}
}
}
diff --git a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java index f6aa2203e7..8d3e48ae2c 100644 --- a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java +++ b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.tomcat; import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.logging.Logger;
import javax.naming.NamingException;
@@ -31,6 +32,7 @@ import org.apache.catalina.deploy.FilterDef; public class TuscanyStandardContext extends StandardContext {
private static final long serialVersionUID = 1L;
+ private static final Logger log = Logger.getLogger(TuscanyStandardContext.class.getName());
private ClassLoader tuscanyClassLoader;
@@ -53,6 +55,7 @@ public class TuscanyStandardContext extends StandardContext { filterDef.setFilterName("TuscanyFilter");
filterDef.setFilterClass("org.apache.tuscany.sca.host.webapp.TuscanyServletFilter");
addFilterDef(filterDef);
+ log.info("Tuscany enabled for: " + this.getName());
}
private boolean isSCAAlication() {
diff --git a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java index d44a4726a1..19879175d6 100644 --- a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java +++ b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java @@ -126,7 +126,13 @@ public class Installer { }
File serverLib = new File(catalinaBase, "/lib");
if (!(serverLib.exists())) {
- throw new IllegalStateException(" Tomcat lib/ not found: " + serverLib.getAbsolutePath());
+ // try Tomcat 5 server/lib
+ if (new File(catalinaBase, "/server").exists()) {
+ serverLib = new File(new File(catalinaBase, "/server"), "/lib");
+ }
+ }
+ if (!(serverLib.exists())) {
+ throw new IllegalStateException("Tomcat lib not found: " + serverLib.getAbsolutePath());
}
File serverXml = new File(catalinaBase, "/conf/server.xml");
if (!(serverXml.exists())) {
|