-
1. Re: jndi jms topic lookup fails while deployment
prasad.deshpande Jul 6, 2011 4:58 AM (in response to prasad.deshpande)Aparently, mappedName should start with "java:/". So tag becomes mappedName="java:/topic/efpErrorTopic", then it works fine.
A small question still if someone can answer,
what is a default namespace in AS7? So suppose, I don't specify "java:/", then where exactly jndi lookup performed? I guess in earlier versions it was "java:comp/env", I tried in AS7 for com/env, but it didn't work for me. Could anyone answer please?
-
2. Re: jndi jms topic lookup fails while deployment
jaikiran Jul 6, 2011 5:03 AM (in response to prasad.deshpande)Prasad Deshpande wrote:
Aparently, mappedName should start with "java:/". So tag becomes mappedName="java:/topic/efpErrorTopic", then it works fine.
Hmm, I'll have to see what's going on here. I mean, I'll have to check to what namespace the queue/topics are bound by default when you have
<jms-queue name="testQueue"> <entry name="queue/test"/> </jms-queue>
From what you say, it looks like they are by default bound to java: namespace.
Prasad Deshpande wrote:
A small question still if someone can answer,
what is a default namespace in AS7? So suppose, I don't specify "java:/", then where exactly jndi lookup performed? I guess in earlier versions it was "java:comp/env", I tried in AS7 for com/env, but it didn't work for me. Could anyone answer please?
This might help http://lists.jboss.org/pipermail/jboss-as7-dev/2011-July/002890.html
-
3. Re: jndi jms topic lookup fails while deployment
prasad.deshpande Jul 6, 2011 5:22 AM (in response to jaikiran)Yes, I had look at this discussion over weekned, but I thought since the issue is not yet fixed, it still allows to bind to java:/ namespace. I've created a small piece of code to expose JNDI tree, & I found that when you deploy queue/topic like
<jms-queue name="testQueue">
<entry name="queue/test"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/testTopic"/>
</jms-topic>It get's bound under "java:/queue" & "java:/topic" namespace. This is exactly how, I was able to proceed with the error in the first post. But since, http://lists.jboss.org/pipermail/jboss-as7-dev/2011-July/002890.html is going to change the way it is now, I'll have to wait until this is being fixed.
-
4. Re: jndi jms topic lookup fails while deployment
jaikiran Jul 28, 2011 6:33 AM (in response to prasad.deshpande)1 of 1 people found this helpfulThis is fixed as part of AS7-1210 and is available in latest AS7 nightly builds.
-
5. Re: jndi jms topic lookup fails while deployment
prasad.deshpande Jul 28, 2011 8:13 AM (in response to jaikiran)Strange enough, If I specify as follows in destination configuration:
<jms-queue name="testQueue">
<entry name="queue/testQueue"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/testTopic"/>
</jms-topic>I get message that it is bound to "java:jboss/jms/queue/testQueue" & "java:jboss/jms/topic/testTopic" resp. but when I see it in JNDI It shows in "java:jboss/queue/testQueue" & "java:jboss/topic/testTopic" resp.
Not sure why..
so I explicitely have to specify as :
<jms-queue name="testQueue">
<entry name="java:jboss/jms/queue/testQueue"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="java:jboss/jms/
topic/testTopic"/>
</jms-topic>need to dig-in more..
-
6. Re: jndi jms topic lookup fails while deployment
jaikiran Jul 28, 2011 8:32 AM (in response to prasad.deshpande)Prasad Deshpande wrote:
Strange enough, If I specify as follows in destination configuration:
<jms-queue name="testQueue">
<entry name="queue/testQueue"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/testTopic"/>
</jms-topic>I get message that it is bound to "java:jboss/jms/queue/testQueue" & "java:jboss/jms/topic/testTopic" resp. but when I see it in JNDI It shows in "java:jboss/queue/testQueue" & "java:jboss/topic/testTopic" resp.
Which JNDI tree? The one available from the command line client?
-
7. Re: jndi jms topic lookup fails while deployment
prasad.deshpande Jul 28, 2011 9:27 AM (in response to jaikiran)Not really, I created a sample servlet that browses JNDI, until AS7 comesup with JNDI console, it will be helpful to me...
package com;
import java.io.IOException;
import java.io.PrintWriter;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class JNDITree extends HttpServlet {
private static final long serialVersionUID = 1L;
private Context context;
PrintWriter out = null;
HttpServletResponse response = null;
StringBuffer htmlBuf = null;
Boolean isFirstElement = true;
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
response = res;
response.setContentType("text/html");
out = res.getWriter();
printHTMLJNDITree("");
out.print(htmlBuf.toString());
}
private void printHTMLJNDITree(String ct) {
htmlBuf = new StringBuffer();
htmlBuf.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" +
"\n<HTML>" +
"\n<HEAD>\n<TITLE>JBoss JNDI Tree</TITLE>" +
"\n<link rel=\"stylesheet\" href=\"./jquery.treeview.css\" />" +
"\n<script src=\"./jquery.js\" type=\"text/javascript\"></script>" +
"\n<script src=\"./jquery.treeview.js\" type=\"text/javascript\"></script>" +
"\n<script>" +
"\n$(document).ready(function(){" +
"\n\t$(\"#jndiTreeView\").treeview({" +
"\n\t\tanimated: \"fast\"," +
"\n\t\tcollapsed: true," +
"\n\t\tunique: false});" +
"\n});" +
"\n</script>" +
"\n</HEAD>" +
"\n<BODY>" +
"\n<h1>JBoss JNDI Tree</h1>" +
"\n<ul id=\"jndiTreeView\">");
increaseIndent();
printJNDITree("");
htmlBuf.append("\n</ul>\n</BODY></HTML>");
}
public void init(ServletConfig config) throws ServletException{
super.init(config);
setEnv();
}
public void setEnv() {
try {
context = new InitialContext();
} catch (Exception e) {
e.printStackTrace();
}
}
public void printJNDITree(String ct) {
try {
printNE(context.list(ct), ct);
} catch (NamingException e) {
// ignore leaf node exception
}
}
private void printNE(NamingEnumeration ne, String parentctx) throws NamingException {
Boolean shouldDecreaseIndent = false;
if (ne.hasMoreElements() &&!isFirstElement) {
htmlBuf.append("\n" + printIndent() + "<ul>");
increaseIndent();
shouldDecreaseIndent = true;
}
while (ne.hasMoreElements()) {
isFirstElement = false;
NameClassPair next = (NameClassPair) ne.nextElement();
printEntry(next);
increaseIndent();
printJNDITree((parentctx.length() == 0) ? next.getName() : parentctx + "/" + next.getName());
decreaseIndent();
htmlBuf.append("\n" + printIndent() + "</li>");
}
if (shouldDecreaseIndent) {
decreaseIndent();
htmlBuf.append("\n" + printIndent() + "</ul>");
}
}
private void printEntry(NameClassPair next) {
htmlBuf.append("\n" + printIndent() + "<li><span>" + next + "</span>");
}
private int indentLevel = 0;
private void increaseIndent() {
indentLevel += 4;
}
private void decreaseIndent() {
indentLevel -= 4;
}
private String printIndent() {
StringBuffer buf = new StringBuffer(indentLevel);
for (int i = 0; i < indentLevel; i++) {
buf.append(" ");
}
return buf.toString();
}
}