JBoss EJB problem

Discussions

General J2EE: JBoss EJB problem

  1. JBoss EJB problem (7 messages)

    I'm using jboss as application server, my application use session EJBs but I have this error:

    "no ejb-link in web.xml and no jndi-name in jboss-web.xml"

    MY ejb-jar.xml:

        <session>
          <description>Session Bean ( Stateless )</description>
          <display-name>EmpleadoSessionEJB</display-name>
          <ejb-name>EmpleadoSessionEJB</ejb-name>
          <home>CCSS.DDMS.aplicacionBase.ejbs.session.facade.EmpleadoSessionEJBHome</home>
          <remote>CCSS.DDMS.aplicacionBase.ejbs.session.facade.EmpleadoSessionEJB</remote>
          <ejb-class>CCSS.DDMS.aplicacionBase.ejbs.session.facade.EmpleadoSessionEJBBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Bean</transaction-type>
        </session>

    MY web.xml:

      <ejb-ref>
        <ejb-ref-name>ejb/EmpleadoSessionEJB</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <home>CCSS.DDMS.aplicacionBase.ejbs.session.facade.EmpleadoSessionEJBHome</home>
        <remote>CCSS.DDMS.aplicacionBase.ejbs.session.facade.EmpleadoSessionEJB</remote>
        <ejb-link>EmpleadoSessionEJB</ejb-link>
      </ejb-ref>

    Can anyone help me to find why I have that error?
  2. Do you have any specific reason of declaring the ejb-ref in web.xml.
    I never needed to do unless it is a local bean.
    Your ejb-jar shows it is a remote bean & in jboss the jbos.xml is the vendor specific file where you can put your jndi name.

    jboss-web.xml is a webserver level deployment descriptor and of no use while deploying ejbs. just remove the entries from web.xml and it should be able to deploy.

    Even jboss uses the ejb-name as the jndi name if you do not specify in the jboss.xml
  3. Ok I do what you say, and I can deploy it, but when I invoke an EJB method, I get this error:

    "EmpleadoSessionEJB not bound"

    I USE THE EJB LIKE THIS:


    Context ctx = getInitialContext();
    Object objref = ctx.lookup("EmpleadoSessionEJB");
    empleadoHome = (EmpleadoSessionEJBHome) PortableRemoteObject.narrow(objref, EmpleadoSessionEJBHome.class);

    empleadoRemote = empleadoHome.create();


    THIS IS HOW I GET THE INITIAL CONTEXT:


        private Context getInitialContext() throws NamingException
        {
            Properties properties = null;
            String error = "";
            properties = new Properties();
            properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
            properties.put("java.naming.provider.url", "jnp://localhost:1099");
            properties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
            try
            {
                return new InitialContext(properties);
            }
            catch (NamingException e)
            {
                System.out.println("ERROR_DTO " +
                e.getMessage());
                error = "error.servidor.general";
                throw new NamingException(error);
            }
        }

    THANKS FOR YOUR HELP!!!
  4. Create jboss.xml and rebuild your ejb[ Go to top ]

    Save this as jboss.xml and rebuild your ejb and deploy.
    Everything else what you have done is perfectly fine.
    Make sure the docype declaration matches your version of JBoss you are using
    <?xml version="1.0"?>

    <!DOCTYPE jboss PUBLIC
          "-//JBoss//DTD JBOSS 3.2//EN"
          "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">

    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>EmpleadoSessionEJB</ejb-name>
    <jndi-name>EmpleadoSessionEJB</jndi-name>
    </session>
    </enterprise-beans>
    </jboss>
  5. Create jboss.xml and rebuild your ejb[ Go to top ]

    Thanks for all your help, but I get the same error: "EJB not bound"!!! What else can I do??
  6. How you are ensuring your EJB is deployed?
    Check the jndi tree if you have any means to do that.

    Send the stack trace saying ejb not bound. If possible mail me your bean at dasexpress@hotmail.com
  7. I MADE IT, THANKS FOR ALL YOUR HELP, it was a sintaxis error on the web.xml, THANKS!!!
  8. Not able to use EJB with JBoss.[ Go to top ]

    Can you please tell in detail, how did you fix your problem. I am also facing same problem. If I define ejb in web.xml then deployment fails. When I remove entries from web.xml I am able to deploy but I get ClassCastException at run time. Please advise.