tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Halicke" <shali...@imsurenetwork.com>
Subject RE: Several configuration issues with Tomcat 5.5.7/Apache2 compiling JSPs - Fixed
Date Tue, 15 Feb 2005 21:39:48 GMT
It ended up being the CLASSPATH environment variable, which i suspected all
along.

Since our underlying code (some of it poorly written AFAIK, based on Tomcat
3 and the older JSP spec) relies on classes/jars being at a certain path in
the directory tree, copying the classes over to the WEB-INF directories is
not enough. You won't get ClassDefNotFound errors, but you will get NPEs.
The exact reason for this, I don't know, (I have only a passing
understanding of Java and the JSP spec) but I did find a workaround. It lies
in the /bin/catalina.sh script, in which the CLASSPATH environment variable
is overridden. I simply added the paths to my necessary .jar files in a
separate script run at login, exporting them to another env variable
(CLASSPATH2). I then edited $tomcat_home/bin/catalina.sh to look like this:

<...snip...>

# Add on extra jar files to CLASSPATH
if [ -n "$JSSE_HOME" ]; then

CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:
"$JSSE_HOME"/lib/jsse.jar
fi

CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/b
in/commons-logging-api.jar:"$CLASSPATH2"

<...snip...>

And voila, everything works fine. It's a good tip if you're migrating from
the Stone Age of Tomcat 3, as you don't have to re-code anything. If anyone
knows of an easier, more modular way to do this, please drop me a line.
Thanks for all your advice.

Cheers


<orig message follows>

Forget classpath -- it's ignored in Tomcat 5.5 and as I remember, was
being phased out in Tomcat 3 (wow -- have I been reading these mail
lists for that long??).

If you put your classes and jars in the right places, they will be
found.  In your case, the classes are being found, but some underlying
code in biz.shipflex.Configuration is throwing an NPE.

--David

Sam Halicke wrote:

>Hi all, first time posting to the list.
>
>I'm having several problems migrating JSPs and class/jar files to Tomcat
>5.5.7 from Tomcat 3. I understand this is a big move, but I'm trying to
>avoid any rewrite of the JSPs themselves. Documentation for tomcat 5.5.x is
>rather sparse and terribly cryptic.
>
>Each webapp is using its own local classes (which I have copied into the
>local WEB-INF directory in /classes /lib etc.), as well as some common
>classes/jars which have been copied into the /tomcat/common/ directory
tree.
>Should I be using the /tomcat/shared/ tree? This does not seem to matter as
>jasper will consistently throw me errors from compiling the JSPs.
>
>Here is the root cause of one such error:
>
>HTTP 500 - Internal Server Error
>
>ROOT CAUSE
>java.lang.NullPointerException
>	biz.shipflex.Configuration.getConfiguration(Configuration.java:51)
>
>org.apache.jsp.ShipFlex.Website.MainPage_jsp._jspService(org.apache.jsp.Shi
p
>Flex.Website.MainPage_jsp:52)
>	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
>	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
>org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
3
>25)
>	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
>	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
>	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
>My basic setup is as follows:
>
>Apache 2.x 		/usr/local/apache
>Tomcat 5.5.7	/usr/local/tomcat
>
>[root@dev02 tomcat]# echo $CLASSPATH
>/usr/local/tomcat/webapps/Common/Classes/:/usr/local/tomcat/webapps/Shippin
g
>/Classes/:/usr/local/tomcat/webapps/scripts/Classes/:/usr/java/jdk1.5.0_01/
l
>ib/
>
>I have a feeling its something with my CLASSPATH, again, this is a touchy
>migration.
>
>I'll gladly copy any portions of web.xml and/or server.xml, etc to an
>additional message if needed. Any help or suggestions on things/files to
>look at would be most appreciated.
>
>TIA
>********************************************
>Sam Halicke
>Systems Administrator
>IMSure Network, Inc.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>

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


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


Mime
View raw message