tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: JNDI frustration
Date Mon, 14 Jun 2004 14:39:59 GMT

Hi,
The web.xml part is the portable part across containers, as mandated by
the servlet specification.  It's actually not strictly necessary for
tomcat, but nonetheless you should keep it in for portability.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Benson Margulies [mailto:bim2004@basistech.com]
>Sent: Sunday, June 13, 2004 10:36 PM
>To: Tomcat Users List
>Subject: RE: JNDI frustration
>
>OK, I am stuck. Here are the details:
>
>server.xml, adding to the existing GlobalNamingResources:
>
>  <GlobalNamingResources>
>
>    <!-- Test entry for demonstration purposes -->
>    <Environment name="simpleValue" type="java.lang.Integer"
>value="30"/>
>
>  <Resource name="bean/RLPEnvironmentFactory" auth="Container"
>            type="com.basistech.rex.j2ee.EnvironmentBean"/>
>  <ResourceParams name="bean/RLPEnvironmentFactory">
>    <parameter>
>      <name>factory</name>
>      <value>com.basistech.rex.j2ee.EnvironmentFactory</value>
>    </parameter>
>    <parameter>
>      <name>RLPRoot</name>
>      <value>d:/rlp-arabic/rlp</value>
>    </parameter>
>  </ResourceParams>
></GlobalNamingResources>
>
>web.xml:
>
>	 <resource-env-ref>
>		<description>Object factory for the RLP
>Environment.</description>
>
><resource-env-ref-name>bean/RLPEnvironmentFactory</resource-env-ref-nam
e
>>
>
><resource-env-ref-type>com.basistech.rex.j2ee.EnvironmentBean</resource
-
>env-ref-type>
>    </resource-env-ref>
>
>resource listener class:
>
>		try {
>			Context initCtx = new InitialContext();
>			Context envCtx = (Context)
>initCtx.lookup("java:comp/env");
>			EnvironmentBean bean = (EnvironmentBean)
>envCtx.lookup("bean/RLPEnvironmentFactory");
>			rlp = bean.environment();
>		} catch(NamingException ne) {
>			throw new RuntimeException("Failed to create RLP
>environment bean via JNDI.", ne);
>		}
>
>I've traced into the call in envCtx.lookup. It finds the name, finds
>that it is a reference, and then tries to defererence it. My SPI class
>isn't called at this point, instead I just get a NamingException that
>does not detail whatever has gone amiss.
>
>I would be less helpless if I understood why this has to be configured
>in web.xml at all. If the global config has defined that JNDI has the
>ability to come up with an object of my class at a particular name by
>calling my factory, what's the web.xml angle?
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
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