Can anyone help me understand why the code below fails?
I tired to get an instance of InitialContext over HTTP per chapter 3.2.1.2 of
the JBoss 4 Application Server Guide at:
http://docs.jboss.org/jbossas/jboss4guide/r1/html/ch3.chapter.html.
You will find below:
1.The code which should run on any current out of the box jboss server.
2.The Screen Print from that code.
3. Info on JMXInvokerServlet from the web-console that show it is being
accessed on each failure.
4. Relevant exerpts from chapter 3.2.1.2.
I obviously am missing something very basic, and would sure appreciate a hint
of where else to look.
CODE: import java.lang.reflect.Method;
| import java.util.Hashtable;
| import javax.jms.*;
| import javax.naming.*;
|
| public class Test {
|
| public static void main (String[] args) {
| Test test = new Test ();
| test.doMessage ();
| }
|
| // method
| public void doMessage () {
| try {
|
| // get initial context
| Hashtable<String, String> env= new Hashtable<String, String> ();
| env.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jboss.naming.HttpNamingContextFactory");
| env.put(Context.PROVIDER_URL,
| "http://localhost:8080/invoker/JMXInvokerServlet");
| env.put(Context.URL_PKG_PREFIXES,
| "org.jboss.naming:org.jnp.interfaces");
| p ("Calling InitialContext");
| ctx = new InitialContext(env);
| p ("InitialContext Found");
|
| } catch (NamingException e) {
| p ("\nNaming Exception");
| p (" Explanation: " + "\n " + e.getExplanation() + "\n");
| p (" Resolved Name: " + "\n " + e.getResolvedName() + "\n");
| p (" RemaingingName: " + "\n " + e.getRemainingName() + "\n");
| p (" Root Cause: " + "\n " +e.getRootCause() + "\n");
| p (" Stack Trace: ");
| e.printStackTrace ();
| } finally {
| if (connection != null) {
| try {
| connection.stop ();
| connection.close();
| } catch (JMSException e) {
| }
| }
| }
| System.out.println("\nmain () End:");
| }
|
| void p (String s) {
| System.out.println (s);
| }
|
| // members
| Context ctx;
| Queue destination;
| QueueConnection connection;
| QueueConnectionFactory factory;
| QueueReceiver receiver;
| QueueSession session;
| QueueSender sender;
| TextMessage message;
| } SCREEN PRINT:Calling InitialContext
|
| Naming Exception
| Explanation:
| Failed to retrieve Naming interface
|
| Resolved Name:
| null
|
| RemaingingName:
| null
|
| Root Cause:
| java.io.IOException: Invalid reply content seen: class
org.jboss.invocation.InvocationException
|
| Stack Trace:
| javax.naming.NamingException: Failed to retrieve Naming interface [Root
exception is java.io.IOExcep
| tion: Invalid reply content seen: class
org.jboss.invocation.InvocationException]
| at
org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java
| :69)
| at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
| at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
| at javax.naming.InitialContext.init(InitialContext.java:223)
| at javax.naming.InitialContext.<init>(InitialContext.java:197)
| at Test.doMessage(Test.java:38)
| at Test.main(Test.java:22)
| Caused by: java.io.IOException: Invalid reply content seen: class
org.jboss.invocation.InvocationExc
| eption
| at
org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:1
| 38)
| at
org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java
| :65)
| ... 6 more
|
| main () End:
| Press any key to continue . . . JBoss Web-Server Info for
JMXInvokerServlet:Servlet
| Name: JMXInvokerServlet
| Servlet Statistics:
| Min (ms)| Max (ms) | Average (ms) | Total (ms) | # Invocations|
| 0 | 20 | 12.5 | 100 | 8 |EXTRACT OF
CHAPTER:3.2.1.2.
|
| The HTTP InitialContext Factory Implementation The JNDI naming service can
be accessed over HTTP.
| ...
| The complete set of support InitialContext environment properties for this
factory are:
|
| java.naming.factory.initial: ... must be
org.jboss.naming.HttpNamingContextFactory.
|
| java.naming.provider.url: ...must be ... the public URL of the JBoss
servlet container plus /invoker/JMXInvokerServlet. Examples include:
| http://www.jboss.org:8080/invoker/JMXInvokerServlet
| http://www.jboss.org/invoker/JMXInvokerServlet ...
| I tired both and both fail
|
| The first example accesses the servlet using the port 8080.
| The second uses the standard HTTP port 80 ...
|
| java.naming.factory.url.pkgs: ... must be
org.jboss.naming:org.jnp.interfaces.
|
| ...The proxy needs to know what the URL of the bridge servlet is in order
to operate...
|
| If the JBoss web server is sitting behind one or more firewalls It is not
...Hope someone can help. I have been lost on this for over a week.
glb
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3871236#3871236
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3871236
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user