How to deploy local EJBs in JBoss-4.0.2?

Discussions

EJB programming & troubleshooting: How to deploy local EJBs in JBoss-4.0.2?

  1. I use OAS9i to deploy my J2EE application, now i trying to test JBoss-4.0.2, evety time i get this error while deploying

    10:39:11,947 INFO [EjbModule] Deploying JQueryManagerEJB
    10:39:12,568 INFO [EjbModule] Deploying JDespesaEJB
    10:39:12,688 INFO [EjbModule] Deploying JTableHtmlEJB
    10:39:12,758 INFO [EjbModule] Deploying JAdminEJB
    10:39:13,950 INFO [EJBDeployer] Deployed: file:/D:/usr/local/jboss-4.0.2/server
    /default/deploy/ejb-pansie.jar
    10:39:14,651 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/D
    :/usr/local/jboss-4.0.2/server/default/deploy/jmx-console.war/
    10:39:20,720 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
    0
    10:39:23,103 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
    10:39:23,373 INFO [JkMain] Jk running ID=0 time=10/390 config=null
    10:39:23,564 INFO [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4
    _0_2 date=200505022023)] Started in 2m:12s:200ms
    10:39:27,259 INFO [EARDeployer] Init J2EE application: file:/D:/usr/local/jboss
    -4.0.2/server/default/deploy/pansie-app.ear
    10:39:58,544 INFO [TomcatDeployer] deploy, ctxPath=/pansie, warUrl=file:/D:/usr
    /local/jboss-4.0.2/server/default/tmp/deploy/tmp26624pansie-app.ear-contents/pan
    sie-app-exp.war/
    10:39:58,724 ERROR [WebModule] Starting failed jboss.web.deployment:id=-17168445
    20,war=pansie-app.war
    org.jboss.deployment.DeploymentException: Error during deploy; - nested throwabl
    e: (javax.naming.NamingException: ejb-local-ref: 'ejb/local/JQueryManagerEJB', w
    ith web.xml ejb-link: 'JQueryManagerEJB' failed to resolve to an ejb with a Loca
    lHome)
            at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:366)

            at org.jboss.web.WebModule.startModule(WebModule.java:68)
            at org.jboss.web.WebModule.startService(WebModule.java:46)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
    upport.java:272)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
    eanSupport.java:222)
            at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
    er.java:141)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
    java:249)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
    ler.java:897)

      What did i wrong?

      Regards,
      Edson
  2. Deployment sequence[ Go to top ]

    JBoss has problems in resolving the deployment sequence.
    Make sure when your local ejb deployed it has access to all other ejbs it refers
  3. Hello to all, in JBoss comunite i found how to configure my application to work with JBoss, what i need to fix is <ejb-link> in web.xml, it should be a path to a jar file where my bean stands, or change <ejb-ref-name> in jboss-web.xml to match the same name in web.xml.

    ///////////////////////////////////////////
    web.xml

    <?xml version = '1.0' encoding = 'ISO-8859-1'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <description>Pansie</description>
      
    <context-param>
    <param-name>Ctx_nomeAmbiente</param-name>
    <param-value>Desenvolvimento</param-value>
    </context-param>

    <context-param>
    <param-name>Ctx_faixaTolerancia</param-name>
    <param-value>10000</param-value>
    </context-param>

      <!-- ////////////////////////////////////////////////////////////////// -->
      <!-- Títulos da spesquisas, que sào exibidas na tabela de consulta: -->
    <context-param>
    <param-name>Ctx_com.panamericano.pansie.despesas.SIE_ConsultaCentroCusto</param-name>
    <param-value>Consulta por centro de custo</param-value>
    </context-param>

    <context-param>
    <param-name>Ctx_com.panamericano.pansie.despesas.SIE_ConsultaFilial</param-name>
    <param-value>Consulta por filial</param-value>
    </context-param>

    <context-param>
    <param-name>Ctx_com.panamericano.pansie.despesas.SIE_ConsultaGrupo</param-name>
    <param-value>Consulta por grupo de contas</param-value>
    </context-param>

    <context-param>
    <param-name>Ctx_com.panamericano.pansie.despesas.SIE_ConsultaNatureza</param-name>
    <param-value>Consulta por natureza da conta</param-value>
    </context-param>

      <!-- Standard Action Servlet Configuration (with debugging) -->
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>application</param-name>
          <param-value>ApplicationResources</param-value>
        </init-param>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>2</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>2</param-value>
        </init-param>
        <init-param>
          <param-name>validate</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
      </servlet>
      
    <!-- ////////////////////////////////////////////////////////////////// -->
      <!-- Particularizacao do OAS9i: -->
      <servlet>
         <servlet-name>jsp</servlet-name>
         <servlet-class>oracle.jsp.runtimev2.JspServlet</servlet-class>
         <init-param>
            <param-name>precompile_check</param-name>
            <param-value>true</param-value>
         </init-param>
         <init-param>
            <param-name>main_mode</param-name>
            <param-value>justrun</param-value>
         </init-param>
         <init-param>
            <param-name>javaccmd</param-name>
            <param-value>javac -verbose</param-value>
         </init-param>
         <init-param>
            <param-name>debug_mode</param-name>
            <param-value>true</param-value>
         </init-param>
      </servlet>

      <!-- Standard Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>

      <session-config>
        <session-timeout>30</session-timeout>
      </session-config>
      <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>txt</extension>
        <mime-type>text/plain</mime-type>
      </mime-mapping>

      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
      </welcome-file-list>
      
    <taglib>
    <taglib-uri>http://127.0.0.1/pannet>
    <taglib-location>/WEB-INF/panfinance.tld</taglib-location>
    </taglib>

    <taglib>
    <taglib-uri>http://127.0.0.1/pansie>
    <taglib-location>/WEB-INF/pansie.tld</taglib-location>
    </taglib>

      <!-- Struts Tag Library Descriptors -->
      <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>

      <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>

      <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib>

    <!--
    To use the tags from this library in your JSP pages, add the following
    directive at the top of each page:
    <%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0" prefix="req" %>
    -->

    <resource-ref>
       <description>DB Connection</description>
    <res-ref-name>jdbc/OracleDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>

    <resource-ref>
       <description>
    Configuração para que o aplicativo possa utilizar os recursos do JavaMail
    definidos no ServletEngine.
       </description>
       <res-ref-name>MailSession</res-ref-name>
       <res-type>javax.mail.Session</res-type>
       <res-auth>Container</res-auth>
    </resource-ref>

      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JQueryManagerEJB</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>com.panamericano.pansie.ejb.JQueryManagerEJBLocalHome</local-home>
        <local>com.panamericano.pansie.ejb.JQueryManagerEJBLocal</local>
        <ejb-link>JQueryManagerEJB</ejb-link>
      </ejb-local-ref>

      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JDespesaEJB</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>com.panamericano.pansie.ejb.JDespesaEJBLocalHome</local-home>
        <local>com.panamericano.pansie.ejb.JDespesaEJBLocal</local>
        <ejb-link>JDespesaEJB</ejb-link>
      </ejb-local-ref>

      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JTableHtmlEJB</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>com.panamericano.pansie.ejb.JTableHtmlEJBLocalHome</local-home>
        <local>com.panamericano.pansie.ejb.JTableHtmlEJBLocal</local>
        <ejb-link>JTableHtmlEJB</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JAdminEJB</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>com.panamericano.pansie.ejb.JAdminEJBLocalHome</local-home>
        <local>com.panamericano.pansie.ejb.JAdminEJBLocal</local>
        <ejb-link>JAdminEJB</ejb-link>
      </ejb-local-ref>

    </web-app>

    ///////////////////////////////////////////
    jboss-web.xml

    <?xml version='1.0' encoding='ISO-8859-1'?>
     <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
    <jboss-web>
      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JQueryManagerEJB</ejb-ref-name>
        <local-jndi-name>ejb/local/JQueryManagerEJBLocalHome</local-jndi-name>
      </ejb-local-ref>

      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JDespesaEJB</ejb-ref-name>
        <local-jndi-name>ejb/local/JDespesaEJBLocalHome</local-jndi-name>
      </ejb-local-ref>

      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JTableHtmlEJB</ejb-ref-name>
        <local-jndi-name>ejb/local/JTableHtmlEJBLocalHome</local-jndi-name>
      </ejb-local-ref>
      
      <ejb-local-ref>
        <ejb-ref-name>ejb/local/JAdminEJB</ejb-ref-name>
        <local-jndi-name>ejb/local/JAdminEJBLocalHome</local-jndi-name>
      </ejb-local-ref>
      
      <resource-ref>
        <res-ref-name>jdbc/OracleDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:/jdbc/OracleDS</jndi-name>
      </resource-ref>

    <resource-ref>
       <res-ref-name>MailSession</res-ref-name>
       <res-type>javax.mail.Session</res-type>
          <jndi-name>java:/mail/Mail</jndi-name>
    </resource-ref>
      
    </jboss-web>

      Now application works fine in OAS9i and JBoss-4.0.2!
    ;-)