8 Replies Latest reply on Jun 30, 2008 3:59 AM by Pekka Rantanen

    JbossESB Server + RCP Client

    Pekka Rantanen Newbie

      Hi everybody!
      We have a big problem here. Our task is to create a "thin" client based on Eclipse RCP. The problem is that when we attach all the needed libraries from JBoss - to avoid the numerous "ClassNotFoundException", and try to lauch the process, nothing happens. That is, a message is sent according to the JBoss console, but nothing is received on the client, more, the client simply freezes.

      The server-side code works both for console and Swing applications. Any help will be appreciated.

        • 1. Re: JbossESB Server + RCP Client
          Daniel Bevenius Master

          Hi,

          could you post the client code that is doing the sending and receiving?

          Thanks,

          /Daniel

          • 2. Re: JbossESB Server + RCP Client
            Pekka Rantanen Newbie

             

            package rcptest;
            
            import java.io.StringReader;
            import java.util.LinkedList;
            import java.util.List;
            import java.util.Properties;
            import javax.jms.MessageListener;
            import javax.jms.ObjectMessage;
            import javax.jms.QueueConnection;
            import javax.jms.QueueConnectionFactory;
            import javax.jms.QueueReceiver;
            import javax.jms.QueueSender;
            import javax.jms.QueueSession;
            import javax.jms.Queue;
            import javax.jms.TextMessage;
            
            import javax.naming.Context;
            import javax.naming.InitialContext;
            import javax.naming.NamingException;
            
            public class ConsoleViewer
             implements MessageListener
            {
             static boolean useESBChannel = false;
             InitialContext ctx;
             QueueConnection conn;
            
             Queue que;
             Queue receiverQueue;
             QueueReceiver queueReceiver;
             boolean responseReceived;
            
             public ConsoleViewer() {
             super();
            
             stocks = new LinkedList<Properties>();
             }
            
             public List<Properties> getAllStocks() {
            System.out.println( "inside getAllStocks()" );
            
             try {
             setupConnection();
             doJMSQuery();
             receiveMesage();
             stop();
             }
             catch ( Exception e ) {
             e.printStackTrace( System.err );
             }
             return stocks;
             }
            
             void doJMSQuery()
             throws Exception
             {
             responseReceived = false;
             QueueSender send = session.createSender(que);
             ObjectMessage tm = session.createObjectMessage("JMS Channel: Test query");
             send.send(tm);
             send.close();
             }
            
             void setupConnection()
             throws Exception, NamingException
            {
            
             Properties properties = new Properties();
             properties.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
             properties.put( Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
             properties.put( Context.PROVIDER_URL, "jnp://127.0.0.1:1099" );
             ctx = new InitialContext( properties );
            
             Object tmp = ctx.lookup( "ConnectionFactory" );
             QueueConnectionFactory qcf = ( QueueConnectionFactory )tmp;
             conn = qcf.createQueueConnection();
             que = ( Queue )ctx.lookup( "queue/StAn_Request_gw" );
             session = conn.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE );
             conn.start();
             receiverQueue = ( Queue )ctx.lookup( "queue/StAn_Response" );
             queueReceiver = session.createReceiver( receiverQueue );
             queueReceiver.setMessageListener( this );
            
             System.out.println( "JMS Connection Started" );
             }
            
            
             void receiveMesage() {
             long lastms = System.currentTimeMillis() + 60 * 1000;
             try {
             while ( ( !responseReceived ) && ( lastms > System.currentTimeMillis() ) ) {
             Thread.sleep(1000);
             }
             } catch (Exception e) {
            
             }
             }
            
             void stop()
             throws Exception
             {
             conn.stop();
             session.close();
             conn.close();
             }
            
            
            
            
             public void onMessage(javax.jms.Message receivedMessage) {
             try {
             TextMessage msg = (TextMessage) receivedMessage;
             parseXML( msg.getText() ); //parsing XML to receive
             responseReceived = true;
             } catch (Exception e) {
             e.printStackTrace();
             }
             }
            }
            

            There it goes. The method getAllStocks() is invoked outside of the code. I omitted some methods that are of no relevance to the functionality.

            • 3. Re: JbossESB Server + RCP Client
              Kevin Conner Master

              You are just doing standard JMS here so it's not really an ESB issue.

              Can you get a thread dump when the freeze occurs?

              • 4. Re: JbossESB Server + RCP Client
                Pekka Rantanen Newbie

                Thread [main] (Stepping)
                SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]
                SocketInputStream.read(byte[], int, int) line: not available
                BufferedInputStream.fill() line: not available
                BufferedInputStream.read() line: not available
                DataInputStream(FilterInputStream).read() line: not available
                BisocketClientInvoker(MicroSocketClientInvoker).readVersion(InputStream) line: 986
                BisocketClientInvoker(MicroSocketClientInvoker).transport(String, Object, Map, Marshaller, UnMarshaller) line: 572
                BisocketClientInvoker.transport(String, Object, Map, Marshaller, UnMarshaller) line: 353
                BisocketClientInvoker(MicroRemoteClientInvoker).invoke(InvocationRequest) line: 122
                Client.invoke(Object, Map, InvokerLocator) line: 1550
                Client.addCallbackListener(InvokerCallbackHandler, Map, InvokerLocator, Object) line: 1619
                Client.addListener(InvokerCallbackHandler, Map, Object, boolean) line: 913
                JMSRemotingConnection.addInvokerCallbackHandler(Object, Client, Map, InvokerLocator, InvokerCallbackHandler) line: 226
                JMSRemotingConnection.start() line: 301
                ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$createConnectionDelegate$aop(String, String, int) line: 154
                ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.invokeNext() line: not available
                StateCreationAspect.handleCreateConnectionDelegate(Invocation) line: 83
                StateCreationAspect0.invoke(Invocation) line: not available
                ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.invokeNext() line: not available
                ClientConnectionFactoryDelegate.createConnectionDelegate(String, String, int) line: not available
                JBossConnectionFactory.createConnectionInternal(String, String, boolean, int) line: 205
                JBossConnectionFactory.createQueueConnection(String, String) line: 101
                JBossConnectionFactory.createQueueConnection() line: 95
                ConsoleViewer.setupConnection() line: 126
                ConsoleViewer.getAllStocks() line: 75
                MessagePopupAction.run() line: 37
                MessagePopupAction(Action).runWithEvent(Event) line: 498
                ActionContributionItem.handleWidgetSelection(Event, boolean) line: 546
                ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 490
                ActionContributionItem$6.handleEvent(Event) line: 443
                EventTable.sendEvent(Event) line: 66
                ToolItem(Widget).sendEvent(Event) line: 938
                Display.runDeferredEvents() line: 3682
                Display.readAndDispatch() line: 3293
                Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389
                Workbench.runUI() line: 2353
                Workbench.access$4(Workbench) line: 2219
                Workbench$4.run() line: 466
                Realm.runWithDefault(Realm, Runnable) line: 289
                Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461
                PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
                Application.start(IApplicationContext) line: 20
                EclipseAppHandle.run(Object) line: 169
                EclipseAppLauncher.runApplication(Object) line: 106
                EclipseAppLauncher.start(Object) line: 76
                EclipseStarter.run(Object) line: 363
                EclipseStarter.run(String[], Runnable) line: 176
                NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
                NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
                DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
                Method.invoke(Object, Object...) line: not available
                Main.invokeFramework(String[], URL[]) line: 508
                Main.basicRun(String[]) line: 447
                Main.run(String[]) line: 1173
                Main.main(String[]) line: 1148

                • 5. Re: JbossESB Server + RCP Client
                  Kevin Conner Master

                  It looks like there is an issue at the JBM/JBR layer, could you please make sure that you have the correct version of the messaging/remoting jars in your client classpath?

                  Which version of the ESB are you using?

                  • 6. Re: JbossESB Server + RCP Client
                    Pekka Rantanen Newbie

                    I'm using the latest version, i. e. 4.2.1GA. JARs in the classpath are from JBoss directories, that is, from its lib/, client/ and server/default/lib/ paths. I tried to do without the whole bunch of these libraries by connecting only jboss-rosetta and jbossall-client - it was enough to compile, but then ClassNotFoundExceptions appeared. It was a tedious task to look where the missing class might be, so, long story short, I added all available libraries to the classpath. Exceptions disappeared - to no avail.

                    • 7. Re: JbossESB Server + RCP Client
                      Kevin Conner Master

                      Well, the latest version is 4.3GA but I would suspect that jbossall-client.jar is the issue. Can you make sure that that your jboss-remoting.jar precedes this in your classpath? Does this fix the issue?

                      • 8. Re: JbossESB Server + RCP Client
                        Pekka Rantanen Newbie

                        Sorry for not answering so long. Well, your advice was really important because the point was the order of libraries on the class path. The message from the server arrives, now I have to dig it why my Eclipse application doesn't find the proper activator. =)

                        Thank you very much, Kevin!