6 Replies Latest reply on Nov 28, 2005 1:59 PM by pavel.kral

    ejb3 and remote http invocation

      how should I annotate my session bean class to be accessible through http invoker? It is well documented for EJB<3 but I couldn't find any hints how to do it for EJB3

        • 1. Re: ejb3 and remote http invocation
          xubin

          EJB3 does not provide native support for web service now.

          You can see here http://wiki.jboss.org/wiki/Wiki.jsp?page=WebservicesAndEJB3

          • 2. Re: ejb3 and remote http invocation

            I'm not going to expose my EJB3 as web service (with SOAP/WSDL), I just want to use through firewalls. With JBoss and EJB<3 I could use http detached invoker (which is well documented in JBoss AS Guide ) but I can't find any help how to do it with EJB3, should I use annotations (which?) or should I configure it in old xml descriptor (how?).

            • 3. Re: ejb3 and remote http invocation
              dreyk

              You may invoke your ejb throw http protocol for it you must configure http connector on the server side. For example deploy\ejb3.deployer\META-INF\jboss-service must be:

              <server>
              <mbean code="org.jboss.ejb3.EJB3Deployer" name="jboss.ejb3:service=EJB3Deployer">
               <depends>jboss.aop:service=AspectDeployer</depends>
               </mbean>
              <mbean code="org.jboss.remoting.transport.Connector" xmbean-dd="org/jboss/remoting/transport/Connector.xml" name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
               <depends>jboss.aop:service=AspectDeployer</depends>
               <attribute name="InvokerLocator">http://localhost:7080</attribute>
              <attribute name="Configuration">
               <config>
              <handlers>
               <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
               </handlers>
               </config>
               </attribute>
               </mbean>
               </server>
              But in this case jboss run new http server.
              If you want use tomcat server that bundle to jboss you must use servelt conector
              servlet://localhost:8080/servlet-invoker/ServerInvokerServlet
              But befor use this connector you must add servlet-invoker.war to you deploy directory
              and put to it META-INF directory web.xml and jboss-web.xml:
              web.xml:
              <?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>

              and jboss-web.xml for example
              <jboss-web>
               <!-- Uncomment the security-domain to enable security. You will
               need to edit the jmx-console login configuration to setup the
               login modules used to authentication users.
               <security-domain>java:/jaas/jmx-console</security-domain>
               -->
              </jboss-web>


              after that add to you ejb anatation @RemoteBinding(clientBindUrl="http://localhost:8080/servlet-invoker/ServerInvokerServlet"),because if you don't add it client will be try to the servelt://localhost:8080/servlet-invoker/ServerInvokerServlet
              and some error will acure.
              But servlet connector implementing by developer with error i fix with bug fo me and write to the forum about this bug but nobody answer me.

              • 4. Re: ejb3 and remote http invocation

                I saw the post you had on the remoting forum about the servlet invoker bug. Sorry I have not replied to it yet. This bug will be fixed for 1.4.0 release of JBossRemoting (and appreciate you pointing it out).

                One of the reasons for my delayed response is that we are working on switching out the http invoker implementation to use the http connector for tomcat. I am not sure if or how this will impact configuration for the http or servlet invoker (since the two currently share code). I will post to the remoting forum about this when it is completed.

                Thanks.

                -Tom

                Tom Elrod
                JBossRemoting Lead

                • 5. Re: ejb3 and remote http invocation
                  dreyk

                  Tom,I very thankful for you response.
                  It will be grateful if you make only one http connector that use tomcat.It necasary for use Remoting behind firewall and using http load balancing for Jboss cluster.

                  • 6. Re: ejb3 and remote http invocation
                    pavel.kral

                    Upgrading to jBoss 4.0.3SP1 + Remoting 1.4.0beta (jboss-remoting.jar replacement for jboss) with still same result.