4 Replies Latest reply on Apr 21, 2008 8:38 PM by ? ??

    How to use Messaging from a remote client? (JBoss 4.2.0)

    Jason Hsu Newbie

      I have thre questions.... the scenario for the quesiton, please see below..

      Q1. Why do I have bind a IP other than 127.0.0.1 then I can get the response from "telnet <server name> 1099" ? And if I use "run -b 192.168.x.x"
      then "telnet localhost 1099" doesn't work at all.

      Q2. How to make a console applicaiton (I think UI application has the same issue) communicate with Messaging from remote?

      Q3. How to make a web application on remote Tomcat to communicate with Messaging?

      Please let me know what code or file I should write and what kind of modification should be made on JBoss. I've searched dozens of articles. They just
      focused on explaining individual parameter or config sections or discrete codes. They help very limited.

      Please help. Thank you.

      Jason



      I'll try to describe what I did step by step here.

      I'm using JBoss 4.2.0 GA. I want to create two programs to use its JMS remotely. One is a console application the other is web application on tomcat.

      My console application works fine on the same machine with JBoss by setting the

      java.naming.provider.url=jnp://localhost:1099


      Then I change to use <server name> instead of 'localhost'. It's dead. I tried to add "-Djboss.bind.address=192.168.x.x" to the variable
      %JAVA_OPTS% in run.bat of JBoss. However, there was error still.(Q1) Then I spent two days to figured it out. Finally, I found there is
      a parameter '-b' of run.bat. So the "run -b 192.168.x.x" is working.

      Now I use
      java.naming.provider.url=jnp://<server name>:1099

      in jndi.properities. I got the error:

      Exception in thread "main" java.security.AccessControlException: access denied (
      java.util.PropertyPermission java.security.auth.login.config write)
       at java.security.AccessControlContext.checkPermission(AccessControlConte
      xt.java:264)
       at java.security.AccessController.checkPermission(AccessController.java:
      427)
       at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
       at java.lang.System.setProperty(System.java:699)
       at TTestJBoss.<init>(TTestJBoss.java:29)
       at TTestJBoss.main(TTestJBoss.java:24)


      I spent another two days then add
      set POLICY_FILE=.\jboss_client.policy
      set AUTH_FILE=.\auth.conf
      
      and "-Djava.security.policy="%POLICY_FILE%" -Djava.security.auth.login.config=%AUTH_FILE%" in the execution line in
      the run.bat created by myself to execute my console application.
      

      The content of these two files are
      in jboss_client.policy:
      
      grant {
       permission java.security.AllPermission;
      };
      
      ============================================
      in auth.conf (I copy it from %JBOSS_HOME%\client) :
      
      srp-client {
       // Example client auth.conf for using the SRPLoginModule
       org.jboss.security.srp.jaas.SRPLoginModule required
       password-stacking="useFirstPass"
       principalClassName="org.jboss.security.SimplePrincipal"
       srpServerJndiName="SRPServerInterface"
       debug=true
       ;
      
       // jBoss LoginModule
       org.jboss.security.ClientLoginModule required
       password-stacking="useFirstPass"
       ;
      
       // Put your login modules that need jBoss here
      };
      
      other {
       // jBoss LoginModule
       org.jboss.security.ClientLoginModule required
       ;
      
       // Put your login modules that need jBoss here
      };
      

      Actually, I have no idea of these two files. Anyway, the error message changed which is better than no change at all.

      Here is the best error I got now: Line 1-6 are the information from my program. TopicListener is the class I created.
      got ctx
      About to get connection factory
      got factory
      About to get destination
      got destination
      Error occurs while the TopicListener is listening to the topic/topic1
      javax.jms.JMSSecurityException: User: null is NOT authenticated
       at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.ja
      va:230)
       at org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSe
      curityInterceptor.java:66)
       at org.jboss.mq.server.TracingInterceptor.authenticate(TracingIntercepto
      r.java:613)
       at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.ja
      va:172)
       at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocke
      tManagerHandler.java:238)
       at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.j
      ava:395)
       at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
      utor.java:743)
       at java.lang.Thread.run(Thread.java:595)