You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Keith Wannamaker <Ke...@Apache.org> on 2004/10/26 23:28:27 UTC

[5.0] preRegister npe

StandardContext.start throws a (caught) npe for every web application 
unless preRegister has been called on the context (line 4151).  This is 
pretty annoying in Eclipse because it automatically stops on all npes.

For me, preRegister is always called AFTER start, so this stanza always 
npes.  Anyone help on what needs to be done to reverse the order of 
these calls?  If not any opposition to something like--

Index: StandardContext.java
===================================================================
RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.130.2.1
diff -u -r1.130.2.1 StandardContext.java
--- StandardContext.java	28 Aug 2004 12:49:54 -0000	1.130.2.1
+++ StandardContext.java	26 Oct 2004 21:21:44 -0000
@@ -4143,7 +4143,7 @@

          // Look for a realm - that may have been configured earlier.
          // If the realm is added after context - it'll set itself.
-        if( realm == null ) {
+        if( realm == null && mserver != null ) {
              ObjectName realmName=null;
              try {
                  realmName=new ObjectName( getEngineName() + 
":type=Host,host=" +

I have to think I'm doing something wrong but I'm not sure what.
This patch sure does seem to help things.

Thanks for any input,
Keith

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