Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I learn about JNDI strings?

How do you know how to form a JNDI string? I know there must be a format and that the divisions must mean something but I haven't been able to find a good resource that explains them. For example: java:comp/env/wm/default. This is supposed to connect to a WorkManager in Websphere with the name of default. But what does the "java", "comp", "env" mean? I know what the wm/default mean because that's the JNDI name put in the WorkManager, but what does the rest mean?

Thanks

like image 997
Jaime Garcia Avatar asked Apr 16 '10 14:04

Jaime Garcia


People also ask

Does Log4j use JNDI?

Log4j, an open-source logging library developed by the Apache Software Foundation, is the logging framework that Java-based applications use. Log4j uses a lookup feature called Java Naming and Directory Interface (JNDI) that consists of an API (Application Programming Interface) and SPI (Service Provider Interface).

What is JNDI and how it works?

The Java Naming and Directory Interface™ (JNDI) is an application programming interface (API) that provides naming and directory functionality to applications written using the Java™ programming language. It is defined to be independent of any specific directory service implementation.

When was JNDI added to Log4j?

In 2013 (version 2.0-beta9), the log4j package added the “JNDILookup plugin” in issue LOG4J2–313. To understand how that change creates a problem, it's necessary to understand a little about JNDI: Java Naming and Directory Interface.

What are JNDI names?

A JNDI name is a user-friendly name for an object. These names are bound to their objects by the naming and directory service that is provided by a J2SE server. Because J2SE components access this service through the JNDI API, an object's user-friendly name is its JNDI name.


2 Answers

The "java:" scheme was introduced in J2EE for accessing process-local data. The "comp" context is short for "component"; it contains data that is local to the J2EE component (web module or EJB type) that is active on the current thread. The "env" subcontext is short for "environment"; it is the context under which EJB references, resource references, and environment entries are bound. The "wm/default" is an arbitrary name. The "wm" subcontext name is the convention for work managers, but the full name could have also been "java:comp/env/myDefaultWM", where web.xml/ejb-jar.xml defined a resource-ref with <res-ref-name>myDefaultWM<res-ref-name>.

like image 125
Brett Kail Avatar answered Sep 19 '22 03:09

Brett Kail


How about this -> http://www.javaworld.com/javaworld/jw-01-2000/jw-01-howto.html or this -> http://www.javaworld.com/javaworld/jw-04-2002/jw-0419-jndi.html

like image 45
Oliver Michels Avatar answered Sep 19 '22 03:09

Oliver Michels