You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ulf Jaehrig <uj...@desys.com> on 2001/03/06 14:13:50 UTC

Tomcat 4 and Embedded

Hi,

today I experimented with the Catalina Embedded.class. I first try to
start it with "catalina.sh embedded" failed, so I tried to get it run.
After these changes it started. Maybe these are of interest...

The change in the catalina.sh adds the jar files in server/lib and
common/lib to the embedded classpath. Without these the start fails
because of NoClassDefFoundError errors.
The change in the ContextConfig.java changes a cast of context. Without
it, a ClassCastException is thrown.

Bye,
Ulf

===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/bin/catalina.sh,v
retrieving revision 1.13
diff -u -r1.13 catalina.sh
--- catalina.sh 2001/02/21 03:38:27     1.13
+++ catalina.sh 2001/03/06 13:08:07
@@ -93,7 +93,10 @@
 elif [ "$1" = "embedded" ] ; then

   shift
-  for i in ${CATALINA_HOME}/server/*.jar ; do
+  for i in ${CATALINA_HOME}/server/lib/*.jar ; do
+    CP=$i:${CP}
+  done
+  for i in ${CATALINA_HOME}/common/lib/*.jar ; do
     CP=$i:${CP}
   done
   echo Embedded Classpath: $CP


===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v

retrieving revision 1.41
diff -u -r1.41 ContextConfig.java
--- ContextConfig.java  2001/02/26 03:53:12     1.41
+++ ContextConfig.java  2001/03/06 13:09:08
@@ -809,10 +809,16 @@
         // Dump the contents of this pipeline if requested
         if (debug >= 1) {
             log("Pipline Configuration:");
-            Valve valves[] = ((Pipeline) context).getValves();
-            for (int i = 0; i < valves.length; i++) {
-                log("  " + valves[i].getInfo());
+            if (context instanceof ContainerBase) {
+                Pipeline pipeline = ((ContainerBase)
context).getPipeline();
+                if (pipeline != null) {
+                    Valve valves[] = pipeline.getValves();
+                    for (int i = 0; i < valves.length; i++) {
+                        log("  " + valves[i].getInfo());
+                    }
+                }
             }
+
             log("======================");
         }


--
Distributed Engineering Systems Software GmbH
Reichenbachstr. 16,  68309 Mannheim,  Germany
Tel: +49(0)621-7363063 Fax: +49(0)621-7363064



Re: Tomcat 4 and Embedded

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Glenn Nielsen wrote:

> I committed the patch to catalina.sh, thanks Ulf!
>
> I'm not sure about the patch to ContextConfig.java,
> anyone else want to take a look at that?
>

I will take on the ContextConfig patch -- at first blush it looks like a correct patch to deal with our
recent refactoring of the Valve stuff, but want to test some more before committing it.

>
> Regards,
>
> Glenn
>

Craig


>
> Ulf Jaehrig wrote:
> >
> > Hi,
> >
> > today I experimented with the Catalina Embedded.class. I first try to
> > start it with "catalina.sh embedded" failed, so I tried to get it run.
> > After these changes it started. Maybe these are of interest...
> >
> > The change in the catalina.sh adds the jar files in server/lib and
> > common/lib to the embedded classpath. Without these the start fails
> > because of NoClassDefFoundError errors.
> > The change in the ContextConfig.java changes a cast of context. Without
> > it, a ClassCastException is thrown.
> >
> > Bye,
> > Ulf
> >
> > ===================================================================
> > RCS file:
> > /home/cvspublic/jakarta-tomcat-4.0/catalina/src/bin/catalina.sh,v
> > retrieving revision 1.13
> > diff -u -r1.13 catalina.sh
> > --- catalina.sh 2001/02/21 03:38:27     1.13
> > +++ catalina.sh 2001/03/06 13:08:07
> > @@ -93,7 +93,10 @@
> >  elif [ "$1" = "embedded" ] ; then
> >
> >    shift
> > -  for i in ${CATALINA_HOME}/server/*.jar ; do
> > +  for i in ${CATALINA_HOME}/server/lib/*.jar ; do
> > +    CP=$i:${CP}
> > +  done
> > +  for i in ${CATALINA_HOME}/common/lib/*.jar ; do
> >      CP=$i:${CP}
> >    done
> >    echo Embedded Classpath: $CP
> >
> > ===================================================================
> > RCS file:
> > /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
> >
> > retrieving revision 1.41
> > diff -u -r1.41 ContextConfig.java
> > --- ContextConfig.java  2001/02/26 03:53:12     1.41
> > +++ ContextConfig.java  2001/03/06 13:09:08
> > @@ -809,10 +809,16 @@
> >          // Dump the contents of this pipeline if requested
> >          if (debug >= 1) {
> >              log("Pipline Configuration:");
> > -            Valve valves[] = ((Pipeline) context).getValves();
> > -            for (int i = 0; i < valves.length; i++) {
> > -                log("  " + valves[i].getInfo());
> > +            if (context instanceof ContainerBase) {
> > +                Pipeline pipeline = ((ContainerBase)
> > context).getPipeline();
> > +                if (pipeline != null) {
> > +                    Valve valves[] = pipeline.getValves();
> > +                    for (int i = 0; i < valves.length; i++) {
> > +                        log("  " + valves[i].getInfo());
> > +                    }
> > +                }
> >              }
> > +
> >              log("======================");
> >          }
> >
> > --
> > Distributed Engineering Systems Software GmbH
> > Reichenbachstr. 16,  68309 Mannheim,  Germany
> > Tel: +49(0)621-7363063 Fax: +49(0)621-7363064
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, email: tomcat-dev-help@jakarta.apache.org
>
> --
> ----------------------------------------------------------------------
> Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
> MOREnet System Programming               |  * if iz ina coment.      |
> Missouri Research and Education Network  |  */                       |
> ----------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-dev-help@jakarta.apache.org


Re: Tomcat 4 and Embedded

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
I committed the patch to catalina.sh, thanks Ulf!

I'm not sure about the patch to ContextConfig.java,
anyone else want to take a look at that?

Regards,

Glenn

Ulf Jaehrig wrote:
> 
> Hi,
> 
> today I experimented with the Catalina Embedded.class. I first try to
> start it with "catalina.sh embedded" failed, so I tried to get it run.
> After these changes it started. Maybe these are of interest...
> 
> The change in the catalina.sh adds the jar files in server/lib and
> common/lib to the embedded classpath. Without these the start fails
> because of NoClassDefFoundError errors.
> The change in the ContextConfig.java changes a cast of context. Without
> it, a ClassCastException is thrown.
> 
> Bye,
> Ulf
> 
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-tomcat-4.0/catalina/src/bin/catalina.sh,v
> retrieving revision 1.13
> diff -u -r1.13 catalina.sh
> --- catalina.sh 2001/02/21 03:38:27     1.13
> +++ catalina.sh 2001/03/06 13:08:07
> @@ -93,7 +93,10 @@
>  elif [ "$1" = "embedded" ] ; then
> 
>    shift
> -  for i in ${CATALINA_HOME}/server/*.jar ; do
> +  for i in ${CATALINA_HOME}/server/lib/*.jar ; do
> +    CP=$i:${CP}
> +  done
> +  for i in ${CATALINA_HOME}/common/lib/*.jar ; do
>      CP=$i:${CP}
>    done
>    echo Embedded Classpath: $CP
> 
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
> 
> retrieving revision 1.41
> diff -u -r1.41 ContextConfig.java
> --- ContextConfig.java  2001/02/26 03:53:12     1.41
> +++ ContextConfig.java  2001/03/06 13:09:08
> @@ -809,10 +809,16 @@
>          // Dump the contents of this pipeline if requested
>          if (debug >= 1) {
>              log("Pipline Configuration:");
> -            Valve valves[] = ((Pipeline) context).getValves();
> -            for (int i = 0; i < valves.length; i++) {
> -                log("  " + valves[i].getInfo());
> +            if (context instanceof ContainerBase) {
> +                Pipeline pipeline = ((ContainerBase)
> context).getPipeline();
> +                if (pipeline != null) {
> +                    Valve valves[] = pipeline.getValves();
> +                    for (int i = 0; i < valves.length; i++) {
> +                        log("  " + valves[i].getInfo());
> +                    }
> +                }
>              }
> +
>              log("======================");
>          }
> 
> --
> Distributed Engineering Systems Software GmbH
> Reichenbachstr. 16,  68309 Mannheim,  Germany
> Tel: +49(0)621-7363063 Fax: +49(0)621-7363064
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-dev-help@jakarta.apache.org

-- 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------