5 Replies Latest reply on Dec 21, 2007 2:31 AM by Martin Ganserer

    Multiple problems with ServerInvokerServlet and HttpNamingCo

    Martin Ganserer Novice

      Hi experts of remoting!

      My configuration is as follows:
      I use JBOSS 4.2.2 GA (EJB3). A remote client (RCP) communicates with the server via the ServerInvokerServlet.
      Basically everything works fine and the response time is very good.
      Here an example how I connect to the server:

      // Initialize initial context
       Hashtable env = new java.util.Hashtable();
      
       env.put(InitialContext.PROVIDER_URL, "http://myhost:8080/invoker/JNDIFactory");
       env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
       env.put(InitialContext.SECURITY_PRINCIPAL, "user");
       env.put(InitialContext.SECURITY_CREDENTIALS, "password");
       env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      
       try
       {
       ctx = new InitialContext(env);
       }
       catch (NamingException e1)
       {
       e1.printStackTrace();
       }
      
       ctx.lookup(...)


      Well, as I said it works basically. But I have some further demands, that I haven't been able to implement yet.

      1. Security
      The application I deploy on the server uses a simple log-in module, witch works great when I use RMI as transport protocol.
      If I use http as transport I get an error message that the user name is null!
      What do I have to configure to get this working?

      2. Exeption handling
      Due to a bug in JBOSS remoting I downloaded the latest version of remoting in order to catch remote exceptions on my client. The tutorials say that there is a client-side switch: NO_THROW_ON_ERROR.
      Where do I have to set this command within my configuration?

      3. Compression
      I want to compress traffic between server and client. On the server side I use following configuration:

      <mbean code="org.jboss.remoting.transport.Connector"
       name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
       <depends>jboss.aop:service=AspectDeployer</depends>
       <attribute name="Configuration">
       <config>
       <invoker transport="servlet">
       <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
       <attribute name="serverBindPort">8080</attribute>
       <attribute name="path">servlet-invoker/ServerInvokerServlet</attribute>
       <attribute name="marshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingMarshaller</attribute>
       <attribute name="unmarshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingUnMarshaller</attribute>
       </invoker>
       <handlers>
       <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
       </handlers>
       </config>
       </attribute>
      </mbean>


      At the moment I get an error message when I try this configuration on my server telling me that the header is not in GZIP-format.
      What do I have to do here on my client to use compression successfully?

      Thank you very much in advance!!

        • 1. Re: Multiple problems with ServerInvokerServlet and HttpNami
          Martin Ganserer Novice

          Hi all,

          I could solve the problem by myself. I simply added a UsernamePasswordHandler in my client!

          • 2. Re: Multiple problems with ServerInvokerServlet and HttpNami
            Ron Sigal Master

            Hi Martin,

            I'm glad you solved at least part of the problem. I can add a couple of points.


            2. Exeption handling
            Due to a bug in JBOSS remoting I downloaded the latest version of remoting in order to catch remote exceptions on my client. The tutorials say that there is a client-side switch: NO_THROW_ON_ERROR.
            Where do I have to set this command within my configuration?


            NO_THROW_ON_ERROR probably isn't what you want. As of Remoting version 2.2.2.SP2 (available from the repository at http://repository.jboss.com/jboss/remoting/2.2.2.SP2/
            (though you might as well go for 2.2.2.SP3 at http://repository.jboss.com/jboss/remoting/2.2.2.SP3-brew/),
            the fix to JIRA issue JBREM-813 "ServletServerInvoker should return an exception instead of just an error message" (http://jira.jboss.com/jira/browse/JBREM-813), allows you configure the server to return the actual exception thrown by the application code. You need to configure this behavior: in $SERVER_HOME/server/default/deploy/ejb3.deployer/META-INF/jboss-service.xml, change the line

            <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
            


            to

            <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/?return-exception=true</attribute>
            



            3. Compression
            I want to compress traffic between server and client. On the server side I use following configuration:


            There seems to be a problem using the compression marshaller in the Application Server. I'm looking into it: JIRA issue JBREM-677: "Compression marshalling fails intermittently."

            • 3. Re: Multiple problems with ServerInvokerServlet and HttpNami
              Martin Ganserer Novice

              Hello Ron,

              thank you for your response! I changed my configuration in order to receive exceptions now.
              And it got better! In contrast to the old configuration I can see now the exception in the stack trace. But the problem I am facing now is that I only get an UndeclaredThrowable:

              de.kem.piq.client.util.DocumentHelper.createDocument(DocumentHelper.java:205)
              de.kem.piq.client.view.DocumentTreeView$9.drop(DocumentTreeView.java:787)
              org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
              org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
              org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
              org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
              org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
              org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:706)
              org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:414)
              org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:237)
              org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
              org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
              org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2265)
              org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3291)
              org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
              org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
              org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
              org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
              org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
              org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
              org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
              de.kem.piq.client.PIQ.start(PIQ.java:85)
              org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
              org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
              org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
              org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
              org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              java.lang.reflect.Method.invoke(Unknown Source)
              org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
              org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
              org.eclipse.equinox.launcher.Main.run(Main.java:1173)
              org.eclipse.equinox.launcher.Main.main(Main.java:1148)
              
              Caused by org.jboss.remoting.transport.servlet.ServletThrowable: java.lang.IllegalAccessException: You are not authorized to create a document in this folder!
              
              org.jboss.remoting.transport.servlet.ServletServerInvoker.processRequest(ServletServerInvoker.java:242)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              java.lang.reflect.Method.invoke(Method.java:597)
              org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
              $Proxy47.processRequest(Unknown Source)
              org.jboss.remoting.transport.servlet.web.ServerInvokerServlet.processRequest(ServerInvokerServlet.java:127)
              org.jboss.remoting.transport.servlet.web.ServerInvokerServlet.doPost(ServerInvokerServlet.java:156)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              java.lang.Thread.run(Thread.java:619)
              
              Caused by java.lang.IllegalAccessException: You are not authorized to create a document in this folder!
              
              de.kem.piq.service.doc.document.bean.DocumentServiceBean.createDocument(DocumentServiceBean.java:278)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              java.lang.reflect.Method.invoke(Method.java:597)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
              org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
              org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
              org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:166)
              org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:115)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
              org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
              org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
              org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
              org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:771)
              org.jboss.remoting.transport.servlet.ServletServerInvoker.processRequest(ServletServerInvoker.java:232)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              java.lang.reflect.Method.invoke(Method.java:597)
              org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
              org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
              org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
              org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
              org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
              javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
              $Proxy47.processRequest(Unknown Source)
              org.jboss.remoting.transport.servlet.web.ServerInvokerServlet.processRequest(ServerInvokerServlet.java:127)
              org.jboss.remoting.transport.servlet.web.ServerInvokerServlet.doPost(ServerInvokerServlet.java:156)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              java.lang.Thread.run(Thread.java:619)
              org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
              org.jboss.remoting.Client.invoke(Client.java:1634)
              org.jboss.remoting.Client.invoke(Client.java:548)
              org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
              org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
              $Proxy6.createDocument(Unknown Source)
              de.kem.piq.client.util.DocumentHelper.createDocument(DocumentHelper.java:205)
              de.kem.piq.client.view.DocumentTreeView$9.drop(DocumentTreeView.java:787)
              org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:90)
              org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
              org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
              org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
              org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
              org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:706)
              org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:414)
              org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:237)
              org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:119)
              org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
              org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2265)
              org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3291)
              org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
              org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
              org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
              org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
              org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
              org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
              org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
              de.kem.piq.client.PIQ.start(PIQ.java:85)
              org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
              org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
              org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
              org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
              org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
              sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              java.lang.reflect.Method.invoke(Unknown Source)
              org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
              org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
              org.eclipse.equinox.launcher.Main.run(Main.java:1173)
              org.eclipse.equinox.launcher.Main.main(Main.java:1148)


              The bold lines represent the application exception that I am expecting!

              In the debug mode I see the UndeclaredThrowableException but the fields message and cause are null!

              Best regards



              • 4. Re: Multiple problems with ServerInvokerServlet and HttpNami
                Ron Sigal Master

                Hi Martin,

                That org.jboss.remoting.transport.servlet.ServletThrowable is used to wrap the actual exception thrown by the application code. On the client side HTTPClientInvoker should unwrap that ServletThrowable and throw the actual exception.

                Are you saying that the call to de.kem.piq.client.util.DocumentHelper.createDocument() is throwing the ServletThrowable?

                Note, by the way, that if you set NO_THROW_ON_ERROR to true, createDocument() will *return* the ServletThrowable instead of unwrapping it and throwing the actual exception, so you probably don't want to do that.

                • 5. Re: Multiple problems with ServerInvokerServlet and HttpNami
                  Martin Ganserer Novice

                  Hi Ron,
                  where can I set NO_THROW_ON_ERROR to false or true? At the moment this flag is not set at all in my client! But my problem still exists that when I take a look at the debugger I can the see ServletThrowable only. It seems that the exception I expect (IllegalAccessException) has been transported to the client but it is not accessible. That means that it is visible in the debugger but not useable in my client by using e.getCause() or something like that.

                  Regards,

                  Martin