• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

problem defining URL resource

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have deployed an enterprise application on IBM WebSphere WAS 5.1.
The enterprise application (named cardonet.ear) contains 1 web module (named cardonet.war) and 1 EJB module.
I want to define a URL resource in order to read an XML from the web module.
The XML file is stored in cardonet.war/function_library_ini.xml.
In cardonet.war/WEB-INF/web.xml I have defined the following resource:
<resource-ref>
<res-ref-name>url/LibraryManager</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
</resource-ref>
In the deployment file cardonet.ear/Meta-inf/sun-j2ee-ri.xml I have mapped the resource as follows:
<web>
<module-name>cardonet.war</module-name>
<context-root>cardonet</context-root>
<resource-ref>
<res-ref-name>url/LibraryManager</res-ref-name>
<jndi-name>http://localhost:8000/cardonet/function_library_ini.xml</jndi-name>;
</resource-ref>
</web>
I tried to open this URL from one of the servlets defined in web.xml as follows:
try{
InitialContext jndiContext = JndiContext.getInstance().getJndiContext();
url = (URL)jndiContext.lookup("java:comp/env/url/LibraryManager");
}catch(NamingException e){
e.printStackTrace();
}
And caught the following exception.
Can someone help me figure out how to define properly this URL resource?
It seems to work file with the petstore example.
Thanks.
Nili
[1/26/04 14:24:53:972 IST] 20913868 SystemErr R com.ibm.websphere.naming.CannotInstantiateObjectException:
Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object.
Root exception is javax.naming.NameNotFoundException: Context: nili-pc/nodes/nili-pc/servers/server1, name: url/LibraryManager: First component in name LibraryManager not found.
Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0
[1/26/04 14:24:53:972 IST] 20913868 SystemErr R
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:968)
[1/26/04 14:24:53:972 IST] 20913868 SystemErr R
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:1398)
[1/26/04 14:24:53:972 IST] 20913868 SystemErr R
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
[1/26/04 14:24:53:972 IST] 20913868 SystemErr R
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory$1.run(IndirectJndiLookupObjectFactory.java:372)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:111)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstanceExt(IndirectJndiLookupObjectFactory.java:221)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:149)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.util.ResRefJndiLookupObjectFactory.getObjectInstance(ResRefJndiLookupObjectFactory.java:127)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:873)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:152)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:397)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1278)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:194)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:135)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at javax.naming.InitialContext.lookup(InitialContext.java:360)
[1/26/04 14:24:53:982 IST] 20913868 SystemErr R
at com.cardonet.tools.expression.CardonetLibraryManager._readIniFile(CardonetLibraryManager.java:75)
...
[ January 27, 2004: Message edited by: Nili Adoram ]
[ January 27, 2004: Message edited by: Nili Adoram ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic