tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunhild Copony <sunny.cop...@inovit.de>
Subject Problem with context environment
Date Wed, 28 Nov 2001 09:38:18 GMT
Hi,

for my app I want to store some environment variables and I thought I
could do it with environment entries in web.xml and server.xml.
I'm using Tomcat 4.0b rc1 on Solaris and J2SDK 1.3.1.

WEB-INF/web.xml :
...
    <env-entry>
        <env-entry-name>inobase</env-entry-name>
        <env-entry-value>"/home/inovit/inorms"</env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

server.xml, in my context section :
...
          <Environment name="inobase" type="java.lang.String"
                      value="/home/inovit/inorms"/>

>From a jsp I want to read this variable and pass it to a class.

jsp:
<%
inovit.webadmin.InterimApp ia = new inovit.webadmin.InterimApp();
org.apache.jsp.Context ctx = null;
String value = "" ;
try { ctx = new org.apache.jsp.InitialContext(); }
catch (org.apache.jsp.NamingException e) {value = "no ctx";}
if (!value.equals("no ctx"))
try { value = ctx.lookup("java:/comp/env/inobase"); }
catch (org.apache.jsp.NamingException e) {value = "no path";}
%>

another try:
<%
inovit.webadmin.InterimApp ia = new inovit.webadmin.InterimApp();
Context ctx = null;
String value = "" ;
try { ctx = new InitialContext(); }
catch (NamingException e) {value = "no ctx";}
if (!value.equals("no ctx"))
try { value = ctx.lookup("java:/comp/env/inobase"); }
catch (NamingException e) {value = "no path";}
%>

I allways get the same error:

A Servlet Exception Has Occurred
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occured between lines: 50 and 59 in the jsp file:
/inopacs/statusrf.jsp
Generated servlet error:
/mirror/tools/tomcat/work/localhost/webadmin/inopacs/statusrf$jsp.java:60:
Class org.apache.jsp.Context not found.
                Context ctx = null;
                ^
An error occured between lines: 50 and 59 in the jsp file:
/inopacs/statusrf.jsp
Generated servlet error:
/mirror/tools/tomcat/work/localhost/webadmin/inopacs/statusrf$jsp.java:62:
Class org.apache.jsp.InitialContext not found.
                try { ctx = new InitialContext(); }
                                ^
An error occured between lines: 50 and 59 in the jsp file:
/inopacs/statusrf.jsp
Generated servlet error:
/mirror/tools/tomcat/work/localhost/webadmin/inopacs/statusrf$jsp.java:63:
Class org.apache.jsp.NamingException not found.
                catch (NamingException e) {value = "no ctx";}
                       ^
An error occured between lines: 50 and 59 in the jsp file:
/inopacs/statusrf.jsp
Generated servlet error:
/mirror/tools/tomcat/work/localhost/webadmin/inopacs/statusrf$jsp.java:66:
Class org.apache.jsp.NamingException not found.
                catch (NamingException e) {value = "no path";}
                       ^
4 errors

I found here in tomcat-user a hint from Craig, that java:/comp/env has
to be configured as a connection pool in server.xml. (Maybe I'm wrong -
that hint was for a db connection. )
At
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html
or directly in server.xml I couldn't find any details or explication and
for myself didn't understand what I have to do...

Maybe some one could tell me where I'm wrong - would be very happy!
Thanks a lot,
Sunny


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message