Hi,
How do you declare the resource in server.xml?  The web.xml is only the
reference linking information, it's not sufficient by itself.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Worley Brent - bworle [mailto:[EMAIL PROTECTED]
>Sent: Thursday, June 03, 2004 1:17 PM
>To: 'Tomcat Users List'
>Subject: Naming Question
>
>I'm using Tomcat 5.1.24 on Linux and coming across the following
scenario:
>
>I have a class named Search that does very few things, but it does
create a
>Context object.
>
>MyObj l = null;
>      Throwable t = null;
>      try {
>         InitialContext ic = new InitialContext();
>         l = (MyObj)ic.lookup("java:comp/env/myobj");
>      }
>
>In my web.xml file I have a resource defined for it as so:
>
><resource-ref>
>      <description>MyObj</description>
>      <res-ref-name>myobj</res-ref-name>
>      <res-type>obj</res-type>
>      <res-auth>CONTAINER</res-auth>
>      <init-param serverUrl="url removed for security/>
>      <init-param username="usernameremovedtoo"/>
>      <init-param password="dittoonpassword"/>
>      <init-param applicationId="MyObjects"/>
>   </resource-ref>
>
>(I've changed some of the entries for security purposes).
>
>When I use a .jsp to start a bean using this class, here is the error I
get
>(cut down, so you actually see the errors):
>
>java.lang.ExceptionInInitializerError
>       at java.lang.Class.forName0(Native Method)
>       at java.lang.Class.forName(Class.java:141)
>       at search.SearchSession.class$(SearchSession.java:20)
>       at search.SearchSession.(SearchSession.java:19)
>       ...
>       at java.lang.Thread.run(Thread.java:534)
>Caused by: java.lang.RuntimeException: javax.naming.NamingException:
Cannot
>create resource instance
>       at search.Search.rethrow(Search.java:52)
>       at search.Search.(Search.java:32)
>       ... 50 more
>Caused by: javax.naming.NamingException: Cannot create resource
instance
>       at org.apache.naming.factory.ResourceFactory.getObjectInstance
>(ResourceFactory.java:132)
>       at
>javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301
)
>       at
org.apache.naming.NamingContext.lookup(NamingContext.java:791)
>       at
org.apache.naming.NamingContext.lookup(NamingContext.java:138)
>       at
org.apache.naming.NamingContext.lookup(NamingContext.java:779)
>       at
org.apache.naming.NamingContext.lookup(NamingContext.java:138)
>       at
org.apache.naming.NamingContext.lookup(NamingContext.java:779)
>       at
org.apache.naming.NamingContext.lookup(NamingContext.java:151)
>       at
>org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
>       at javax.naming.InitialContext.lookup(InitialContext.java:347)
>       at search.Search.(Search.java:23)
>       ... 50 more
>
>Line 23 in Search.java is the one where I do the lookup on the naming
>context.  I have a feeling this is failing, but I'm not sure why.  Can
>anyone point me in the right direction?
>
>Thanks,
>Brent Worley
>
>
>
>**********************************************************************
>The information contained in this communication is
>confidential, is intended only for the use of the recipient
>named above, and may be legally privileged.
>If the reader of this message is not the intended
>recipient, you are hereby notified that any dissemination,
>distribution, or copying of this communication is strictly
>prohibited.
>If you have received this communication in error,
>please re-send this communication to the sender and
>delete the original message or any copy of it from your
>computer system. Thank You.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to