8 Replies Latest reply on Sep 11, 2008 10:03 AM by Peter Johnson

    integrate JSF with JMS ?

    quinten jiang Newbie

      It is not sucessful to try to receive JMS message with JSF back bean. If MDB is used to received message, no way to directly access JSF backing beans from a MDB. If i try to receive message directly from back bean, Jboss have errors like:

      2008-09-09 15:48:03,449 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
      java.net.SocketException: socket closed
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:129)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
      at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:79)
      at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2196)
      at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2376)
      at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2443)
      at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2515)
      at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2664)
      at java.io.ObjectInputStream.readByte(ObjectInputStream.java:875)
      at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:340)
      at java.lang.Thread.run(Thread.java:595)
      2008-09-09 15:48:03,450 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run Thread[UIL2.SocketManager.ReadTask#3 client=127.0.0.1:64087,5,JBossMQ Server Threads]
      2008-09-09 15:48:03,451 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run Thread[UIL2.SocketManager.WriteTask#6 client=127.0.0.1:8093,5,JBossMQ Client Threads]
      2008-09-09 15:48:03,451 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run Thread[UIL2.SocketManager.WriteTask#4 client=127.0.0.1:64087,5,JBossMQ Server Threads]
      2008-09-09 15:48:03,451 DEBUG [org.jboss.mq.il.uil2.UILClientILService] Stopping


      Anyone know how to call MDB from EJB (stateless session bean)?

      Thanks,


      Quinten


        • 1. Re: integrate JSF with JMS ?
          Noel O'Connor Novice

           



          Anyone know how to call MDB from EJB (stateless session bean)?


          I don't think that you can call an MDB from a SLSB. You can do the opposite i.e. call a SLSB from an MDB.

          • 2. Re: integrate JSF with JMS ?
            mark spencer Newbie

            well theorically you could send a JMS message from the Session Bean and so inoking an MDB but it's not a good design choice in my opinion since MDB do not add value to the business logic contained in the Session bean because simply they don't return anything, they use a "Fire and Forget Pattern".

            It's quite common the opposite, where an MDB is fired for example to book a flight seat and inside the OnMessage a SLSB is invoked to perform the business logic which is synchronous.

            regards

            • 3. Re: integrate JSF with JMS ?
              quinten jiang Newbie

              Thanks, I just want to dispaly message in the view(JSF pages) when MDB received message ( onMessage ), it is no way to deliver this message from MDB to jsf back bean, then go to viewer. I try to implement this onMesage on the JSF back bean directly, but have error (close socket) with no success.


              • 4. Re: integrate JSF with JMS ?
                Peter Johnson Master

                The only thing I can think of is to have the MDB place the message in a third location (database? mbean? seam conversation?) and have the JSF bean pick it up from there.

                • 5. Re: integrate JSF with JMS ?
                  quinten jiang Newbie

                  Think, the easy way is to save message into database from MDB, the get message from back bean, but it is slow.


                  By the way, may I know how to do cofiguration, to allow remote JMS client to run on diffrent machine, I just change java.naming.provider.url=localhost into Jboss Server IP, but get error:

                  javax.naming.CommunicationException: Could not obtain connection to any of these urls: 10.0.2.35 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server 10.0.2.35:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 10.0.2.35:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]


                  • 6. Re: integrate JSF with JMS ?
                    Peter Johnson Master

                     

                    Could not obtain connection to any of these urls: 10.0.2.35


                    Which version of the JBoss Application Server are you using? If 4.2.x, did you read the readme.html file - first item under JBossAS 4.2.0 in the Configuration Issues section. Or see http://wiki.jboss.org/wiki/JBoss42FAQ

                    • 7. Re: integrate JSF with JMS ?
                      quinten jiang Newbie

                      Thanks,

                      run jboos:

                      run -b 0.0.0.0 is for remotely connection. But when I try to run jboss as window service. i try to change line in the wrapper.conf
                      wrapper.java.additional.1=-Dprogram.name=run.bat

                      into

                      wrapper.java.additional.1=-Dprogram.name=run.bat -b 0.0.0.0

                      Jboss server can not start.

                      Or
                      wrapper.java.additional.1=-Dprogram.name=run1.bat

                      and run1.bat like:
                      run.bat -b 0.0.0.0

                      Jboss can start running but with no remotely. Someone can help me with these?

                      Thanks


                      • 8. Re: integrate JSF with JMS ?
                        Peter Johnson Master

                        Looks like you are using the Tanuki Java Service Wrapper to run JBossAS as a service. The correct configuration file changes are:

                        wrapper.app.parameter.1=org.jboss.Main
                        wrapper.app.parameter.2=-b
                        wrapper.app.parameter.3=0.0.0.0

                        You will have the first line already, the other two are additional. Note that each line allows only a single token and that the options are provided for the app (and not Java, as what you did).