Issue Details (XML | Word | Printable)

Key: GLASSFISH-8569
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: ksak
Reporter: vamsee_krishna
Votes: 2
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

[DEA] JNDI listing in a servlet only works after launching JNDIBrowser under admin console

Created: 22/Jun/09 03:41 AM   Updated: 08/Jun/10 12:26 PM   Resolved: 08/Jun/10 12:26 PM
Component/s: naming
Affects Version/s: v2.2
Fix Version/s: V3

Time Tracking:
Not Specified

File Attachments: 1. XML File domain.xml (28 kB) 22/Jun/09 03:45 AM - vamsee_krishna
2. Text File server.log (255 kB) 22/Jun/09 03:44 AM - vamsee_krishna
3. File WebApplication1.war (8 kB) 22/Jun/09 03:43 AM - vamsee_krishna

Environment:

Operating System: All
Platform: All


Issuezilla Id: 8,569
Status Whiteboard:

v3_exclude

Tags:
Participants: chrjohn, Ed Bratt, Jagadish, jthoennes, ksak, kumara, marina vatkina, vamsee_krishna and wayerr


 Description  « Hide

[DEA] Submitting the issue on behalf of customer
---------------------------------------------------------
Following code in an servlet only works after we launch JNDI browser from admin
console.

PrintWriter out = response.getWriter();
//String contextPath = "java:comp/env/jdbc";
String contextPath = "jms";/

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");
env.put(Context.PROVIDER_URL,
"localhost:1099");

InitialContext initCtx = new InitialContext(env);

if (((Context) initCtx.lookup(contextPath)) == null) { out.println("<p>No " + contextPath + " context</p>"); } else {
NamingEnumeration enum1 = initCtx.listBindings(contextPath);
int i = 1;
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet NewServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet NewServlet at " +
request.getContextPath() + "</h1>");
while (enum1.hasMore()) { out.println(" List:" + i); out.println("<br>"); out.println(((Binding) enum1.next()).toString()); out.println("<br>"); i++; }
out.println("</body>");
} finally { out.close(); }
}
----------------------------------------------------------
steps to replicate the issue

1) start the application server, deploy the war module attached to the bug report.
2) Launch http;//localhost;8080/WebApplication1. Click on the button in the JSP
page. This will launch 'NewServlet' with above mentioned code.
3) Nothing will be visible in the page. Server.log registers 'NameNotFoundException'
4) Launch admin console. Goto Application Server|JNDI Browser. Clicking on the
button will launch JNDI Browser of the application server.
5) Repeat step 2 and will show all resources starting with names 'jms'.



vamsee_krishna added a comment - 22/Jun/09 03:43 AM

Created an attachment (id=2909)
war module replicating the issue


vamsee_krishna added a comment - 22/Jun/09 03:44 AM

Created an attachment (id=2910)
server log file


vamsee_krishna added a comment - 22/Jun/09 03:45 AM

Created an attachment (id=2911)
domain.xml file


chrjohn added a comment - 22/Jun/09 04:10 AM
      • Issue 8569 has been confirmed by votes. ***

wayerr added a comment - 18/Aug/09 11:39 PM

some workaround

/**

  • Workaround длÑ� доÑ�адногго бага GlassFish 2.0
  • <a href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=8569">#8569</a>
    *
  • Вызывает ConnectorRuntime и заÑ�тавлÑ�ет его загрузить вÑ�е jms реÑ�урÑ�Ñ‹
  • @author rad
    */
    public class GFResourceHack {

@SuppressWarnings("unchecked")
static void loadAllSystemRAResources(){
ClassLoader cl = GFResourceHack.class.getClassLoader();
try { //загрузка кла��а Class connectorRuntime = cl.loadClass("com.sun.enterprise.connectors.ConnectorRuntime"); //кла�� пред�тавл�ет �обой singleton... Method getRuntime = connectorRuntime.getDeclaredMethod("getRuntime"); Object connectorRuntimeObject = getRuntime.invoke(null); //�об�твенно метод загрузки ре�ур�ов Method loadAllSystemRAResources = connectorRuntime.getMethod("loadAllSystemRAResources"); loadAllSystemRAResources.invoke(connectorRuntimeObject); } catch (Exception ex) { Logger.getLogger(GFResourceHack.class.getName()).log(Level.SEVERE, null, ex); }
}
}


jthoennes added a comment - 19/Aug/09 12:52 AM

Пожалу�та переводите комментарии на англи�кий. Спа�ибо!


kumara added a comment - 14/Sep/09 08:39 PM

Issue somewhere between jca and naming. Assigning to jca based on workaround code.


Jagadish added a comment - 15/Sep/09 07:27 AM

jdbc and jms resources (any system RAR resources) are loaded lazily (ie., during
first time lookup).

It works when Admin GUI's jndi browser is invoked is due to the calls to load
the system RAR resources.

https://glassfish.dev.java.net/source/browse/glassfish/admin-gui/src/java/com/sun/enterprise/tools/admingui/handlers/JndiBrowserHandlers.java?annotate=1.5
Line : 121

ConnectorRuntime exposes an API for other containers to load the system RAR
resources explicitly.

ConnectorRuntime.getRuntime().loadAllSystemRAResources()
https://glassfish.dev.java.net/source/browse/glassfish/appserv-core/src/java/com/sun/enterprise/connectors/ConnectorRuntime.java?annotate=1.19.4.1
Line : 1183

NamingManager during the call to "initialContext.list()/ listBindings()" can
make this call so that all system RAR resources are loaded explictly. (This will
be one time operation after which further calls will be no-op)

Transferring to Naming category for the fix in v2.

This is not applicable in v3 as we always bind either objects or its proxy in
JNDI and hence initialContext.list()/listBindings() will list the entries.

Marking the issue as not applicable for v3.


ksak added a comment - 17/Sep/09 09:06 AM

Deferring to V2.2.


Ed Bratt added a comment - 18/Sep/09 03:37 PM

Setting correct target milestone


marina vatkina added a comment - 08/Jun/10 11:25 AM

fixed in v3


marina vatkina added a comment - 08/Jun/10 12:26 PM

actually marking as fixed