4 Replies Latest reply on Apr 11, 2007 11:24 AM by Stephane LEVY

    Problems with servlet transport

    Trevor Harris Newbie

      I am using Jboss 4.0.4RC1 and have created a simple stateless session bean using ejb3. Remote access using the default socket transport works fine but I cannot get servlet trandport working.

      I have added this to ejb3.deployer/META-INF/jboss-service.xml

       <mbean code="org.jboss.remoting.transport.Connector"
       xmbean-dd="org/jboss/remoting/transport/Connector.xml"
       name="jboss.remoting:type=Connector,transport=servlet,name=Servlet,handler=ejb3">
       <depends>jboss.aop:service=AspectDeployer</depends>
       <attribute name="InvokerLocator">servlet://${jboss.bind.address}:8080/servlet-invoker/ServerInvokerServlet</attribute>
       <attribute name="Configuration">
       <handlers>
       <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
       </handlers>
       </attribute>
       </mbean>
      


      I have added servlet-invoker.war to the deploy directory. This contains the following META_INF/web.xml file

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC
       "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
       "http://java.sun.com/dtd/web-app_2_3.dtd">
      
      <!-- The the JBossRemoting server invoker servlet web.xml descriptor
      $Id: web.xml,v 1.1 2005/06/16 21:12:48 telrod Exp $
      -->
      <web-app>
       <servlet>
       <servlet-name>ServerInvokerServlet</servlet-name>
       <description>The ServerInvokerServlet receives requests via HTTP
       protocol from within a web container and passes it onto the
       ServletServerInvoker for processing.
       </description>
       <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
       <init-param>
       <param-name>invokerName</param-name>
       <param-value>jboss.remoting:service=invoker,transport=servlet</param-value>
       <description>The servlet server invoker</description>
       </init-param>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>ServerInvokerServlet</servlet-name>
       <url-pattern>/ServerInvokerServlet/*</url-pattern>
       </servlet-mapping>
      </web-app>
      
      

      My session bean is declared as:
      @RemoteBinding(clientBindUrl="http://localhost:8080/servlet-invoker/ServerInvokerServlet", jndiBinding="mailserver.TestStatelessEJB.servlet")
      


      The client program is:
       Properties p = new Properties();
       p.put( Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       p.put( Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
       p.put("java.naming.provider.url", "localhost");
       ctx = new InitialContext(p);
       TestStatelessRemote r = (TestStatelessRemote) ctx.lookup("mailserver.TestStatelessEJB.servlet");
       r.remove(10);
       r.create(10,"hello from testEJB");
       System.out.println(r.getText(10));
      .....
      
      


      JNDI lookup works ok but when r.remove is executed the following exception is thrown:
      org.jboss.remoting.CannotConnectException: Can not connect http client invoker.
       at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:192)
       at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:74)
       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:136)
       at org.jboss.remoting.Client.invoke(Client.java:444)
       at org.jboss.remoting.Client.invoke(Client.java:407)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       at $Proxy0.remove(Unknown Source)
       at trevan.mailserver.client.TestClient.main(TestClient.java:55)
      Caused by: java.io.StreamCorruptedException: invalid stream header
       at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
       at java.io.ObjectInputStream.<init>(Unknown Source)
       at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.<init>(ObjectInputStreamWithClassLoader.java:57)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.createInput(JavaSerializationManager.java:52)
       at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:119)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
       at org.jboss.remoting.marshal.http.HTTPUnMarshaller.read(HTTPUnMarshaller.java:131)
       at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:166)
       ... 15 more
      


      Please can anyone help.

      Please can you tell me if http transport is still supported or only servlet and socker.

      Regards Trevor


        • 1. Re: Problems with servlet transport
          Trevor Harris Newbie

          I also got the following error in the log

          2006-02-27 15:21:26,400 ERROR [org.jboss.naming.JNDIView] JNDIView.getHAJndiAttributes() failed
          java.lang.NullPointerException: name cannot be null
           at javax.management.ObjectName.construct(Unknown Source)
           at javax.management.ObjectName.<init>(Unknown Source)
           at org.jboss.naming.JNDIView.getHAJndiAttributes(JNDIView.java:836)
           at org.jboss.naming.JNDIView.getHAUrl(JNDIView.java:811)
           at org.jboss.naming.JNDIView.list(JNDIView.java:193)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
           at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:223)
           at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:262)
           at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:100)
           at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:82)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Unknown Source)
          

          Regards trevor


          • 2. Re: Problems with servlet transport
            Tom Elrod Master

            Thanks for letting us know. Have created a jira issue for this (JBREM-322).

            • 3. Re: Problems with servlet transport
              Trevor Harris Newbie

              Problem with servlet was my misteak I had not deployed the servlet properly.
              I still cannot get http working.

              • 4. Re: Problems with servlet transport
                Stephane LEVY Newbie

                Try adding the following jar files in server/default/lib :

                tomcat-apr.jar
                tomcat-coyote.jar
                tomcat-http.jar
                tomcat-util.jar

                These are included in the jbossweb-tomcat55.sar directory.
                (see http://jira.jboss.com/jira/browse/JBAS-2766)