tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47342] New: ReplicatedContext#start throws NullPointerException.
Date Wed, 10 Jun 2009 09:48:26 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47342

           Summary: ReplicatedContext#start throws NullPointerException.
           Product: Tomcat 6
           Version: 6.0.20
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Cluster
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: fujino.keiichi@oss.ntt.co.jp


ReplicatedContext#start throws NullPointerException.

context.xml is as follows.
<Context className="org.apache.catalina.ha.context.ReplicatedContext" />

When Tomcat is started, the following logs are output. 

Jun 10, 2009 6:40:57 PM org.apache.catalina.ha.context.ReplicatedContext start
SEVERE: Unable to start ReplicatedContext
java.lang.NullPointerException
    at java.io.File.<init>(Unknown Source)
    at
org.apache.catalina.core.StandardContext.getBasePath(StandardContext.java:4840)
    at
org.apache.catalina.ha.context.ReplicatedContext.start(ReplicatedContext.java:63)
    at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
    at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
    at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
    at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


This causes because docBase has not been initialized. 
I think that this solution for the problem is an addition of initialization to
ReplicatedContext#start. 

I made a patch.

Index: java/org/apache/catalina/ha/context/ReplicatedContext.java
===================================================================
--- java/org/apache/catalina/ha/context/ReplicatedContext.java    (revision
763870 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=763870 ))
+++ java/org/apache/catalina/ha/context/ReplicatedContext.java    (working
copy)
@@ -51,6 +51,13 @@
     @Override
     public synchronized void start() throws LifecycleException {
         if ( this.started ) return;
+        if( !initialized ) { 
+            try {
+                init();
+            } catch( Exception ex ) {
+                throw new LifecycleException("Error initializaing ", ex);
+            }
+        }
         super.addLifecycleListener(this);            
         try {
             CatalinaCluster catclust = (CatalinaCluster)this.getCluster();



Regards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message