2 Replies Latest reply on Dec 17, 2003 6:20 AM by jubyvictor

    JBOSS Hell for newbie !!!! plz help

    jubyvictor

      Hi
      i am trying to call a stateless EJB from a ActionServlet in struts the app
      server i use is jboss 2.4.x, I dont know what is wrong but .. the application
      throws error during startup :'(


      this is the relevant log...

      [01:11:11,562,EmbeddedCatalinaServiceSX] linkEjbRefs
      [01:11:11,573,EmbeddedCatalinaServiceSX] Linking ejb-ref: ejb/LoginBean to JNDI
      name: null
      [01:11:11,601,EmbeddedCatalinaServiceSX] Failed to setup web application ENC
      javax.naming.NamingException: ejb-ref: ejb/LoginBean, expected jndi-name in
      jboss-web.xml

      the commands i used to make the ejb-jar, war and ear files are

      jar cvfM rave.war WEB-INF/ images/ *.jsp *.css

      jar cvfM rave-ejb.jar META-INF/ejb-jar.xml raveEjb/*.class

      jar cvfM rave.ear META-INF/application.xml META-INF/jboss.xml
      META-INF/jboss-web.xml rave.war rave-ejb.jar

      the contents of the XML files are
      EJB-JAR.xml
      ===========
      <ejb-jar>
      EJBs for Rave
      <display-name>Rave EJB</display-name>
      <enterprise-beans>

      <ejb-name>LoginBean</ejb-name>
      raveEjb.LoginHome
      raveEjb.Login
      <ejb-class>raveEjb.LoginEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>LoginBean</ejb-name>
      <method-intf>Remote</method-intf>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      JBOSS.XML
      =========
      <?xml version="1.0" encoding="Cp1252"?>

      <enterprise-beans>

      <ejb-name>ejb/LoginBean</ejb-name>
      <jndi-name>ejb/LoginBean</jndi-name>

      false
      </enterprise-beans>


      JBOSS-WEB.XML
      ============
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>ejb/LoginBean</ejb-ref-name>
      <jndi-name>ejb/LoginBean</jndi-name>
      </ejb-ref>
      </jboss-web>

      WEB.XML
      =======
      <ejb-ref>
      <ejb-ref-name>ejb/LoginBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      raveEjb.LoginHome
      raveEjb.Login
      </ejb-ref>


      this is my ejb access code
      =========================

      //Properties for jboss
      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "localhost:1099");

      //obtain a jndi server reference
      Context ctx = new InitialContext(props);

      //Get a home Interface reference
      Object loginEjbObj = ctx.lookup("java:comp/env/ejb/LoginBean");

      //Typecast this object into a home interface type
      //use this if we use remote home method
      LoginHome home =
      (LoginHome)PortableRemoteObject.narrow(loginEjbObj,LoginHome.class);


      //Obtain a remote interface
      Login loginObj = home.create();

      // Call the EJB's validation method

      if(loginObj.validateUser(s_user_Name, s_password))
      {


      Can anyone tell me why on earth do i get the exception ?????

      ( I have chkd for META-INF & WEB-INF dir names )